diff --git a/its/core-it-suite/pom.xml b/its/core-it-suite/pom.xml index 4252e12078..e4983dbe64 100644 --- a/its/core-it-suite/pom.xml +++ b/its/core-it-suite/pom.xml @@ -1,5 +1,4 @@ - - - + 4.0.0 @@ -77,8 +74,8 @@ under the License. localhost 80 none - - + + localhost 1.6.1 9.4.50.v20221201 @@ -486,8 +483,8 @@ under the License. src/test/resources - src/test/resources-filtered true + src/test/resources-filtered @@ -542,17 +539,6 @@ under the License. run-its - - - - org.apache.maven.plugins - maven-surefire-plugin - - false - - - - @@ -574,6 +560,17 @@ under the License. test + + + + org.apache.maven.plugins + maven-surefire-plugin + + false + + + + maven-repo-local @@ -625,7 +622,7 @@ under the License. (,1.8) - -Xmx384m -XX:MaxPermSize=192m + -Xmx384m -XX:MaxPermSize=192m @@ -676,10 +673,10 @@ under the License. download-maven-distro - process-test-resources copy + process-test-resources @@ -702,20 +699,17 @@ under the License. unpack-maven-distro - process-test-resources run + process-test-resources - - + + - + @@ -748,19 +742,17 @@ under the License. unpack-maven-distro - process-test-resources run + process-test-resources - - + + - + @@ -789,18 +781,17 @@ under the License. copy-maven-distro - process-test-classes run + process-test-classes - + - + @@ -812,10 +803,10 @@ under the License. inject-emma-into-core-realm - process-test-classes copy + process-test-classes @@ -853,17 +844,17 @@ under the License. instrument - process-test-classes instrument + process-test-classes report - test report + test diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/HttpServer.java b/its/core-it-suite/src/test/java/org/apache/maven/it/HttpServer.java index 4c104a8f7b..c93ec9ff0e 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/HttpServer.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/HttpServer.java @@ -1,5 +1,35 @@ +/* + * 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.it; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.URL; +import java.util.Collections; + import com.google.common.io.ByteStreams; import org.eclipse.jetty.security.ConstraintMapping; import org.eclipse.jetty.security.ConstraintSecurityHandler; @@ -20,17 +50,6 @@ import org.eclipse.jetty.util.security.Password; import org.eclipse.jetty.util.thread.QueuedThreadPool; import org.eclipse.jetty.util.thread.ScheduledExecutorScheduler; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.URL; -import java.util.Collections; - /** * An HTTP server that handles all requests on a given port from a specified source, optionally secured using BASIC auth * by providing a username and password. The source can either be a URL or a directory. When a request is made the @@ -38,14 +57,12 @@ import java.util.Collections; * * @author Jason van Zyl */ -public class HttpServer -{ +public class HttpServer { static { Log.initialized(); Logger rootLogger = Log.getRootLogger(); - if ( rootLogger instanceof StdErrLog ) - { - ( (StdErrLog) rootLogger ).setLevel( StdErrLog.LEVEL_WARN ); + if (rootLogger instanceof StdErrLog) { + ((StdErrLog) rootLogger).setLevel(StdErrLog.LEVEL_WARN); } } @@ -57,96 +74,81 @@ public class HttpServer private final String password; - public HttpServer( int port, String username, String password, StreamSource source ) - { + public HttpServer(int port, String username, String password, StreamSource source) { this.username = username; this.password = password; this.source = source; - this.server = server( port ); + this.server = server(port); } - public void start() - throws Exception - { + public void start() throws Exception { server.start(); // server.join(); } - public boolean isFailed() - { + public boolean isFailed() { return server.isFailed(); } - public void stop() - throws Exception - { + public void stop() throws Exception { server.stop(); } - public void join() - throws Exception - { + public void join() throws Exception { server.join(); } - public int port() - { - return ( (NetworkConnector) server.getConnectors()[0] ).getLocalPort(); + public int port() { + return ((NetworkConnector) server.getConnectors()[0]).getLocalPort(); } - private Server server( int port ) - { + private Server server(int port) { QueuedThreadPool threadPool = new QueuedThreadPool(); - threadPool.setMaxThreads( 500 ); - Server server = new Server( threadPool ); - server.setConnectors( new Connector[]{ new ServerConnector( server ) } ); - server.addBean( new ScheduledExecutorScheduler() ); + threadPool.setMaxThreads(500); + Server server = new Server(threadPool); + server.setConnectors(new Connector[] {new ServerConnector(server)}); + server.addBean(new ScheduledExecutorScheduler()); ServerConnector connector = (ServerConnector) server.getConnectors()[0]; - connector.setIdleTimeout( 30_000L ); - connector.setPort( port ); + connector.setIdleTimeout(30_000L); + connector.setPort(port); - StreamSourceHandler handler = new StreamSourceHandler( source ); + StreamSourceHandler handler = new StreamSourceHandler(source); - if ( username != null && password != null ) - { - HashLoginService loginService = new HashLoginService( "Test Server" ); + if (username != null && password != null) { + HashLoginService loginService = new HashLoginService("Test Server"); UserStore userStore = new UserStore(); - userStore.addUser( username, new Password( password ), new String[] { "user" } ); - loginService.setUserStore( userStore ); - server.addBean( loginService ); + userStore.addUser(username, new Password(password), new String[] {"user"}); + loginService.setUserStore(userStore); + server.addBean(loginService); ConstraintSecurityHandler security = new ConstraintSecurityHandler(); - server.setHandler( security ); + server.setHandler(security); Constraint constraint = new Constraint(); - constraint.setName( "auth" ); - constraint.setAuthenticate( true ); - constraint.setRoles( new String[]{ "user", "admin" } ); + constraint.setName("auth"); + constraint.setAuthenticate(true); + constraint.setRoles(new String[] {"user", "admin"}); ConstraintMapping mapping = new ConstraintMapping(); - mapping.setPathSpec( "/*" ); - mapping.setConstraint( constraint ); + mapping.setPathSpec("/*"); + mapping.setConstraint(constraint); - security.setConstraintMappings( Collections.singletonList( mapping ) ); - security.setAuthenticator( new BasicAuthenticator() ); - security.setLoginService( loginService ); - security.setHandler( handler ); - } - else - { - server.setHandler( handler ); + security.setConstraintMappings(Collections.singletonList(mapping)); + security.setAuthenticator(new BasicAuthenticator()); + security.setLoginService(loginService); + security.setHandler(handler); + } else { + server.setHandler(handler); } return server; } - public static HttpServerBuilder builder() - { + public static HttpServerBuilder builder() { return new HttpServerBuilder(); } - public static class HttpServerBuilder - { + public static class HttpServerBuilder { private int port; @@ -156,100 +158,78 @@ public class HttpServer private StreamSource source; - public HttpServerBuilder port( int port ) - { + public HttpServerBuilder port(int port) { this.port = port; return this; } - public HttpServerBuilder username( String username ) - { + public HttpServerBuilder username(String username) { this.username = username; return this; } - public HttpServerBuilder password( String password ) - { + public HttpServerBuilder password(String password) { this.password = password; return this; } - public HttpServerBuilder source( final String source ) - { - this.source = new StreamSource() - { + public HttpServerBuilder source(final String source) { + this.source = new StreamSource() { @Override - public InputStream stream( String path ) - throws IOException - { - return new URL( String.format( "%s/%s", source, path ) ).openStream(); + public InputStream stream(String path) throws IOException { + return new URL(String.format("%s/%s", source, path)).openStream(); } }; return this; } - public HttpServerBuilder source( final File source ) - { - this.source = new StreamSource() - { + public HttpServerBuilder source(final File source) { + this.source = new StreamSource() { @Override - public InputStream stream( String path ) - throws IOException - { - return new FileInputStream( new File( source, path ) ); + public InputStream stream(String path) throws IOException { + return new FileInputStream(new File(source, path)); } }; return this; } - public HttpServer build() - { - return new HttpServer( port, username, password, source ); + public HttpServer build() { + return new HttpServer(port, username, password, source); } } - public interface StreamSource - { - InputStream stream( String path ) - throws IOException; + public interface StreamSource { + InputStream stream(String path) throws IOException; } - public static class StreamSourceHandler - extends AbstractHandler - { + public static class StreamSourceHandler extends AbstractHandler { private final StreamSource source; - public StreamSourceHandler( StreamSource source ) - { + public StreamSourceHandler(StreamSource source) { this.source = source; } @Override - public void handle( String target, Request baseRequest, HttpServletRequest request, - HttpServletResponse response ) - throws IOException, ServletException - { - response.setContentType( "application/octet-stream" ); - response.setStatus( HttpServletResponse.SC_OK ); - try ( InputStream in = source.stream( - target.substring( 1 ) ); OutputStream out = response.getOutputStream() ) - { - ByteStreams.copy( in, out ); + public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException { + response.setContentType("application/octet-stream"); + response.setStatus(HttpServletResponse.SC_OK); + try (InputStream in = source.stream(target.substring(1)); + OutputStream out = response.getOutputStream()) { + ByteStreams.copy(in, out); } - baseRequest.setHandled( true ); + baseRequest.setHandled(true); } } - public static void main( String[] args ) - throws Exception - { + public static void main(String[] args) throws Exception { HttpServer server = HttpServer.builder() // - .port( 0 ) // - .username( "maven" ) // - .password( "secret" ) // - .source( new File( "/tmp/repo" ) ) // - .build(); + .port(0) // + .username("maven") // + .password("secret") // + .source(new File("/tmp/repo")) // + .build(); server.start(); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/ItUtils.java b/its/core-it-suite/src/test/java/org/apache/maven/it/ItUtils.java index 845c63de9d..786d501ea2 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/ItUtils.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/ItUtils.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,7 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.it; import java.io.File; import java.io.FileInputStream; @@ -27,42 +26,34 @@ import java.security.MessageDigest; /** * @author Benjamin Bentmann */ -class ItUtils -{ +class ItUtils { - public static String calcHash( File file, String algo ) - throws Exception - { - MessageDigest digester = MessageDigest.getInstance( algo ); + public static String calcHash(File file, String algo) throws Exception { + MessageDigest digester = MessageDigest.getInstance(algo); DigestInputStream dis; - try ( FileInputStream is = new FileInputStream( file ) ) - { - dis = new DigestInputStream( is, digester ); + try (FileInputStream is = new FileInputStream(file)) { + dis = new DigestInputStream(is, digester); - for ( byte[] buffer = new byte[1024 * 4]; dis.read( buffer ) >= 0; ) - { + for (byte[] buffer = new byte[1024 * 4]; dis.read(buffer) >= 0; ) { // just read it } } byte[] digest = digester.digest(); - StringBuilder hash = new StringBuilder( digest.length * 2 ); + StringBuilder hash = new StringBuilder(digest.length * 2); - for ( byte aDigest : digest ) - { + for (byte aDigest : digest) { int b = aDigest & 0xFF; - if ( b < 0x10 ) - { - hash.append( '0' ); + if (b < 0x10) { + hash.append('0'); } - hash.append( Integer.toHexString( b ) ); + hash.append(Integer.toHexString(b)); } return hash.toString(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0008SimplePluginTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0008SimplePluginTest.java index 0596e41b7c..740339a53d 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0008SimplePluginTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0008SimplePluginTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,21 +16,18 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; -public class MavenIT0008SimplePluginTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenIT0008SimplePluginTest extends AbstractMavenIntegrationTestCase { - public MavenIT0008SimplePluginTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenIT0008SimplePluginTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -44,19 +39,16 @@ public class MavenIT0008SimplePluginTest * @throws Exception in case of failure */ @Test - public void testit0008() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0008" ); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifact( "org.apache.maven.its.plugins", "maven-it-plugin-touch", "1.0", "maven-plugin" ); - verifier.addCliArgument( "process-sources" ); + public void testit0008() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/it0008"); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifact("org.apache.maven.its.plugins", "maven-it-plugin-touch", "1.0", "maven-plugin"); + verifier.addCliArgument("process-sources"); verifier.execute(); - verifier.verifyFilePresent( "target/touch.txt" ); - verifier.verifyFilePresent( "target/test-basedir-alignment/touch.txt" ); + verifier.verifyFilePresent("target/touch.txt"); + verifier.verifyFilePresent("target/test-basedir-alignment/touch.txt"); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0009GoalConfigurationTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0009GoalConfigurationTest.java index 2a051a97be..3ad8bb2ead 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0009GoalConfigurationTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0009GoalConfigurationTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,21 +16,18 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; -public class MavenIT0009GoalConfigurationTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenIT0009GoalConfigurationTest extends AbstractMavenIntegrationTestCase { - public MavenIT0009GoalConfigurationTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenIT0009GoalConfigurationTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -42,22 +37,19 @@ public class MavenIT0009GoalConfigurationTest * @throws Exception in case of failure */ @Test - public void testit0009() - throws Exception - { + public void testit0009() throws Exception { - boolean supportSpaceInXml = matchesVersionRange( "[3.1.0,)"); + boolean supportSpaceInXml = matchesVersionRange("[3.1.0,)"); - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0009" ); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/it0009"); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); - verifier.verifyFilePresent( supportSpaceInXml ? "target/ pluginItem " : "target/pluginItem"); - verifier.verifyFilePresent( "target/goalItem" ); - verifier.verifyFileNotPresent( "target/bad-item" ); + verifier.verifyFilePresent(supportSpaceInXml ? "target/ pluginItem " : "target/pluginItem"); + verifier.verifyFilePresent("target/goalItem"); + verifier.verifyFileNotPresent("target/bad-item"); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0010DependencyClosureResolutionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0010DependencyClosureResolutionTest.java index eefff0452b..a59b04316b 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0010DependencyClosureResolutionTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0010DependencyClosureResolutionTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,21 +16,18 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; -public class MavenIT0010DependencyClosureResolutionTest - extends AbstractMavenIntegrationTestCase -{ - public MavenIT0010DependencyClosureResolutionTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenIT0010DependencyClosureResolutionTest extends AbstractMavenIntegrationTestCase { + public MavenIT0010DependencyClosureResolutionTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -43,29 +38,26 @@ public class MavenIT0010DependencyClosureResolutionTest * @throws Exception in case of failure */ @Test - public void testit0010() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0010" ); + public void testit0010() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/it0010"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.it0010" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.it0010"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyArtifactPresent( "org.apache.maven.its.it0010", "a", "0.1", "jar" ); - verifier.verifyArtifactPresent( "org.apache.maven.its.it0010", "b", "0.2", "jar" ); - verifier.verifyArtifactPresent( "org.apache.maven.its.it0010", "parent", "1.0", "pom" ); + verifier.verifyArtifactPresent("org.apache.maven.its.it0010", "a", "0.1", "jar"); + verifier.verifyArtifactPresent("org.apache.maven.its.it0010", "b", "0.2", "jar"); + verifier.verifyArtifactPresent("org.apache.maven.its.it0010", "parent", "1.0", "pom"); - List artifacts = verifier.loadLines( "target/compile.txt", "UTF-8" ); - assertTrue( artifacts.toString(), artifacts.contains( "org.apache.maven.its.it0010:a:jar:0.1" ) ); - assertTrue( artifacts.toString(), artifacts.contains( "org.apache.maven.its.it0010:b:jar:0.2" ) ); + List artifacts = verifier.loadLines("target/compile.txt", "UTF-8"); + assertTrue(artifacts.toString(), artifacts.contains("org.apache.maven.its.it0010:a:jar:0.1")); + assertTrue(artifacts.toString(), artifacts.contains("org.apache.maven.its.it0010:b:jar:0.2")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0011DefaultVersionByDependencyManagementTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0011DefaultVersionByDependencyManagementTest.java index 8a76f0f124..e3338a5b4c 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0011DefaultVersionByDependencyManagementTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0011DefaultVersionByDependencyManagementTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,21 +16,18 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; -public class MavenIT0011DefaultVersionByDependencyManagementTest - extends AbstractMavenIntegrationTestCase -{ - public MavenIT0011DefaultVersionByDependencyManagementTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenIT0011DefaultVersionByDependencyManagementTest extends AbstractMavenIntegrationTestCase { + public MavenIT0011DefaultVersionByDependencyManagementTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -41,24 +36,21 @@ public class MavenIT0011DefaultVersionByDependencyManagementTest * @throws Exception in case of failure */ @Test - public void testit0011() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0011" ); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.it0011" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + public void testit0011() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/it0011"); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.it0011"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List artifacts = verifier.loadLines( "target/compile.txt", "UTF-8" ); - assertTrue( artifacts.toString(), artifacts.contains( "org.apache.maven.its.it0011:a:jar:0.1" ) ); - assertTrue( artifacts.toString(), artifacts.contains( "org.apache.maven.its.it0011:b:jar:0.2" ) ); + List artifacts = verifier.loadLines("target/compile.txt", "UTF-8"); + assertTrue(artifacts.toString(), artifacts.contains("org.apache.maven.its.it0011:a:jar:0.1")); + assertTrue(artifacts.toString(), artifacts.contains("org.apache.maven.its.it0011:b:jar:0.2")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0012PomInterpolationTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0012PomInterpolationTest.java index 4e623400cd..5d87666507 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0012PomInterpolationTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0012PomInterpolationTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,20 +16,17 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; -public class MavenIT0012PomInterpolationTest - extends AbstractMavenIntegrationTestCase -{ - public MavenIT0012PomInterpolationTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenIT0012PomInterpolationTest extends AbstractMavenIntegrationTestCase { + public MavenIT0012PomInterpolationTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -40,19 +35,16 @@ public class MavenIT0012PomInterpolationTest * @throws Exception in case of failure */ @Test - public void testit0012() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0012" ); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteDirectory( "child-project/target" ); - verifier.addCliArgument( "org.apache.maven.its.plugins:maven-it-plugin-touch:touch" ); + public void testit0012() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/it0012"); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteDirectory("child-project/target"); + verifier.addCliArgument("org.apache.maven.its.plugins:maven-it-plugin-touch:touch"); verifier.execute(); - verifier.verifyFilePresent( "target/touch-3.8.1.txt" ); - verifier.verifyFilePresent( "child-project/target/child-touch-3.0.3.txt" ); + verifier.verifyFilePresent("target/touch-3.8.1.txt"); + verifier.verifyFilePresent("child-project/target/child-touch-3.0.3.txt"); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0018DependencyManagementTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0018DependencyManagementTest.java index fd0b804554..e34002d684 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0018DependencyManagementTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0018DependencyManagementTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,20 +16,17 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; -public class MavenIT0018DependencyManagementTest - extends AbstractMavenIntegrationTestCase -{ - public MavenIT0018DependencyManagementTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenIT0018DependencyManagementTest extends AbstractMavenIntegrationTestCase { + public MavenIT0018DependencyManagementTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -42,20 +37,18 @@ public class MavenIT0018DependencyManagementTest * @throws Exception in case of failure */ @Test - public void testit0018() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0018" ); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.it0018" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "org.apache.maven.its.plugins:maven-it-plugin-dependency-resolution:2.1-SNAPSHOT:compile" ); + public void testit0018() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/it0018"); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.it0018"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument( + "org.apache.maven.its.plugins:maven-it-plugin-dependency-resolution:2.1-SNAPSHOT:compile"); verifier.execute(); - verifier.verifyArtifactPresent( "org.apache.maven.its.it0018", "managed-dep", "1.0.3", "jar" ); + verifier.verifyArtifactPresent("org.apache.maven.its.it0018", "managed-dep", "1.0.3", "jar"); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0019PluginVersionMgmtBySuperPomTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0019PluginVersionMgmtBySuperPomTest.java index e9d9fe898f..4367cdad68 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0019PluginVersionMgmtBySuperPomTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0019PluginVersionMgmtBySuperPomTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,20 +16,17 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; -public class MavenIT0019PluginVersionMgmtBySuperPomTest - extends AbstractMavenIntegrationTestCase -{ - public MavenIT0019PluginVersionMgmtBySuperPomTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenIT0019PluginVersionMgmtBySuperPomTest extends AbstractMavenIntegrationTestCase { + public MavenIT0019PluginVersionMgmtBySuperPomTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -40,17 +35,14 @@ public class MavenIT0019PluginVersionMgmtBySuperPomTest * @throws Exception in case of failure */ @Test - public void testit0019() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0019" ); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "process-resources" ); + public void testit0019() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/it0019"); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("process-resources"); verifier.execute(); - verifier.verifyFilePresent( "target/classes/test.txt" ); + verifier.verifyFilePresent("target/classes/test.txt"); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0021PomProfileTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0021PomProfileTest.java index a54cc40a06..74e63084f4 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0021PomProfileTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0021PomProfileTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,20 +16,17 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; -public class MavenIT0021PomProfileTest - extends AbstractMavenIntegrationTestCase -{ - public MavenIT0021PomProfileTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenIT0021PomProfileTest extends AbstractMavenIntegrationTestCase { + public MavenIT0021PomProfileTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -41,25 +36,22 @@ public class MavenIT0021PomProfileTest * @throws Exception in case of failure */ @Test - public void testit0021() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0021" ); + public void testit0021() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/it0021"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.it0021" ); - verifier.getSystemProperties().setProperty( "includeProfile", "true" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "-Pprofile-2" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.it0021"); + verifier.getSystemProperties().setProperty("includeProfile", "true"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("-Pprofile-2"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyArtifactPresent( "org.apache.maven.its.it0021", "a", "0.1", "jar" ); - verifier.verifyArtifactPresent( "org.apache.maven.its.it0021", "b", "0.1", "jar" ); + verifier.verifyArtifactPresent("org.apache.maven.its.it0021", "a", "0.1", "jar"); + verifier.verifyArtifactPresent("org.apache.maven.its.it0021", "b", "0.1", "jar"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0023SettingsProfileTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0023SettingsProfileTest.java index 67991afcb9..72e59e2b8a 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0023SettingsProfileTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0023SettingsProfileTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,20 +16,17 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; -public class MavenIT0023SettingsProfileTest - extends AbstractMavenIntegrationTestCase -{ - public MavenIT0023SettingsProfileTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenIT0023SettingsProfileTest extends AbstractMavenIntegrationTestCase { + public MavenIT0023SettingsProfileTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -41,21 +36,18 @@ public class MavenIT0023SettingsProfileTest * @throws Exception in case of failure */ @Test - public void testit0023() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0023" ); + public void testit0023() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/it0023"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "org.apache.maven.its.plugins:maven-it-plugin-touch:touch" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("org.apache.maven.its.plugins:maven-it-plugin-touch:touch"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/test.txt" ); + verifier.verifyFilePresent("target/test.txt"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0024MultipleGoalExecutionsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0024MultipleGoalExecutionsTest.java index 77dba9a309..76f68d1751 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0024MultipleGoalExecutionsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0024MultipleGoalExecutionsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,12 +30,9 @@ import org.junit.jupiter.api.Test; * @author John Casey * */ -public class MavenIT0024MultipleGoalExecutionsTest - extends AbstractMavenIntegrationTestCase -{ - public MavenIT0024MultipleGoalExecutionsTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenIT0024MultipleGoalExecutionsTest extends AbstractMavenIntegrationTestCase { + public MavenIT0024MultipleGoalExecutionsTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -47,19 +42,16 @@ public class MavenIT0024MultipleGoalExecutionsTest * @throws Exception in case of failure */ @Test - public void testit0024() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0024" ); + public void testit0024() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/it0024"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "initialize" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("initialize"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/plugin-exec-configuration.txt" ); + verifier.verifyFilePresent("target/plugin-exec-configuration.txt"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0025MultipleExecutionLevelConfigsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0025MultipleExecutionLevelConfigsTest.java index 9284d8f4e8..61dd1145a9 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0025MultipleExecutionLevelConfigsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0025MultipleExecutionLevelConfigsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,12 +30,9 @@ import org.junit.jupiter.api.Test; * @author John Casey * */ -public class MavenIT0025MultipleExecutionLevelConfigsTest - extends AbstractMavenIntegrationTestCase -{ - public MavenIT0025MultipleExecutionLevelConfigsTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenIT0025MultipleExecutionLevelConfigsTest extends AbstractMavenIntegrationTestCase { + public MavenIT0025MultipleExecutionLevelConfigsTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -46,20 +41,17 @@ public class MavenIT0025MultipleExecutionLevelConfigsTest * @throws Exception in case of failure */ @Test - public void testit0025() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0025" ); + public void testit0025() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/it0025"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/test.txt" ); - verifier.verifyFilePresent( "target/test2.txt" ); + verifier.verifyFilePresent("target/test.txt"); + verifier.verifyFilePresent("target/test2.txt"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0030DepPomDepMgmtInheritanceTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0030DepPomDepMgmtInheritanceTest.java index dae056102a..aa7b04ebfe 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0030DepPomDepMgmtInheritanceTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0030DepPomDepMgmtInheritanceTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,20 +16,17 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; -public class MavenIT0030DepPomDepMgmtInheritanceTest - extends AbstractMavenIntegrationTestCase -{ - public MavenIT0030DepPomDepMgmtInheritanceTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenIT0030DepPomDepMgmtInheritanceTest extends AbstractMavenIntegrationTestCase { + public MavenIT0030DepPomDepMgmtInheritanceTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -41,20 +36,16 @@ public class MavenIT0030DepPomDepMgmtInheritanceTest * @throws Exception in case of failure */ @Test - public void testit0030() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0030" ); - Verifier verifier = newVerifier( testDir.getAbsolutePath(), "remote" ); - verifier.deleteArtifact( "org.apache.maven.it", "maven-it-it0030", "1.0-SNAPSHOT", "jar" ); - verifier.deleteArtifact( "org.apache.maven.it", "maven-it-it0030-child-hierarchy", "1.0-SNAPSHOT", "jar" ); - verifier.deleteArtifact( "org.apache.maven.it", "maven-it-it0030-child-project1", "1.0-SNAPSHOT", "jar" ); - verifier.deleteArtifact( "org.apache.maven.it", "maven-it-it0030-child-project2", "1.0-SNAPSHOT", "jar" ); - verifier.addCliArgument( "install" ); + public void testit0030() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/it0030"); + Verifier verifier = newVerifier(testDir.getAbsolutePath(), "remote"); + verifier.deleteArtifact("org.apache.maven.it", "maven-it-it0030", "1.0-SNAPSHOT", "jar"); + verifier.deleteArtifact("org.apache.maven.it", "maven-it-it0030-child-hierarchy", "1.0-SNAPSHOT", "jar"); + verifier.deleteArtifact("org.apache.maven.it", "maven-it-it0030-child-project1", "1.0-SNAPSHOT", "jar"); + verifier.deleteArtifact("org.apache.maven.it", "maven-it-it0030-child-project2", "1.0-SNAPSHOT", "jar"); + verifier.addCliArgument("install"); verifier.execute(); - verifier.verifyFilePresent( "child-hierarchy/project2/target/classes/org/apache/maven/it0001/Person.class" ); + verifier.verifyFilePresent("child-hierarchy/project2/target/classes/org/apache/maven/it0001/Person.class"); verifier.verifyErrorFreeLog(); - } } - diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0032MavenPrerequisiteTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0032MavenPrerequisiteTest.java index d842969eca..928193b33d 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0032MavenPrerequisiteTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0032MavenPrerequisiteTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,20 +16,17 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; -public class MavenIT0032MavenPrerequisiteTest - extends AbstractMavenIntegrationTestCase -{ - public MavenIT0032MavenPrerequisiteTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenIT0032MavenPrerequisiteTest extends AbstractMavenIntegrationTestCase { + public MavenIT0032MavenPrerequisiteTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -40,16 +35,13 @@ public class MavenIT0032MavenPrerequisiteTest * @throws Exception in case of failure */ @Test - public void testit0032() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0032" ); + public void testit0032() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/it0032"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.addCliArgument( "initialize" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.addCliArgument("initialize"); verifier.execute(); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0037AlternatePomFileSameDirTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0037AlternatePomFileSameDirTest.java index 318c9fc694..59b512e218 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0037AlternatePomFileSameDirTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0037AlternatePomFileSameDirTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,12 +30,9 @@ import org.junit.jupiter.api.Test; * @author John Casey * */ -public class MavenIT0037AlternatePomFileSameDirTest - extends AbstractMavenIntegrationTestCase -{ - public MavenIT0037AlternatePomFileSameDirTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenIT0037AlternatePomFileSameDirTest extends AbstractMavenIntegrationTestCase { + public MavenIT0037AlternatePomFileSameDirTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -46,22 +41,19 @@ public class MavenIT0037AlternatePomFileSameDirTest * @throws Exception in case of failure */ @Test - public void testit0037() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0037" ); + public void testit0037() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/it0037"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "-f" ); - verifier.addCliArgument( "pom2.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("-f"); + verifier.addCliArgument("pom2.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/passed.log" ); - verifier.verifyFileNotPresent( "target/failed.log" ); + verifier.verifyFilePresent("target/passed.log"); + verifier.verifyFileNotPresent("target/failed.log"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0038AlternatePomFileDifferentDirTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0038AlternatePomFileDifferentDirTest.java index 657cae66b6..cddb8c3a4d 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0038AlternatePomFileDifferentDirTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0038AlternatePomFileDifferentDirTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,12 +30,9 @@ import org.junit.jupiter.api.Test; * @author John Casey * */ -public class MavenIT0038AlternatePomFileDifferentDirTest - extends AbstractMavenIntegrationTestCase -{ - public MavenIT0038AlternatePomFileDifferentDirTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenIT0038AlternatePomFileDifferentDirTest extends AbstractMavenIntegrationTestCase { + public MavenIT0038AlternatePomFileDifferentDirTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -46,22 +41,19 @@ public class MavenIT0038AlternatePomFileDifferentDirTest * @throws Exception in case of failure */ @Test - public void testit0038() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0038" ); + public void testit0038() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/it0038"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "project/target" ); - verifier.addCliArgument( "-f" ); - verifier.addCliArgument( "project/pom2.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("project/target"); + verifier.addCliArgument("-f"); + verifier.addCliArgument("project/pom2.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "project/target/passed.log" ); - verifier.verifyFileNotPresent( "target/failed.log" ); + verifier.verifyFilePresent("project/target/passed.log"); + verifier.verifyFileNotPresent("target/failed.log"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0040PackagingFromPluginExtensionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0040PackagingFromPluginExtensionTest.java index b95fbad1cd..3a55883200 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0040PackagingFromPluginExtensionTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0040PackagingFromPluginExtensionTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * @author Brett Porter * */ -public class MavenIT0040PackagingFromPluginExtensionTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenIT0040PackagingFromPluginExtensionTest extends AbstractMavenIntegrationTestCase { - public MavenIT0040PackagingFromPluginExtensionTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenIT0040PackagingFromPluginExtensionTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -47,19 +42,16 @@ public class MavenIT0040PackagingFromPluginExtensionTest * @throws Exception in case of failure */ @Test - public void testit0040() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0040" ); + public void testit0040() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/it0040"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "package" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("package"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/maven-it-it0040-1.0-it.jar" ); + verifier.verifyFilePresent("target/maven-it-it0040-1.0-it.jar"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0041ArtifactTypeFromPluginExtensionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0041ArtifactTypeFromPluginExtensionTest.java index b42c73059f..0943b03bfd 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0041ArtifactTypeFromPluginExtensionTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0041ArtifactTypeFromPluginExtensionTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,12 +30,9 @@ import org.junit.jupiter.api.Test; * @author Brett Porter * */ -public class MavenIT0041ArtifactTypeFromPluginExtensionTest - extends AbstractMavenIntegrationTestCase -{ - public MavenIT0041ArtifactTypeFromPluginExtensionTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenIT0041ArtifactTypeFromPluginExtensionTest extends AbstractMavenIntegrationTestCase { + public MavenIT0041ArtifactTypeFromPluginExtensionTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -46,22 +41,19 @@ public class MavenIT0041ArtifactTypeFromPluginExtensionTest * @throws Exception in case of failure */ @Test - public void testit0041() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0041" ); + public void testit0041() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/it0041"); - Verifier verifier = newVerifier( testDir.getAbsolutePath(), "remote" ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven", "maven-core-it-support", "1.2" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath(), "remote"); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven", "maven-core-it-support", "1.2"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyArtifactPresent( "org.apache.maven", "maven-core-it-support", "1.2", "coreit-artifact" ); - verifier.verifyArtifactPresent( "org.apache.maven", "maven-core-it-support", "1.2", "pom" ); + verifier.verifyArtifactPresent("org.apache.maven", "maven-core-it-support", "1.2", "coreit-artifact"); + verifier.verifyArtifactPresent("org.apache.maven", "maven-core-it-support", "1.2", "pom"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0051ReleaseProfileTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0051ReleaseProfileTest.java index c69b4ec315..c6f51ce402 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0051ReleaseProfileTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0051ReleaseProfileTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,21 +16,18 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; -public class MavenIT0051ReleaseProfileTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenIT0051ReleaseProfileTest extends AbstractMavenIntegrationTestCase { - public MavenIT0051ReleaseProfileTest() - { - super( "(2.0.2,4.0.0-alpha-1)" ); + public MavenIT0051ReleaseProfileTest() { + super("(2.0.2,4.0.0-alpha-1)"); } /** @@ -41,21 +36,18 @@ public class MavenIT0051ReleaseProfileTest * @throws Exception in case of failure */ @Test - public void testit0051() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0051" ); + public void testit0051() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/it0051"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "-DperformRelease=true" ); - verifier.addCliArgument( "package" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("-DperformRelease=true"); + verifier.addCliArgument("package"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/source-jar.txt" ); - verifier.verifyFilePresent( "target/javadoc-jar.txt" ); + verifier.verifyFilePresent("target/source-jar.txt"); + verifier.verifyFilePresent("target/javadoc-jar.txt"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0052ReleaseProfileTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0052ReleaseProfileTest.java index ac76ef47b7..135e02b03f 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0052ReleaseProfileTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0052ReleaseProfileTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,20 +16,17 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; -public class MavenIT0052ReleaseProfileTest - extends AbstractMavenIntegrationTestCase -{ - public MavenIT0052ReleaseProfileTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenIT0052ReleaseProfileTest extends AbstractMavenIntegrationTestCase { + public MavenIT0052ReleaseProfileTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -41,21 +36,18 @@ public class MavenIT0052ReleaseProfileTest * @throws Exception in case of failure */ @Test - public void testit0052() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0052" ); + public void testit0052() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/it0052"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "package" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("package"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/jar-jar.txt" ); - verifier.verifyFileNotPresent( "target/source-jar.txt" ); - verifier.verifyFileNotPresent( "target/javadoc-jar.txt" ); + verifier.verifyFilePresent("target/jar-jar.txt"); + verifier.verifyFileNotPresent("target/source-jar.txt"); + verifier.verifyFileNotPresent("target/javadoc-jar.txt"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0056MultipleGoalExecutionsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0056MultipleGoalExecutionsTest.java index 4d5f22a81c..1911a5d88d 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0056MultipleGoalExecutionsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0056MultipleGoalExecutionsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,20 +16,17 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; -public class MavenIT0056MultipleGoalExecutionsTest - extends AbstractMavenIntegrationTestCase -{ - public MavenIT0056MultipleGoalExecutionsTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenIT0056MultipleGoalExecutionsTest extends AbstractMavenIntegrationTestCase { + public MavenIT0056MultipleGoalExecutionsTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -41,20 +36,17 @@ public class MavenIT0056MultipleGoalExecutionsTest * @throws Exception in case of failure */ @Test - public void testit0056() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0056" ); + public void testit0056() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/it0056"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "initialize" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("initialize"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/first-exec.txt" ); - verifier.verifyFilePresent( "target/second-exec.txt" ); + verifier.verifyFilePresent("target/first-exec.txt"); + verifier.verifyFilePresent("target/second-exec.txt"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0063SystemScopeDependencyTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0063SystemScopeDependencyTest.java index a75d153a18..1f60680f3e 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0063SystemScopeDependencyTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0063SystemScopeDependencyTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,21 +16,18 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; -public class MavenIT0063SystemScopeDependencyTest - extends AbstractMavenIntegrationTestCase -{ - public MavenIT0063SystemScopeDependencyTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenIT0063SystemScopeDependencyTest extends AbstractMavenIntegrationTestCase { + public MavenIT0063SystemScopeDependencyTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -41,23 +36,22 @@ public class MavenIT0063SystemScopeDependencyTest * @throws Exception in case of failure */ @Test - public void testit0063() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0063" ); + public void testit0063() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/it0063"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.getSystemProperties().setProperty( "jre.home", new File( testDir, "jdk/jre" ).getPath() ); - verifier.addCliArgument( "org.apache.maven.its.plugins:maven-it-plugin-dependency-resolution:2.1-SNAPSHOT:compile" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.getSystemProperties().setProperty("jre.home", new File(testDir, "jdk/jre").getPath()); + verifier.addCliArgument( + "org.apache.maven.its.plugins:maven-it-plugin-dependency-resolution:2.1-SNAPSHOT:compile"); verifier.execute(); verifier.verifyErrorFreeLog(); - List lines = verifier.loadLines( "target/compile.txt", "UTF-8" ); - assertEquals( 2, lines.size() ); - assertEquals( new File( testDir, "jdk/lib/tools.jar").getCanonicalFile(), - new File( (String) lines.get(1) ).getCanonicalFile() ); + List lines = verifier.loadLines("target/compile.txt", "UTF-8"); + assertEquals(2, lines.size()); + assertEquals( + new File(testDir, "jdk/lib/tools.jar").getCanonicalFile(), + new File((String) lines.get(1)).getCanonicalFile()); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0064MojoConfigViaSettersTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0064MojoConfigViaSettersTest.java index 345ebe9d96..500313c423 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0064MojoConfigViaSettersTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0064MojoConfigViaSettersTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,20 +16,17 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; -public class MavenIT0064MojoConfigViaSettersTest - extends AbstractMavenIntegrationTestCase -{ - public MavenIT0064MojoConfigViaSettersTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenIT0064MojoConfigViaSettersTest extends AbstractMavenIntegrationTestCase { + public MavenIT0064MojoConfigViaSettersTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -41,19 +36,17 @@ public class MavenIT0064MojoConfigViaSettersTest * @throws Exception in case of failure */ @Test - public void testit0064() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0064" ); + public void testit0064() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/it0064"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "org.apache.maven.its.plugins:maven-it-plugin-setter:setter-touch" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("org.apache.maven.its.plugins:maven-it-plugin-setter:setter-touch"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/fooValue" ); - verifier.verifyFilePresent( "target/barValue.baz" ); + verifier.verifyFilePresent("target/fooValue"); + verifier.verifyFilePresent("target/barValue.baz"); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0071PluginConfigWithDottedPropertyTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0071PluginConfigWithDottedPropertyTest.java index 9bc611ecbc..68d1e9744f 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0071PluginConfigWithDottedPropertyTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0071PluginConfigWithDottedPropertyTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,12 +30,9 @@ import org.junit.jupiter.api.Test; * @author John Casey * */ -public class MavenIT0071PluginConfigWithDottedPropertyTest - extends AbstractMavenIntegrationTestCase -{ - public MavenIT0071PluginConfigWithDottedPropertyTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenIT0071PluginConfigWithDottedPropertyTest extends AbstractMavenIntegrationTestCase { + public MavenIT0071PluginConfigWithDottedPropertyTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -47,19 +42,16 @@ public class MavenIT0071PluginConfigWithDottedPropertyTest * @throws Exception in case of failure */ @Test - public void testit0071() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0071" ); + public void testit0071() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/it0071"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "org.apache.maven.its.plugins:maven-it-plugin-touch:touch" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("org.apache.maven.its.plugins:maven-it-plugin-touch:touch"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/foo2" ); + verifier.verifyFilePresent("target/foo2"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0072InterpolationWithDottedPropertyTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0072InterpolationWithDottedPropertyTest.java index 68767b1188..fb47fcaefa 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0072InterpolationWithDottedPropertyTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0072InterpolationWithDottedPropertyTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,12 +31,9 @@ import org.junit.jupiter.api.Test; * @author John Casey * */ -public class MavenIT0072InterpolationWithDottedPropertyTest - extends AbstractMavenIntegrationTestCase -{ - public MavenIT0072InterpolationWithDottedPropertyTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenIT0072InterpolationWithDottedPropertyTest extends AbstractMavenIntegrationTestCase { + public MavenIT0072InterpolationWithDottedPropertyTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -48,20 +43,17 @@ public class MavenIT0072InterpolationWithDottedPropertyTest * @throws Exception in case of failure */ @Test - public void testit0072() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0072" ); + public void testit0072() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/it0072"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/pom.properties" ); - assertEquals( "1.0-SNAPSHOT", props.getProperty( "project.version" ) ); + Properties props = verifier.loadProperties("target/pom.properties"); + assertEquals("1.0-SNAPSHOT", props.getProperty("project.version")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0085TransitiveSystemScopeTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0085TransitiveSystemScopeTest.java index 1a17f5ff7f..6f7d0825b6 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0085TransitiveSystemScopeTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0085TransitiveSystemScopeTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,21 +16,18 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Collection; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; -public class MavenIT0085TransitiveSystemScopeTest - extends AbstractMavenIntegrationTestCase -{ - public MavenIT0085TransitiveSystemScopeTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenIT0085TransitiveSystemScopeTest extends AbstractMavenIntegrationTestCase { + public MavenIT0085TransitiveSystemScopeTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -44,25 +39,22 @@ public class MavenIT0085TransitiveSystemScopeTest * @throws Exception in case of failure */ @Test - public void testit0085() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0085" ); + public void testit0085() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/it0085"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.it0085" ); - verifier.getSystemProperties().setProperty( "test.home", testDir.getAbsolutePath() ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.it0085"); + verifier.getSystemProperties().setProperty("test.home", testDir.getAbsolutePath()); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Collection lines = verifier.loadLines( "target/test.txt", "UTF-8" ); - assertTrue( lines.toString(), lines.contains( "system.jar" ) ); + Collection lines = verifier.loadLines("target/test.txt", "UTF-8"); + assertTrue(lines.toString(), lines.contains("system.jar")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0086PluginRealmTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0086PluginRealmTest.java index bfac0b2843..a09d92556a 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0086PluginRealmTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0086PluginRealmTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author John Casey * */ -public class MavenIT0086PluginRealmTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenIT0086PluginRealmTest extends AbstractMavenIntegrationTestCase { - public MavenIT0086PluginRealmTest() - { - super( "(2.0.2,)" ); + public MavenIT0086PluginRealmTest() { + super("(2.0.2,)"); } /** @@ -49,30 +44,27 @@ public class MavenIT0086PluginRealmTest * @throws Exception in case of failure */ @Test - public void testit0086() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0086" ); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + public void testit0086() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/it0086"); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties pclProps = verifier.loadProperties( "target/pcl.properties" ); - assertNotNull( pclProps.getProperty( "org.apache.maven.plugin.coreit.ClassA" ) ); - assertNotNull( pclProps.getProperty( "org.apache.maven.plugin.coreit.ClassB" ) ); - assertNotNull( pclProps.getProperty( "org.apache.maven.plugin.coreit.SomeClass" ) ); - assertNotNull( pclProps.getProperty( "org/apache/maven/plugin/coreit/a.properties" ) ); - assertEquals( "1", pclProps.getProperty( "org/apache/maven/plugin/coreit/a.properties.count" ) ); - assertNotNull( pclProps.getProperty( "org/apache/maven/plugin/coreit/b.properties" ) ); - assertEquals( "1", pclProps.getProperty( "org/apache/maven/plugin/coreit/b.properties.count" ) ); - assertNotNull( pclProps.getProperty( "org/apache/maven/plugin/coreit/it.properties" ) ); - assertEquals( "2", pclProps.getProperty( "org/apache/maven/plugin/coreit/it.properties.count" ) ); + Properties pclProps = verifier.loadProperties("target/pcl.properties"); + assertNotNull(pclProps.getProperty("org.apache.maven.plugin.coreit.ClassA")); + assertNotNull(pclProps.getProperty("org.apache.maven.plugin.coreit.ClassB")); + assertNotNull(pclProps.getProperty("org.apache.maven.plugin.coreit.SomeClass")); + assertNotNull(pclProps.getProperty("org/apache/maven/plugin/coreit/a.properties")); + assertEquals("1", pclProps.getProperty("org/apache/maven/plugin/coreit/a.properties.count")); + assertNotNull(pclProps.getProperty("org/apache/maven/plugin/coreit/b.properties")); + assertEquals("1", pclProps.getProperty("org/apache/maven/plugin/coreit/b.properties.count")); + assertNotNull(pclProps.getProperty("org/apache/maven/plugin/coreit/it.properties")); + assertEquals("2", pclProps.getProperty("org/apache/maven/plugin/coreit/it.properties.count")); - Properties tcclProps = verifier.loadProperties( "target/tccl.properties" ); - assertEquals( pclProps, tcclProps ); + Properties tcclProps = verifier.loadProperties("target/tccl.properties"); + assertEquals(pclProps, tcclProps); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0087PluginRealmWithProjectLevelDepsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0087PluginRealmWithProjectLevelDepsTest.java index 285c64acdc..f0fb911294 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0087PluginRealmWithProjectLevelDepsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0087PluginRealmWithProjectLevelDepsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author John Casey * */ -public class MavenIT0087PluginRealmWithProjectLevelDepsTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenIT0087PluginRealmWithProjectLevelDepsTest extends AbstractMavenIntegrationTestCase { - public MavenIT0087PluginRealmWithProjectLevelDepsTest() - { - super( "(2.0.2,)" ); + public MavenIT0087PluginRealmWithProjectLevelDepsTest() { + super("(2.0.2,)"); } /** @@ -49,30 +44,27 @@ public class MavenIT0087PluginRealmWithProjectLevelDepsTest * @throws Exception in case of failure */ @Test - public void testit0087() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0087" ); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.it0087" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + public void testit0087() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/it0087"); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.it0087"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties pclProps = verifier.loadProperties( "target/pcl.properties" ); - assertNotNull( pclProps.getProperty( "org.apache.maven.plugin.coreit.ClassA" ) ); - assertNotNull( pclProps.getProperty( "org.apache.maven.plugin.coreit.ClassB" ) ); - assertNotNull( pclProps.getProperty( "org.apache.maven.its.it0087.IT0087" ) ); - assertNotNull( pclProps.getProperty( "src/main/java/org/apache/maven/its/it0087/IT0087.java" ) ); - assertEquals( "1", pclProps.getProperty( "src/main/java/org/apache/maven/its/it0087/IT0087.java.count" ) ); + Properties pclProps = verifier.loadProperties("target/pcl.properties"); + assertNotNull(pclProps.getProperty("org.apache.maven.plugin.coreit.ClassA")); + assertNotNull(pclProps.getProperty("org.apache.maven.plugin.coreit.ClassB")); + assertNotNull(pclProps.getProperty("org.apache.maven.its.it0087.IT0087")); + assertNotNull(pclProps.getProperty("src/main/java/org/apache/maven/its/it0087/IT0087.java")); + assertEquals("1", pclProps.getProperty("src/main/java/org/apache/maven/its/it0087/IT0087.java.count")); - Properties tcclProps = verifier.loadProperties( "target/tccl.properties" ); - assertEquals( pclProps, tcclProps ); + Properties tcclProps = verifier.loadProperties("target/tccl.properties"); + assertEquals(pclProps, tcclProps); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0090EnvVarInterpolationTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0090EnvVarInterpolationTest.java index fb61323182..78d6610596 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0090EnvVarInterpolationTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0090EnvVarInterpolationTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,21 +16,18 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; -public class MavenIT0090EnvVarInterpolationTest - extends AbstractMavenIntegrationTestCase -{ - public MavenIT0090EnvVarInterpolationTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenIT0090EnvVarInterpolationTest extends AbstractMavenIntegrationTestCase { + public MavenIT0090EnvVarInterpolationTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -42,21 +37,18 @@ public class MavenIT0090EnvVarInterpolationTest * @throws Exception in case of failure */ @Test - public void testit0090() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0090" ); + public void testit0090() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/it0090"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.setEnvironmentVariable( "MAVEN_TEST_ENVAR", "MAVEN_TEST_ENVAR_VALUE" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.setEnvironmentVariable("MAVEN_TEST_ENVAR", "MAVEN_TEST_ENVAR_VALUE"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/env.properties" ); - assertEquals( "MAVEN_TEST_ENVAR_VALUE", props.getProperty( "stringParam" ) ); + Properties props = verifier.loadProperties("target/env.properties"); + assertEquals("MAVEN_TEST_ENVAR_VALUE", props.getProperty("stringParam")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0108SnapshotUpdateTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0108SnapshotUpdateTest.java index b512dba68b..aaacc4763a 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0108SnapshotUpdateTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0108SnapshotUpdateTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,10 +16,7 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; import java.io.IOException; @@ -31,6 +26,9 @@ import java.util.Date; import java.util.Locale; import org.apache.maven.shared.utils.io.FileUtils; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; @@ -39,13 +37,10 @@ import org.junit.jupiter.api.Test; * Downloads a snapshot dependency that was deployed with uniqueVersion = false, and checks it can be * updated. See MNG-1908. */ -@Disabled( "flaky test, see MNG-3137" ) -public class MavenIT0108SnapshotUpdateTest - extends AbstractMavenIntegrationTestCase -{ - public MavenIT0108SnapshotUpdateTest() - { - super( ALL_MAVEN_VERSIONS ); +@Disabled("flaky test, see MNG-3137") +public class MavenIT0108SnapshotUpdateTest extends AbstractMavenIntegrationTestCase { + public MavenIT0108SnapshotUpdateTest() { + super(ALL_MAVEN_VERSIONS); } private Verifier verifier; @@ -59,216 +54,195 @@ public class MavenIT0108SnapshotUpdateTest private static final int TIME_OFFSET = 50000; @BeforeEach - protected void setUp() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0108" ); - verifier = newVerifier( testDir.getAbsolutePath() ); - localRepoFile = getLocalRepoFile( verifier ); - deleteLocalArtifact( verifier, localRepoFile ); + protected void setUp() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/it0108"); + verifier = newVerifier(testDir.getAbsolutePath()); + localRepoFile = getLocalRepoFile(verifier); + deleteLocalArtifact(verifier, localRepoFile); - repository = new File( testDir, "repository" ); - recreateRemoteRepository( repository ); + repository = new File(testDir, "repository"); + recreateRemoteRepository(repository); // create artifact in repository (TODO: into verifier) - artifact = new File( repository, - "org/apache/maven/maven-core-it-support/1.0-SNAPSHOT/maven-core-it-support-1.0-SNAPSHOT.jar" ); + artifact = new File( + repository, + "org/apache/maven/maven-core-it-support/1.0-SNAPSHOT/maven-core-it-support-1.0-SNAPSHOT.jar"); artifact.getParentFile().mkdirs(); - FileUtils.fileWrite( artifact.getAbsolutePath(), "originalArtifact" ); + FileUtils.fileWrite(artifact.getAbsolutePath(), "originalArtifact"); - verifier.verifyArtifactNotPresent( "org.apache.maven", "maven-core-it-support", "1.0-SNAPSHOT", "jar" ); + verifier.verifyArtifactNotPresent("org.apache.maven", "maven-core-it-support", "1.0-SNAPSHOT", "jar"); } @Test - public void testSnapshotUpdated() - throws Exception - { - verifier.addCliArgument( "package" ); + public void testSnapshotUpdated() throws Exception { + verifier.addCliArgument("package"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifyArtifactContent( "originalArtifact" ); + verifyArtifactContent("originalArtifact"); // set in the past to ensure it is downloaded - localRepoFile.setLastModified( System.currentTimeMillis() - TIME_OFFSET ); + localRepoFile.setLastModified(System.currentTimeMillis() - TIME_OFFSET); - FileUtils.fileWrite( artifact.getAbsolutePath(), "updatedArtifact" ); + FileUtils.fileWrite(artifact.getAbsolutePath(), "updatedArtifact"); - verifier.addCliArgument( "package" ); + verifier.addCliArgument("package"); verifier.execute(); - verifyArtifactContent( "updatedArtifact" ); + verifyArtifactContent("updatedArtifact"); verifier.verifyErrorFreeLog(); } @Test - public void testSnapshotUpdatedWithMetadata() - throws Exception - { - File metadata = - new File( repository, "org/apache/maven/maven-core-it-support/1.0-SNAPSHOT/maven-metadata.xml" ); - FileUtils.fileWrite( metadata.getAbsolutePath(), - constructMetadata( "1", System.currentTimeMillis() - TIME_OFFSET, true ) ); + public void testSnapshotUpdatedWithMetadata() throws Exception { + File metadata = new File(repository, "org/apache/maven/maven-core-it-support/1.0-SNAPSHOT/maven-metadata.xml"); + FileUtils.fileWrite( + metadata.getAbsolutePath(), constructMetadata("1", System.currentTimeMillis() - TIME_OFFSET, true)); - verifier.addCliArgument( "package" ); + verifier.addCliArgument("package"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifyArtifactContent( "originalArtifact" ); + verifyArtifactContent("originalArtifact"); - FileUtils.fileWrite( artifact.getAbsolutePath(), "updatedArtifact" ); - metadata = new File( repository, "org/apache/maven/maven-core-it-support/1.0-SNAPSHOT/maven-metadata.xml" ); - FileUtils.fileWrite( metadata.getAbsolutePath(), constructMetadata( "2", System.currentTimeMillis(), true ) ); + FileUtils.fileWrite(artifact.getAbsolutePath(), "updatedArtifact"); + metadata = new File(repository, "org/apache/maven/maven-core-it-support/1.0-SNAPSHOT/maven-metadata.xml"); + FileUtils.fileWrite(metadata.getAbsolutePath(), constructMetadata("2", System.currentTimeMillis(), true)); - verifier.addCliArgument( "package" ); + verifier.addCliArgument("package"); verifier.execute(); - verifyArtifactContent( "updatedArtifact" ); + verifyArtifactContent("updatedArtifact"); verifier.verifyErrorFreeLog(); } @Test - public void testSnapshotUpdatedWithLocalMetadata() - throws Exception - { - File localMetadata = getMetadataFile( "org/apache/maven", "maven-core-it-support", "1.0-SNAPSHOT" ); + public void testSnapshotUpdatedWithLocalMetadata() throws Exception { + File localMetadata = getMetadataFile("org/apache/maven", "maven-core-it-support", "1.0-SNAPSHOT"); - FileUtils.deleteDirectory( localMetadata.getParentFile() ); - assertFalse( localMetadata.getParentFile().exists() ); + FileUtils.deleteDirectory(localMetadata.getParentFile()); + assertFalse(localMetadata.getParentFile().exists()); localMetadata.getParentFile().mkdirs(); - File metadata = - new File( repository, "org/apache/maven/maven-core-it-support/1.0-SNAPSHOT/maven-metadata.xml" ); - FileUtils.fileWrite( metadata.getAbsolutePath(), - constructMetadata( "1", System.currentTimeMillis() - TIME_OFFSET, true ) ); + File metadata = new File(repository, "org/apache/maven/maven-core-it-support/1.0-SNAPSHOT/maven-metadata.xml"); + FileUtils.fileWrite( + metadata.getAbsolutePath(), constructMetadata("1", System.currentTimeMillis() - TIME_OFFSET, true)); - verifier.addCliArgument( "package" ); + verifier.addCliArgument("package"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifyArtifactContent( "originalArtifact" ); - assertFalse( localMetadata.exists() ); + verifyArtifactContent("originalArtifact"); + assertFalse(localMetadata.exists()); - FileUtils.fileWrite( localRepoFile.getAbsolutePath(), "localArtifact" ); - FileUtils.fileWrite( localMetadata.getAbsolutePath(), constructLocalMetadata( "org.apache.maven", - "maven-core-it-support", - System.currentTimeMillis(), - true ) ); + FileUtils.fileWrite(localRepoFile.getAbsolutePath(), "localArtifact"); + FileUtils.fileWrite( + localMetadata.getAbsolutePath(), + constructLocalMetadata("org.apache.maven", "maven-core-it-support", System.currentTimeMillis(), true)); // update the remote file, but we shouldn't be looking - artifact.setLastModified( System.currentTimeMillis() ); + artifact.setLastModified(System.currentTimeMillis()); - verifier.addCliArgument( "package" ); + verifier.addCliArgument("package"); verifier.execute(); - verifyArtifactContent( "localArtifact" ); + verifyArtifactContent("localArtifact"); verifier.verifyErrorFreeLog(); Calendar cal = Calendar.getInstance(); - cal.add( Calendar.YEAR, -1 ); - FileUtils.fileWrite( localMetadata.getAbsolutePath(), constructLocalMetadata( "org.apache.maven", - "maven-core-it-support", - cal.getTimeInMillis(), true ) ); - FileUtils.fileWrite( metadata.getAbsolutePath(), - constructMetadata( "2", System.currentTimeMillis() - 2000, true ) ); - artifact.setLastModified( System.currentTimeMillis() ); + cal.add(Calendar.YEAR, -1); + FileUtils.fileWrite( + localMetadata.getAbsolutePath(), + constructLocalMetadata("org.apache.maven", "maven-core-it-support", cal.getTimeInMillis(), true)); + FileUtils.fileWrite( + metadata.getAbsolutePath(), constructMetadata("2", System.currentTimeMillis() - 2000, true)); + artifact.setLastModified(System.currentTimeMillis()); - verifier.addCliArgument( "package" ); + verifier.addCliArgument("package"); verifier.execute(); - verifyArtifactContent( "originalArtifact" ); + verifyArtifactContent("originalArtifact"); verifier.verifyErrorFreeLog(); } @Test - public void testSnapshotUpdatedWithMetadataUsingFileTimestamp() - throws Exception - { - File metadata = - new File( repository, "org/apache/maven/maven-core-it-support/1.0-SNAPSHOT/maven-metadata.xml" ); - FileUtils.fileWrite( metadata.getAbsolutePath(), - constructMetadata( "1", System.currentTimeMillis() - TIME_OFFSET, false ) ); - metadata.setLastModified( System.currentTimeMillis() - TIME_OFFSET ); + public void testSnapshotUpdatedWithMetadataUsingFileTimestamp() throws Exception { + File metadata = new File(repository, "org/apache/maven/maven-core-it-support/1.0-SNAPSHOT/maven-metadata.xml"); + FileUtils.fileWrite( + metadata.getAbsolutePath(), constructMetadata("1", System.currentTimeMillis() - TIME_OFFSET, false)); + metadata.setLastModified(System.currentTimeMillis() - TIME_OFFSET); - verifier.addCliArgument( "package" ); + verifier.addCliArgument("package"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifyArtifactContent( "originalArtifact" ); + verifyArtifactContent("originalArtifact"); - FileUtils.fileWrite( artifact.getAbsolutePath(), "updatedArtifact" ); - metadata = new File( repository, "org/apache/maven/maven-core-it-support/1.0-SNAPSHOT/maven-metadata.xml" ); - FileUtils.fileWrite( metadata.getAbsolutePath(), constructMetadata( "2", System.currentTimeMillis(), false ) ); + FileUtils.fileWrite(artifact.getAbsolutePath(), "updatedArtifact"); + metadata = new File(repository, "org/apache/maven/maven-core-it-support/1.0-SNAPSHOT/maven-metadata.xml"); + FileUtils.fileWrite(metadata.getAbsolutePath(), constructMetadata("2", System.currentTimeMillis(), false)); - verifier.addCliArgument( "package" ); + verifier.addCliArgument("package"); verifier.execute(); - verifyArtifactContent( "updatedArtifact" ); + verifyArtifactContent("updatedArtifact"); verifier.verifyErrorFreeLog(); } - private File getMetadataFile( String groupId, String artifactId, String version ) - { - return new File( verifier.getArtifactMetadataPath( groupId, artifactId, version, "maven-metadata-local.xml" ) ); + private File getMetadataFile(String groupId, String artifactId, String version) { + return new File(verifier.getArtifactMetadataPath(groupId, artifactId, version, "maven-metadata-local.xml")); } - private void verifyArtifactContent( String s ) - throws IOException, VerificationException - { - verifier.verifyArtifactPresent( "org.apache.maven", "maven-core-it-support", "1.0-SNAPSHOT", "jar" ); - verifier.verifyArtifactContent( "org.apache.maven", "maven-core-it-support", "1.0-SNAPSHOT", "jar", s ); + private void verifyArtifactContent(String s) throws IOException, VerificationException { + verifier.verifyArtifactPresent("org.apache.maven", "maven-core-it-support", "1.0-SNAPSHOT", "jar"); + verifier.verifyArtifactContent("org.apache.maven", "maven-core-it-support", "1.0-SNAPSHOT", "jar", s); } - private static File deleteLocalArtifact( Verifier verifier, File localRepoFile ) - throws IOException - { - verifier.deleteArtifact( "org.apache.maven", "maven-core-it-support", "1.0-SNAPSHOT", "jar" ); + private static File deleteLocalArtifact(Verifier verifier, File localRepoFile) throws IOException { + verifier.deleteArtifact("org.apache.maven", "maven-core-it-support", "1.0-SNAPSHOT", "jar"); // this is to delete metadata - TODO: incorporate into deleteArtifact in verifier - FileUtils.deleteDirectory( localRepoFile.getParentFile() ); + FileUtils.deleteDirectory(localRepoFile.getParentFile()); return localRepoFile; } - private static File getLocalRepoFile( Verifier verifier ) - { - return new File( - verifier.getArtifactPath( "org.apache.maven", "maven-core-it-support", "1.0-SNAPSHOT", "jar" ) ); + private static File getLocalRepoFile(Verifier verifier) { + return new File(verifier.getArtifactPath("org.apache.maven", "maven-core-it-support", "1.0-SNAPSHOT", "jar")); } - private static void recreateRemoteRepository( File repository ) - throws IOException - { + private static void recreateRemoteRepository(File repository) throws IOException { // create a repository (TODO: into verifier) - FileUtils.deleteDirectory( repository ); - assertFalse( repository.exists() ); + FileUtils.deleteDirectory(repository); + assertFalse(repository.exists()); repository.mkdirs(); } - private String constructMetadata( String buildNumber, long timestamp, boolean writeLastUpdated ) - { - String ts = new SimpleDateFormat( "yyyyMMddHHmmss", Locale.US ).format( new Date( timestamp ) ); + private String constructMetadata(String buildNumber, long timestamp, boolean writeLastUpdated) { + String ts = new SimpleDateFormat("yyyyMMddHHmmss", Locale.US).format(new Date(timestamp)); - return "\n" + "org.apache.maven\n" + - "maven-core-it-support\n" + "1.0-SNAPSHOT\n" + - "\n" + "\n" + "" + buildNumber + "\n" + "\n" + - ( writeLastUpdated ? "" + ts + "\n" : "" ) + "\n" + ""; + return "\n" + "org.apache.maven\n" + + "maven-core-it-support\n" + + "1.0-SNAPSHOT\n" + "\n" + + "\n" + "" + buildNumber + "\n" + "\n" + + (writeLastUpdated ? "" + ts + "\n" : "") + + "\n" + ""; } - private String constructLocalMetadata( String groupId, String artifactId, long timestamp, boolean writeLastUpdated ) - { - String ts = new SimpleDateFormat( "yyyyMMddHHmmss", Locale.US ).format( new Date( timestamp ) ); + private String constructLocalMetadata(String groupId, String artifactId, long timestamp, boolean writeLastUpdated) { + String ts = new SimpleDateFormat("yyyyMMddHHmmss", Locale.US).format(new Date(timestamp)); - return "\n" + " " + groupId + "\n" + - " " + artifactId + "\n" + " 1.0-SNAPSHOT\n" + - " \n" + " \n" + " true\n" + " \n" + - ( writeLastUpdated ? " " + ts + "\n" : "" ) + " \n" + - ""; + return "\n" + " " + groupId + "\n" + + " " + + artifactId + "\n" + " 1.0-SNAPSHOT\n" + " \n" + + " \n" + " true\n" + " \n" + + (writeLastUpdated ? " " + ts + "\n" : "") + + " \n" + ""; } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0113ServerAuthzAvailableToWagonMgrInPluginTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0113ServerAuthzAvailableToWagonMgrInPluginTest.java index dbbad02219..63d8218b72 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0113ServerAuthzAvailableToWagonMgrInPluginTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0113ServerAuthzAvailableToWagonMgrInPluginTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,21 +16,18 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; -public class MavenIT0113ServerAuthzAvailableToWagonMgrInPluginTest - extends AbstractMavenIntegrationTestCase -{ - public MavenIT0113ServerAuthzAvailableToWagonMgrInPluginTest() - { - super( "[2.0,3.0-alpha-1),[3.0-alpha-7,)" ); +public class MavenIT0113ServerAuthzAvailableToWagonMgrInPluginTest extends AbstractMavenIntegrationTestCase { + public MavenIT0113ServerAuthzAvailableToWagonMgrInPluginTest() { + super("[2.0,3.0-alpha-1),[3.0-alpha-7,)"); } /** @@ -42,23 +37,20 @@ public class MavenIT0113ServerAuthzAvailableToWagonMgrInPluginTest * @throws Exception in case of failure */ @Test - public void testit0113() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0113" ); + public void testit0113() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/it0113"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/auth.properties" ); - assertEquals( "testuser", props.getProperty( "test.username" ) ); - assertEquals( "testtest", props.getProperty( "test.password" ) ); + Properties props = verifier.loadProperties("target/auth.properties"); + assertEquals("testuser", props.getProperty("test.username")); + assertEquals("testtest", props.getProperty("test.password")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0130CleanLifecycleTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0130CleanLifecycleTest.java index 8ba989680b..8f49ff0d01 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0130CleanLifecycleTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0130CleanLifecycleTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenIT0130CleanLifecycleTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenIT0130CleanLifecycleTest extends AbstractMavenIntegrationTestCase { - public MavenIT0130CleanLifecycleTest() - { - super( "[2.0.0,)" ); + public MavenIT0130CleanLifecycleTest() { + super("[2.0.0,)"); } /** @@ -46,18 +41,15 @@ public class MavenIT0130CleanLifecycleTest * @throws Exception in case of failure */ @Test - public void testit0130() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0130" ); + public void testit0130() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/it0130"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.deleteDirectory( "target" ); - verifier.setAutoclean( false ); - verifier.addCliArgument( "clean" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.deleteDirectory("target"); + verifier.setAutoclean(false); + verifier.addCliArgument("clean"); verifier.execute(); - verifier.verifyFilePresent( "target/clean-clean.txt" ); + verifier.verifyFilePresent("target/clean-clean.txt"); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0131SiteLifecycleTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0131SiteLifecycleTest.java index cda9c31c3f..b9a5ebc222 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0131SiteLifecycleTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0131SiteLifecycleTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenIT0131SiteLifecycleTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenIT0131SiteLifecycleTest extends AbstractMavenIntegrationTestCase { - public MavenIT0131SiteLifecycleTest() - { - super( "[2.0.0,)" ); + public MavenIT0131SiteLifecycleTest() { + super("[2.0.0,)"); } /** @@ -46,19 +41,16 @@ public class MavenIT0131SiteLifecycleTest * @throws Exception in case of failure */ @Test - public void testit0131() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0131" ); + public void testit0131() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/it0131"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.deleteDirectory( "target" ); - verifier.setAutoclean( false ); - verifier.addCliArgument( "site-deploy" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.deleteDirectory("target"); + verifier.setAutoclean(false); + verifier.addCliArgument("site-deploy"); verifier.execute(); - verifier.verifyFilePresent( "target/site-site.txt" ); - verifier.verifyFilePresent( "target/site-deploy.txt" ); + verifier.verifyFilePresent("target/site-site.txt"); + verifier.verifyFilePresent("target/site-deploy.txt"); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0132PomLifecycleTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0132PomLifecycleTest.java index b0e1c1073e..6ad27808a9 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0132PomLifecycleTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0132PomLifecycleTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenIT0132PomLifecycleTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenIT0132PomLifecycleTest extends AbstractMavenIntegrationTestCase { - public MavenIT0132PomLifecycleTest() - { - super( "[2.0.0,)" ); + public MavenIT0132PomLifecycleTest() { + super("[2.0.0,)"); } /** @@ -46,23 +41,19 @@ public class MavenIT0132PomLifecycleTest * @throws Exception in case of failure */ @Test - public void testit0132() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0132" ); + public void testit0132() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/it0132"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.deleteDirectory( "target" ); - verifier.setAutoclean( false ); - verifier.addCliArgument( "deploy" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.deleteDirectory("target"); + verifier.setAutoclean(false); + verifier.addCliArgument("deploy"); verifier.execute(); - if ( matchesVersionRange( "(2.0.1,3.0-alpha-1)" ) ) - { - verifier.verifyFilePresent( "target/site-attach-descriptor.txt" ); + if (matchesVersionRange("(2.0.1,3.0-alpha-1)")) { + verifier.verifyFilePresent("target/site-attach-descriptor.txt"); } - verifier.verifyFilePresent( "target/install-install.txt" ); - verifier.verifyFilePresent( "target/deploy-deploy.txt" ); + verifier.verifyFilePresent("target/install-install.txt"); + verifier.verifyFilePresent("target/deploy-deploy.txt"); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0133JarLifecycleTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0133JarLifecycleTest.java index 226829818f..c2156f1188 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0133JarLifecycleTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0133JarLifecycleTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenIT0133JarLifecycleTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenIT0133JarLifecycleTest extends AbstractMavenIntegrationTestCase { - public MavenIT0133JarLifecycleTest() - { - super( "[2.0.0,)" ); + public MavenIT0133JarLifecycleTest() { + super("[2.0.0,)"); } /** @@ -46,25 +41,22 @@ public class MavenIT0133JarLifecycleTest * @throws Exception in case of failure */ @Test - public void testit0133() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0133" ); + public void testit0133() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/it0133"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.deleteDirectory( "target" ); - verifier.setAutoclean( false ); - verifier.addCliArgument( "deploy" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.deleteDirectory("target"); + verifier.setAutoclean(false); + verifier.addCliArgument("deploy"); verifier.execute(); - verifier.verifyFilePresent( "target/resources-resources.txt" ); - verifier.verifyFilePresent( "target/compiler-compile.txt" ); - verifier.verifyFilePresent( "target/resources-test-resources.txt" ); - verifier.verifyFilePresent( "target/compiler-test-compile.txt" ); - verifier.verifyFilePresent( "target/surefire-test.txt" ); - verifier.verifyFilePresent( "target/jar-jar.txt" ); - verifier.verifyFilePresent( "target/install-install.txt" ); - verifier.verifyFilePresent( "target/deploy-deploy.txt" ); + verifier.verifyFilePresent("target/resources-resources.txt"); + verifier.verifyFilePresent("target/compiler-compile.txt"); + verifier.verifyFilePresent("target/resources-test-resources.txt"); + verifier.verifyFilePresent("target/compiler-test-compile.txt"); + verifier.verifyFilePresent("target/surefire-test.txt"); + verifier.verifyFilePresent("target/jar-jar.txt"); + verifier.verifyFilePresent("target/install-install.txt"); + verifier.verifyFilePresent("target/deploy-deploy.txt"); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0134WarLifecycleTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0134WarLifecycleTest.java index 3d42cdd511..f2b877a72c 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0134WarLifecycleTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0134WarLifecycleTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenIT0134WarLifecycleTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenIT0134WarLifecycleTest extends AbstractMavenIntegrationTestCase { - public MavenIT0134WarLifecycleTest() - { - super( "[2.0.0,)" ); + public MavenIT0134WarLifecycleTest() { + super("[2.0.0,)"); } /** @@ -46,25 +41,22 @@ public class MavenIT0134WarLifecycleTest * @throws Exception in case of failure */ @Test - public void testit0134() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0134" ); + public void testit0134() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/it0134"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.deleteDirectory( "target" ); - verifier.setAutoclean( false ); - verifier.addCliArgument( "deploy" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.deleteDirectory("target"); + verifier.setAutoclean(false); + verifier.addCliArgument("deploy"); verifier.execute(); - verifier.verifyFilePresent( "target/resources-resources.txt" ); - verifier.verifyFilePresent( "target/compiler-compile.txt" ); - verifier.verifyFilePresent( "target/resources-test-resources.txt" ); - verifier.verifyFilePresent( "target/compiler-test-compile.txt" ); - verifier.verifyFilePresent( "target/surefire-test.txt" ); - verifier.verifyFilePresent( "target/war-war.txt" ); - verifier.verifyFilePresent( "target/install-install.txt" ); - verifier.verifyFilePresent( "target/deploy-deploy.txt" ); + verifier.verifyFilePresent("target/resources-resources.txt"); + verifier.verifyFilePresent("target/compiler-compile.txt"); + verifier.verifyFilePresent("target/resources-test-resources.txt"); + verifier.verifyFilePresent("target/compiler-test-compile.txt"); + verifier.verifyFilePresent("target/surefire-test.txt"); + verifier.verifyFilePresent("target/war-war.txt"); + verifier.verifyFilePresent("target/install-install.txt"); + verifier.verifyFilePresent("target/deploy-deploy.txt"); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0135EjbLifecycleTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0135EjbLifecycleTest.java index c586297904..2ee41efee4 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0135EjbLifecycleTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0135EjbLifecycleTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenIT0135EjbLifecycleTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenIT0135EjbLifecycleTest extends AbstractMavenIntegrationTestCase { - public MavenIT0135EjbLifecycleTest() - { - super( "[2.0.0,)" ); + public MavenIT0135EjbLifecycleTest() { + super("[2.0.0,)"); } /** @@ -46,25 +41,22 @@ public class MavenIT0135EjbLifecycleTest * @throws Exception in case of failure */ @Test - public void testit0135() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0135" ); + public void testit0135() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/it0135"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.deleteDirectory( "target" ); - verifier.setAutoclean( false ); - verifier.addCliArgument( "deploy" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.deleteDirectory("target"); + verifier.setAutoclean(false); + verifier.addCliArgument("deploy"); verifier.execute(); - verifier.verifyFilePresent( "target/resources-resources.txt" ); - verifier.verifyFilePresent( "target/compiler-compile.txt" ); - verifier.verifyFilePresent( "target/resources-test-resources.txt" ); - verifier.verifyFilePresent( "target/compiler-test-compile.txt" ); - verifier.verifyFilePresent( "target/surefire-test.txt" ); - verifier.verifyFilePresent( "target/ejb-ejb.txt" ); - verifier.verifyFilePresent( "target/install-install.txt" ); - verifier.verifyFilePresent( "target/deploy-deploy.txt" ); + verifier.verifyFilePresent("target/resources-resources.txt"); + verifier.verifyFilePresent("target/compiler-compile.txt"); + verifier.verifyFilePresent("target/resources-test-resources.txt"); + verifier.verifyFilePresent("target/compiler-test-compile.txt"); + verifier.verifyFilePresent("target/surefire-test.txt"); + verifier.verifyFilePresent("target/ejb-ejb.txt"); + verifier.verifyFilePresent("target/install-install.txt"); + verifier.verifyFilePresent("target/deploy-deploy.txt"); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0136RarLifecycleTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0136RarLifecycleTest.java index 2e229dc454..95ecf5b6ed 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0136RarLifecycleTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0136RarLifecycleTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenIT0136RarLifecycleTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenIT0136RarLifecycleTest extends AbstractMavenIntegrationTestCase { - public MavenIT0136RarLifecycleTest() - { - super( "[2.0.0,)" ); + public MavenIT0136RarLifecycleTest() { + super("[2.0.0,)"); } /** @@ -46,25 +41,22 @@ public class MavenIT0136RarLifecycleTest * @throws Exception in case of failure */ @Test - public void testit0136() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0136" ); + public void testit0136() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/it0136"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.deleteDirectory( "target" ); - verifier.setAutoclean( false ); - verifier.addCliArgument( "deploy" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.deleteDirectory("target"); + verifier.setAutoclean(false); + verifier.addCliArgument("deploy"); verifier.execute(); - verifier.verifyFilePresent( "target/resources-resources.txt" ); - verifier.verifyFilePresent( "target/compiler-compile.txt" ); - verifier.verifyFilePresent( "target/resources-test-resources.txt" ); - verifier.verifyFilePresent( "target/compiler-test-compile.txt" ); - verifier.verifyFilePresent( "target/surefire-test.txt" ); - verifier.verifyFilePresent( "target/rar-rar.txt" ); - verifier.verifyFilePresent( "target/install-install.txt" ); - verifier.verifyFilePresent( "target/deploy-deploy.txt" ); + verifier.verifyFilePresent("target/resources-resources.txt"); + verifier.verifyFilePresent("target/compiler-compile.txt"); + verifier.verifyFilePresent("target/resources-test-resources.txt"); + verifier.verifyFilePresent("target/compiler-test-compile.txt"); + verifier.verifyFilePresent("target/surefire-test.txt"); + verifier.verifyFilePresent("target/rar-rar.txt"); + verifier.verifyFilePresent("target/install-install.txt"); + verifier.verifyFilePresent("target/deploy-deploy.txt"); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0137EarLifecycleTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0137EarLifecycleTest.java index 1101adb924..422466f7ef 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0137EarLifecycleTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0137EarLifecycleTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenIT0137EarLifecycleTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenIT0137EarLifecycleTest extends AbstractMavenIntegrationTestCase { - public MavenIT0137EarLifecycleTest() - { - super( "[2.0.0,)" ); + public MavenIT0137EarLifecycleTest() { + super("[2.0.0,)"); } /** @@ -46,22 +41,19 @@ public class MavenIT0137EarLifecycleTest * @throws Exception in case of failure */ @Test - public void testit0137() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0137" ); + public void testit0137() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/it0137"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.deleteDirectory( "target" ); - verifier.setAutoclean( false ); - verifier.addCliArgument( "deploy" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.deleteDirectory("target"); + verifier.setAutoclean(false); + verifier.addCliArgument("deploy"); verifier.execute(); - verifier.verifyFilePresent( "target/ear-generate-application-xml.txt" ); - verifier.verifyFilePresent( "target/resources-resources.txt" ); - verifier.verifyFilePresent( "target/ear-ear.txt" ); - verifier.verifyFilePresent( "target/install-install.txt" ); - verifier.verifyFilePresent( "target/deploy-deploy.txt" ); + verifier.verifyFilePresent("target/ear-generate-application-xml.txt"); + verifier.verifyFilePresent("target/resources-resources.txt"); + verifier.verifyFilePresent("target/ear-ear.txt"); + verifier.verifyFilePresent("target/install-install.txt"); + verifier.verifyFilePresent("target/deploy-deploy.txt"); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0138PluginLifecycleTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0138PluginLifecycleTest.java index ccb40fa039..395e137cb9 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0138PluginLifecycleTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0138PluginLifecycleTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenIT0138PluginLifecycleTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenIT0138PluginLifecycleTest extends AbstractMavenIntegrationTestCase { - public MavenIT0138PluginLifecycleTest() - { - super( "[2.0.0,)" ); + public MavenIT0138PluginLifecycleTest() { + super("[2.0.0,)"); } /** @@ -46,31 +41,27 @@ public class MavenIT0138PluginLifecycleTest * @throws Exception in case of failure */ @Test - public void testit0138() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0138" ); + public void testit0138() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/it0138"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.deleteDirectory( "target" ); - verifier.setAutoclean( false ); - verifier.addCliArgument( "deploy" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.deleteDirectory("target"); + verifier.setAutoclean(false); + verifier.addCliArgument("deploy"); verifier.execute(); - verifier.verifyFilePresent( "target/plugin-descriptor.txt" ); - verifier.verifyFilePresent( "target/resources-resources.txt" ); - verifier.verifyFilePresent( "target/compiler-compile.txt" ); - verifier.verifyFilePresent( "target/resources-test-resources.txt" ); - verifier.verifyFilePresent( "target/compiler-test-compile.txt" ); - verifier.verifyFilePresent( "target/surefire-test.txt" ); - verifier.verifyFilePresent( "target/jar-jar.txt" ); - verifier.verifyFilePresent( "target/plugin-add-plugin-artifact-metadata.txt" ); - verifier.verifyFilePresent( "target/install-install.txt" ); - if ( matchesVersionRange( "(,2.2.0)" ) ) - { - verifier.verifyFilePresent( "target/plugin-update-registry.txt" ); + verifier.verifyFilePresent("target/plugin-descriptor.txt"); + verifier.verifyFilePresent("target/resources-resources.txt"); + verifier.verifyFilePresent("target/compiler-compile.txt"); + verifier.verifyFilePresent("target/resources-test-resources.txt"); + verifier.verifyFilePresent("target/compiler-test-compile.txt"); + verifier.verifyFilePresent("target/surefire-test.txt"); + verifier.verifyFilePresent("target/jar-jar.txt"); + verifier.verifyFilePresent("target/plugin-add-plugin-artifact-metadata.txt"); + verifier.verifyFilePresent("target/install-install.txt"); + if (matchesVersionRange("(,2.2.0)")) { + verifier.verifyFilePresent("target/plugin-update-registry.txt"); } - verifier.verifyFilePresent( "target/deploy-deploy.txt" ); + verifier.verifyFilePresent("target/deploy-deploy.txt"); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0139InterpolationWithProjectPrefixTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0139InterpolationWithProjectPrefixTest.java index 6288c6e826..5c82e4391f 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0139InterpolationWithProjectPrefixTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0139InterpolationWithProjectPrefixTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,12 +30,9 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenIT0139InterpolationWithProjectPrefixTest - extends AbstractMavenIntegrationTestCase -{ - public MavenIT0139InterpolationWithProjectPrefixTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenIT0139InterpolationWithProjectPrefixTest extends AbstractMavenIntegrationTestCase { + public MavenIT0139InterpolationWithProjectPrefixTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -46,54 +41,50 @@ public class MavenIT0139InterpolationWithProjectPrefixTest * @throws Exception in case of failure */ @Test - public void testit0139() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0139" ); - File child = new File( testDir, "child" ); + public void testit0139() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/it0139"); + File child = new File(testDir, "child"); - Verifier verifier = newVerifier( child.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "initialize" ); + Verifier verifier = newVerifier(child.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("initialize"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/interpolated.properties" ); + Properties props = verifier.loadProperties("target/interpolated.properties"); String prefix = "project.properties."; - assertEquals( child.getCanonicalFile(), new File( props.getProperty( prefix + "projectDir" ) ).getCanonicalFile() ); + assertEquals(child.getCanonicalFile(), new File(props.getProperty(prefix + "projectDir")).getCanonicalFile()); - assertEquals( "org.apache.maven.its.it0139.child", props.getProperty( prefix + "projectGroupId" ) ); - assertEquals( "child", props.getProperty( prefix + "projectArtifactId" ) ); - assertEquals( "2.0-alpha-1", props.getProperty( prefix + "projectVersion" ) ); - assertEquals( "jar", props.getProperty( prefix + "projectPackaging" ) ); + assertEquals("org.apache.maven.its.it0139.child", props.getProperty(prefix + "projectGroupId")); + assertEquals("child", props.getProperty(prefix + "projectArtifactId")); + assertEquals("2.0-alpha-1", props.getProperty(prefix + "projectVersion")); + assertEquals("jar", props.getProperty(prefix + "projectPackaging")); - assertEquals( "child-name", props.getProperty( prefix + "projectName" ) ); - assertEquals( "child-desc", props.getProperty( prefix + "projectDesc" ) ); - assertEquals( "http://child.org/", props.getProperty( prefix + "projectUrl" ) ); - assertEquals( "2008", props.getProperty( prefix + "projectYear" ) ); - assertEquals( "child-org-name", props.getProperty( prefix + "projectOrgName" ) ); + assertEquals("child-name", props.getProperty(prefix + "projectName")); + assertEquals("child-desc", props.getProperty(prefix + "projectDesc")); + assertEquals("http://child.org/", props.getProperty(prefix + "projectUrl")); + assertEquals("2008", props.getProperty(prefix + "projectYear")); + assertEquals("child-org-name", props.getProperty(prefix + "projectOrgName")); - assertEquals( "2.0.0", props.getProperty( prefix + "projectPrereqMvn" ) ); - assertEquals( "http://scm.org/", props.getProperty( prefix + "projectScmUrl" ) ); - assertEquals( "http://issue.org/", props.getProperty( prefix + "projectIssueUrl" ) ); - assertEquals( "http://ci.org/", props.getProperty( prefix + "projectCiUrl" ) ); - assertEquals( "child-dist-repo", props.getProperty( prefix + "projectDistRepoName" ) ); + assertEquals("2.0.0", props.getProperty(prefix + "projectPrereqMvn")); + assertEquals("http://scm.org/", props.getProperty(prefix + "projectScmUrl")); + assertEquals("http://issue.org/", props.getProperty(prefix + "projectIssueUrl")); + assertEquals("http://ci.org/", props.getProperty(prefix + "projectCiUrl")); + assertEquals("child-dist-repo", props.getProperty(prefix + "projectDistRepoName")); - assertEquals( "org.apache.maven.its.it0139", props.getProperty( prefix + "parentGroupId" ) ); - assertEquals( "parent", props.getProperty( prefix + "parentArtifactId" ) ); - assertEquals( "1.0", props.getProperty( prefix + "parentVersion" ) ); + assertEquals("org.apache.maven.its.it0139", props.getProperty(prefix + "parentGroupId")); + assertEquals("parent", props.getProperty(prefix + "parentArtifactId")); + assertEquals("1.0", props.getProperty(prefix + "parentVersion")); /* * NOTE: We intentionally do not check whether the build paths have been basedir aligned, that's another * story... */ - if ( matchesVersionRange( "(2.0.8,)" ) ) - { - assertTrue( props.getProperty( prefix + "projectBuildOut" ).endsWith( "bin" ) ); + if (matchesVersionRange("(2.0.8,)")) { + assertTrue(props.getProperty(prefix + "projectBuildOut").endsWith("bin")); } - assertTrue( props.getProperty( prefix + "projectSiteOut" ).endsWith( "doc" ) ); + assertTrue(props.getProperty(prefix + "projectSiteOut").endsWith("doc")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0140InterpolationWithPomPrefixTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0140InterpolationWithPomPrefixTest.java index 5fb7159eaf..a8d50e14bb 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0140InterpolationWithPomPrefixTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0140InterpolationWithPomPrefixTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -34,12 +32,9 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenIT0140InterpolationWithPomPrefixTest - extends AbstractMavenIntegrationTestCase -{ - public MavenIT0140InterpolationWithPomPrefixTest() - { - super( "[2.0,4.0.0-alpha-1)" ); +public class MavenIT0140InterpolationWithPomPrefixTest extends AbstractMavenIntegrationTestCase { + public MavenIT0140InterpolationWithPomPrefixTest() { + super("[2.0,4.0.0-alpha-1)"); } /** @@ -48,54 +43,50 @@ public class MavenIT0140InterpolationWithPomPrefixTest * @throws Exception in case of failure */ @Test - public void testit0140() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0140" ); - File child = new File( testDir, "child" ); + public void testit0140() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/it0140"); + File child = new File(testDir, "child"); - Verifier verifier = newVerifier( child.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "initialize" ); + Verifier verifier = newVerifier(child.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("initialize"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/interpolated.properties" ); + Properties props = verifier.loadProperties("target/interpolated.properties"); String prefix = "project.properties."; - assertEquals( child.getCanonicalFile(), new File( props.getProperty( prefix + "projectDir" ) ).getCanonicalFile() ); + assertEquals(child.getCanonicalFile(), new File(props.getProperty(prefix + "projectDir")).getCanonicalFile()); - assertEquals( "org.apache.maven.its.it0140.child", props.getProperty( prefix + "projectGroupId" ) ); - assertEquals( "child", props.getProperty( prefix + "projectArtifactId" ) ); - assertEquals( "2.0-alpha-1", props.getProperty( prefix + "projectVersion" ) ); - assertEquals( "jar", props.getProperty( prefix + "projectPackaging" ) ); + assertEquals("org.apache.maven.its.it0140.child", props.getProperty(prefix + "projectGroupId")); + assertEquals("child", props.getProperty(prefix + "projectArtifactId")); + assertEquals("2.0-alpha-1", props.getProperty(prefix + "projectVersion")); + assertEquals("jar", props.getProperty(prefix + "projectPackaging")); - assertEquals( "child-name", props.getProperty( prefix + "projectName" ) ); - assertEquals( "child-desc", props.getProperty( prefix + "projectDesc" ) ); - assertEquals( "http://child.org/", props.getProperty( prefix + "projectUrl" ) ); - assertEquals( "2008", props.getProperty( prefix + "projectYear" ) ); - assertEquals( "child-org-name", props.getProperty( prefix + "projectOrgName" ) ); + assertEquals("child-name", props.getProperty(prefix + "projectName")); + assertEquals("child-desc", props.getProperty(prefix + "projectDesc")); + assertEquals("http://child.org/", props.getProperty(prefix + "projectUrl")); + assertEquals("2008", props.getProperty(prefix + "projectYear")); + assertEquals("child-org-name", props.getProperty(prefix + "projectOrgName")); - assertEquals( "2.0.0", props.getProperty( prefix + "projectPrereqMvn" ) ); - assertEquals( "http://scm.org/", props.getProperty( prefix + "projectScmUrl" ) ); - assertEquals( "http://issue.org/", props.getProperty( prefix + "projectIssueUrl" ) ); - assertEquals( "http://ci.org/", props.getProperty( prefix + "projectCiUrl" ) ); - assertEquals( "child-dist-repo", props.getProperty( prefix + "projectDistRepoName" ) ); + assertEquals("2.0.0", props.getProperty(prefix + "projectPrereqMvn")); + assertEquals("http://scm.org/", props.getProperty(prefix + "projectScmUrl")); + assertEquals("http://issue.org/", props.getProperty(prefix + "projectIssueUrl")); + assertEquals("http://ci.org/", props.getProperty(prefix + "projectCiUrl")); + assertEquals("child-dist-repo", props.getProperty(prefix + "projectDistRepoName")); - assertEquals( "org.apache.maven.its.it0140", props.getProperty( prefix + "parentGroupId" ) ); - assertEquals( "parent", props.getProperty( prefix + "parentArtifactId" ) ); - assertEquals( "1.0", props.getProperty( prefix + "parentVersion" ) ); + assertEquals("org.apache.maven.its.it0140", props.getProperty(prefix + "parentGroupId")); + assertEquals("parent", props.getProperty(prefix + "parentArtifactId")); + assertEquals("1.0", props.getProperty(prefix + "parentVersion")); /* * NOTE: We intentionally do not check whether the build paths have been basedir aligned, that's another * story... */ - if ( matchesVersionRange( "(2.0.8,)" ) ) - { - assertTrue( props.getProperty( prefix + "projectBuildOut" ).endsWith( "bin" ) ); + if (matchesVersionRange("(2.0.8,)")) { + assertTrue(props.getProperty(prefix + "projectBuildOut").endsWith("bin")); } - assertTrue( props.getProperty( prefix + "projectSiteOut" ).endsWith( "doc" ) ); + assertTrue(props.getProperty(prefix + "projectSiteOut").endsWith("doc")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0142DirectDependencyScopesTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0142DirectDependencyScopesTest.java index 1be92ddeb8..fc2d56fdd0 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0142DirectDependencyScopesTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0142DirectDependencyScopesTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,17 +30,14 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenIT0142DirectDependencyScopesTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenIT0142DirectDependencyScopesTest extends AbstractMavenIntegrationTestCase { /* * NOTE: Class path ordering is another issue (MNG-1412), so we merely check set containment here. */ - public MavenIT0142DirectDependencyScopesTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenIT0142DirectDependencyScopesTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -51,68 +46,73 @@ public class MavenIT0142DirectDependencyScopesTest * @throws Exception in case of failure */ @Test - public void testit0142() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0142" ); + public void testit0142() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/it0142"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.it0142" ); - verifier.filterFile( "pom-template.xml", "pom.xml", "UTF-8" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.it0142"); + verifier.filterFile("pom-template.xml", "pom.xml", "UTF-8"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List compileArtifacts = verifier.loadLines( "target/compile-artifacts.txt", "UTF-8" ); - assertTrue( compileArtifacts.toString(), compileArtifacts.contains( "org.apache.maven.its.it0142:system:jar:0.1" ) ); - assertTrue( compileArtifacts.toString(), compileArtifacts.contains( "org.apache.maven.its.it0142:provided:jar:0.1" ) ); - assertTrue( compileArtifacts.toString(), compileArtifacts.contains( "org.apache.maven.its.it0142:compile:jar:0.1" ) ); - assertEquals( 3, compileArtifacts.size() ); + List compileArtifacts = verifier.loadLines("target/compile-artifacts.txt", "UTF-8"); + assertTrue( + compileArtifacts.toString(), compileArtifacts.contains("org.apache.maven.its.it0142:system:jar:0.1")); + assertTrue( + compileArtifacts.toString(), compileArtifacts.contains("org.apache.maven.its.it0142:provided:jar:0.1")); + assertTrue( + compileArtifacts.toString(), compileArtifacts.contains("org.apache.maven.its.it0142:compile:jar:0.1")); + assertEquals(3, compileArtifacts.size()); - List compileClassPath = verifier.loadLines( "target/compile-cp.txt", "UTF-8" ); - assertTrue( compileClassPath.toString(), compileClassPath.contains( "classes" ) ); - assertTrue( compileClassPath.toString(), compileClassPath.contains( "system-0.1.jar" ) ); - assertTrue( compileClassPath.toString(), compileClassPath.contains( "provided-0.1.jar" ) ); - assertTrue( compileClassPath.toString(), compileClassPath.contains( "compile-0.1.jar" ) ); - assertEquals( 4, compileClassPath.size() ); + List compileClassPath = verifier.loadLines("target/compile-cp.txt", "UTF-8"); + assertTrue(compileClassPath.toString(), compileClassPath.contains("classes")); + assertTrue(compileClassPath.toString(), compileClassPath.contains("system-0.1.jar")); + assertTrue(compileClassPath.toString(), compileClassPath.contains("provided-0.1.jar")); + assertTrue(compileClassPath.toString(), compileClassPath.contains("compile-0.1.jar")); + assertEquals(4, compileClassPath.size()); - List runtimeArtifacts = verifier.loadLines( "target/runtime-artifacts.txt", "UTF-8" ); - assertTrue( runtimeArtifacts.toString(), runtimeArtifacts.contains( "org.apache.maven.its.it0142:compile:jar:0.1" ) ); - assertTrue( runtimeArtifacts.toString(), runtimeArtifacts.contains( "org.apache.maven.its.it0142:runtime:jar:0.1" ) ); - assertTrue( runtimeArtifacts.toString(), runtimeArtifacts.contains( "org.apache.maven.its.it0142:runtime:jar:retro:0.1" ) ); - assertEquals( 3, runtimeArtifacts.size() ); + List runtimeArtifacts = verifier.loadLines("target/runtime-artifacts.txt", "UTF-8"); + assertTrue( + runtimeArtifacts.toString(), runtimeArtifacts.contains("org.apache.maven.its.it0142:compile:jar:0.1")); + assertTrue( + runtimeArtifacts.toString(), runtimeArtifacts.contains("org.apache.maven.its.it0142:runtime:jar:0.1")); + assertTrue( + runtimeArtifacts.toString(), + runtimeArtifacts.contains("org.apache.maven.its.it0142:runtime:jar:retro:0.1")); + assertEquals(3, runtimeArtifacts.size()); - List runtimeClassPath = verifier.loadLines( "target/runtime-cp.txt", "UTF-8" ); - assertTrue( runtimeClassPath.toString(), runtimeClassPath.contains( "classes" ) ); - assertTrue( runtimeClassPath.toString(), runtimeClassPath.contains( "compile-0.1.jar" ) ); - assertTrue( runtimeClassPath.toString(), runtimeClassPath.contains( "runtime-0.1.jar" ) ); - assertTrue( runtimeClassPath.toString(), runtimeClassPath.contains( "runtime-0.1-retro.jar" ) ); - assertEquals( 4, runtimeClassPath.size() ); + List runtimeClassPath = verifier.loadLines("target/runtime-cp.txt", "UTF-8"); + assertTrue(runtimeClassPath.toString(), runtimeClassPath.contains("classes")); + assertTrue(runtimeClassPath.toString(), runtimeClassPath.contains("compile-0.1.jar")); + assertTrue(runtimeClassPath.toString(), runtimeClassPath.contains("runtime-0.1.jar")); + assertTrue(runtimeClassPath.toString(), runtimeClassPath.contains("runtime-0.1-retro.jar")); + assertEquals(4, runtimeClassPath.size()); - List testArtifacts = verifier.loadLines( "target/test-artifacts.txt", "UTF-8" ); - assertTrue( testArtifacts.toString(), testArtifacts.contains( "org.apache.maven.its.it0142:system:jar:0.1" ) ); - assertTrue( testArtifacts.toString(), testArtifacts.contains( "org.apache.maven.its.it0142:provided:jar:0.1" ) ); - assertTrue( testArtifacts.toString(), testArtifacts.contains( "org.apache.maven.its.it0142:compile:jar:0.1" ) ); - assertTrue( testArtifacts.toString(), testArtifacts.contains( "org.apache.maven.its.it0142:runtime:jar:0.1" ) ); - assertTrue( testArtifacts.toString(), testArtifacts.contains( "org.apache.maven.its.it0142:runtime:jar:retro:0.1" ) ); - assertTrue( testArtifacts.toString(), testArtifacts.contains( "org.apache.maven.its.it0142:test:jar:0.1" ) ); - assertEquals( 6, testArtifacts.size() ); + List testArtifacts = verifier.loadLines("target/test-artifacts.txt", "UTF-8"); + assertTrue(testArtifacts.toString(), testArtifacts.contains("org.apache.maven.its.it0142:system:jar:0.1")); + assertTrue(testArtifacts.toString(), testArtifacts.contains("org.apache.maven.its.it0142:provided:jar:0.1")); + assertTrue(testArtifacts.toString(), testArtifacts.contains("org.apache.maven.its.it0142:compile:jar:0.1")); + assertTrue(testArtifacts.toString(), testArtifacts.contains("org.apache.maven.its.it0142:runtime:jar:0.1")); + assertTrue( + testArtifacts.toString(), testArtifacts.contains("org.apache.maven.its.it0142:runtime:jar:retro:0.1")); + assertTrue(testArtifacts.toString(), testArtifacts.contains("org.apache.maven.its.it0142:test:jar:0.1")); + assertEquals(6, testArtifacts.size()); - List testClassPath = verifier.loadLines( "target/test-cp.txt", "UTF-8" ); - assertTrue( testClassPath.toString(), testClassPath.contains( "classes" ) ); - assertTrue( testClassPath.toString(), testClassPath.contains( "test-classes" ) ); - assertTrue( testClassPath.toString(), testClassPath.contains( "system-0.1.jar" ) ); - assertTrue( testClassPath.toString(), testClassPath.contains( "provided-0.1.jar" ) ); - assertTrue( testClassPath.toString(), testClassPath.contains( "compile-0.1.jar" ) ); - assertTrue( testClassPath.toString(), testClassPath.contains( "runtime-0.1.jar" ) ); - assertTrue( testClassPath.toString(), testClassPath.contains( "runtime-0.1-retro.jar" ) ); - assertTrue( testClassPath.toString(), testClassPath.contains( "test-0.1.jar" ) ); - assertEquals( 8, testClassPath.size() ); + List testClassPath = verifier.loadLines("target/test-cp.txt", "UTF-8"); + assertTrue(testClassPath.toString(), testClassPath.contains("classes")); + assertTrue(testClassPath.toString(), testClassPath.contains("test-classes")); + assertTrue(testClassPath.toString(), testClassPath.contains("system-0.1.jar")); + assertTrue(testClassPath.toString(), testClassPath.contains("provided-0.1.jar")); + assertTrue(testClassPath.toString(), testClassPath.contains("compile-0.1.jar")); + assertTrue(testClassPath.toString(), testClassPath.contains("runtime-0.1.jar")); + assertTrue(testClassPath.toString(), testClassPath.contains("runtime-0.1-retro.jar")); + assertTrue(testClassPath.toString(), testClassPath.contains("test-0.1.jar")); + assertEquals(8, testClassPath.size()); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0143TransitiveDependencyScopesTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0143TransitiveDependencyScopesTest.java index 9c5fb65113..7b1aebc2ca 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0143TransitiveDependencyScopesTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0143TransitiveDependencyScopesTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; import java.util.Map; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,17 +31,14 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenIT0143TransitiveDependencyScopesTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenIT0143TransitiveDependencyScopesTest extends AbstractMavenIntegrationTestCase { /* * NOTE: Class path ordering is another issue (MNG-1412), so we merely check set containment here. */ - public MavenIT0143TransitiveDependencyScopesTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenIT0143TransitiveDependencyScopesTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -53,10 +48,8 @@ public class MavenIT0143TransitiveDependencyScopesTest * @throws Exception in case of failure */ @Test - public void testitCompileScope() - throws Exception - { - Verifier verifier = run( "compile" ); + public void testitCompileScope() throws Exception { + Verifier verifier = run("compile"); String targetDir = "target-compile"; /* @@ -64,43 +57,48 @@ public class MavenIT0143TransitiveDependencyScopesTest * dependency that extends a class from the transitive dependency, i.e. * project imports A from direct dependency and A extends B from transitive dependency. */ - List compileArtifacts = verifier.loadLines( targetDir + "/compile-artifacts.txt", "UTF-8" ); - assertTrue( compileArtifacts.toString(), compileArtifacts.contains( "org.apache.maven.its.it0143:direct:jar:0.1" ) ); - assertTrue( compileArtifacts.toString(), compileArtifacts.contains( "org.apache.maven.its.it0143:compile:jar:0.1" ) ); - assertEquals( 2, compileArtifacts.size() ); + List compileArtifacts = verifier.loadLines(targetDir + "/compile-artifacts.txt", "UTF-8"); + assertTrue( + compileArtifacts.toString(), compileArtifacts.contains("org.apache.maven.its.it0143:direct:jar:0.1")); + assertTrue( + compileArtifacts.toString(), compileArtifacts.contains("org.apache.maven.its.it0143:compile:jar:0.1")); + assertEquals(2, compileArtifacts.size()); - List compileClassPath = verifier.loadLines( targetDir + "/compile-cp.txt", "UTF-8" ); - assertTrue( compileClassPath.toString(), compileClassPath.contains( "classes" ) ); - assertTrue( compileClassPath.toString(), compileClassPath.contains( "direct-0.1.jar" ) ); - assertTrue( compileClassPath.toString(), compileClassPath.contains( "compile-0.1.jar" ) ); - assertEquals( 3, compileClassPath.size() ); + List compileClassPath = verifier.loadLines(targetDir + "/compile-cp.txt", "UTF-8"); + assertTrue(compileClassPath.toString(), compileClassPath.contains("classes")); + assertTrue(compileClassPath.toString(), compileClassPath.contains("direct-0.1.jar")); + assertTrue(compileClassPath.toString(), compileClassPath.contains("compile-0.1.jar")); + assertEquals(3, compileClassPath.size()); - List runtimeArtifacts = verifier.loadLines( targetDir + "/runtime-artifacts.txt", "UTF-8" ); - assertTrue( runtimeArtifacts.toString(), runtimeArtifacts.contains( "org.apache.maven.its.it0143:direct:jar:0.1" ) ); - assertTrue( runtimeArtifacts.toString(), runtimeArtifacts.contains( "org.apache.maven.its.it0143:compile:jar:0.1" ) ); - assertTrue( runtimeArtifacts.toString(), runtimeArtifacts.contains( "org.apache.maven.its.it0143:runtime:jar:0.1" ) ); - assertEquals( 3, runtimeArtifacts.size() ); + List runtimeArtifacts = verifier.loadLines(targetDir + "/runtime-artifacts.txt", "UTF-8"); + assertTrue( + runtimeArtifacts.toString(), runtimeArtifacts.contains("org.apache.maven.its.it0143:direct:jar:0.1")); + assertTrue( + runtimeArtifacts.toString(), runtimeArtifacts.contains("org.apache.maven.its.it0143:compile:jar:0.1")); + assertTrue( + runtimeArtifacts.toString(), runtimeArtifacts.contains("org.apache.maven.its.it0143:runtime:jar:0.1")); + assertEquals(3, runtimeArtifacts.size()); - List runtimeClassPath = verifier.loadLines( targetDir + "/runtime-cp.txt", "UTF-8" ); - assertTrue( runtimeClassPath.toString(), runtimeClassPath.contains( "classes" ) ); - assertTrue( runtimeClassPath.toString(), runtimeClassPath.contains( "direct-0.1.jar" ) ); - assertTrue( runtimeClassPath.toString(), runtimeClassPath.contains( "compile-0.1.jar" ) ); - assertTrue( runtimeClassPath.toString(), runtimeClassPath.contains( "runtime-0.1.jar" ) ); - assertEquals( 4, runtimeClassPath.size() ); + List runtimeClassPath = verifier.loadLines(targetDir + "/runtime-cp.txt", "UTF-8"); + assertTrue(runtimeClassPath.toString(), runtimeClassPath.contains("classes")); + assertTrue(runtimeClassPath.toString(), runtimeClassPath.contains("direct-0.1.jar")); + assertTrue(runtimeClassPath.toString(), runtimeClassPath.contains("compile-0.1.jar")); + assertTrue(runtimeClassPath.toString(), runtimeClassPath.contains("runtime-0.1.jar")); + assertEquals(4, runtimeClassPath.size()); - List testArtifacts = verifier.loadLines( targetDir + "/test-artifacts.txt", "UTF-8" ); - assertTrue( testArtifacts.toString(), testArtifacts.contains( "org.apache.maven.its.it0143:direct:jar:0.1" ) ); - assertTrue( testArtifacts.toString(), testArtifacts.contains( "org.apache.maven.its.it0143:compile:jar:0.1" ) ); - assertTrue( testArtifacts.toString(), testArtifacts.contains( "org.apache.maven.its.it0143:runtime:jar:0.1" ) ); - assertEquals( 3, testArtifacts.size() ); + List testArtifacts = verifier.loadLines(targetDir + "/test-artifacts.txt", "UTF-8"); + assertTrue(testArtifacts.toString(), testArtifacts.contains("org.apache.maven.its.it0143:direct:jar:0.1")); + assertTrue(testArtifacts.toString(), testArtifacts.contains("org.apache.maven.its.it0143:compile:jar:0.1")); + assertTrue(testArtifacts.toString(), testArtifacts.contains("org.apache.maven.its.it0143:runtime:jar:0.1")); + assertEquals(3, testArtifacts.size()); - List testClassPath = verifier.loadLines( targetDir + "/test-cp.txt", "UTF-8" ); - assertTrue( testClassPath.toString(), testClassPath.contains( "classes" ) ); - assertTrue( testClassPath.toString(), testClassPath.contains( "test-classes" ) ); - assertTrue( testClassPath.toString(), testClassPath.contains( "direct-0.1.jar" ) ); - assertTrue( testClassPath.toString(), testClassPath.contains( "compile-0.1.jar" ) ); - assertTrue( testClassPath.toString(), testClassPath.contains( "runtime-0.1.jar" ) ); - assertEquals( 5, testClassPath.size() ); + List testClassPath = verifier.loadLines(targetDir + "/test-cp.txt", "UTF-8"); + assertTrue(testClassPath.toString(), testClassPath.contains("classes")); + assertTrue(testClassPath.toString(), testClassPath.contains("test-classes")); + assertTrue(testClassPath.toString(), testClassPath.contains("direct-0.1.jar")); + assertTrue(testClassPath.toString(), testClassPath.contains("compile-0.1.jar")); + assertTrue(testClassPath.toString(), testClassPath.contains("runtime-0.1.jar")); + assertEquals(5, testClassPath.size()); } /** @@ -110,45 +108,46 @@ public class MavenIT0143TransitiveDependencyScopesTest * @throws Exception in case of failure */ @Test - public void testitProvidedScope() - throws Exception - { - Verifier verifier = run( "provided" ); + public void testitProvidedScope() throws Exception { + Verifier verifier = run("provided"); String targetDir = "target-provided"; - List compileArtifacts = verifier.loadLines( targetDir + "/compile-artifacts.txt", "UTF-8" ); - assertTrue( compileArtifacts.toString(), compileArtifacts.contains( "org.apache.maven.its.it0143:direct:jar:0.1" ) ); - assertTrue( compileArtifacts.toString(), compileArtifacts.contains( "org.apache.maven.its.it0143:compile:jar:0.1" ) ); - assertTrue( compileArtifacts.toString(), compileArtifacts.contains( "org.apache.maven.its.it0143:runtime:jar:0.1" ) ); - assertEquals( 3, compileArtifacts.size() ); + List compileArtifacts = verifier.loadLines(targetDir + "/compile-artifacts.txt", "UTF-8"); + assertTrue( + compileArtifacts.toString(), compileArtifacts.contains("org.apache.maven.its.it0143:direct:jar:0.1")); + assertTrue( + compileArtifacts.toString(), compileArtifacts.contains("org.apache.maven.its.it0143:compile:jar:0.1")); + assertTrue( + compileArtifacts.toString(), compileArtifacts.contains("org.apache.maven.its.it0143:runtime:jar:0.1")); + assertEquals(3, compileArtifacts.size()); - List compileClassPath = verifier.loadLines( targetDir + "/compile-cp.txt", "UTF-8" ); - assertTrue( compileClassPath.toString(), compileClassPath.contains( "classes" ) ); - assertTrue( compileClassPath.toString(), compileClassPath.contains( "direct-0.1.jar" ) ); - assertTrue( compileClassPath.toString(), compileClassPath.contains( "compile-0.1.jar" ) ); - assertTrue( compileClassPath.toString(), compileClassPath.contains( "runtime-0.1.jar" ) ); - assertEquals( 4, compileClassPath.size() ); + List compileClassPath = verifier.loadLines(targetDir + "/compile-cp.txt", "UTF-8"); + assertTrue(compileClassPath.toString(), compileClassPath.contains("classes")); + assertTrue(compileClassPath.toString(), compileClassPath.contains("direct-0.1.jar")); + assertTrue(compileClassPath.toString(), compileClassPath.contains("compile-0.1.jar")); + assertTrue(compileClassPath.toString(), compileClassPath.contains("runtime-0.1.jar")); + assertEquals(4, compileClassPath.size()); - List runtimeArtifacts = verifier.loadLines( targetDir + "/runtime-artifacts.txt", "UTF-8" ); - assertEquals( 0, runtimeArtifacts.size() ); + List runtimeArtifacts = verifier.loadLines(targetDir + "/runtime-artifacts.txt", "UTF-8"); + assertEquals(0, runtimeArtifacts.size()); - List runtimeClassPath = verifier.loadLines( targetDir + "/runtime-cp.txt", "UTF-8" ); - assertTrue( runtimeClassPath.toString(), runtimeClassPath.contains( "classes" ) ); - assertEquals( 1, runtimeClassPath.size() ); + List runtimeClassPath = verifier.loadLines(targetDir + "/runtime-cp.txt", "UTF-8"); + assertTrue(runtimeClassPath.toString(), runtimeClassPath.contains("classes")); + assertEquals(1, runtimeClassPath.size()); - List testArtifacts = verifier.loadLines( targetDir + "/test-artifacts.txt", "UTF-8" ); - assertTrue( testArtifacts.toString(), testArtifacts.contains( "org.apache.maven.its.it0143:direct:jar:0.1" ) ); - assertTrue( testArtifacts.toString(), testArtifacts.contains( "org.apache.maven.its.it0143:compile:jar:0.1" ) ); - assertTrue( testArtifacts.toString(), testArtifacts.contains( "org.apache.maven.its.it0143:runtime:jar:0.1" ) ); - assertEquals( 3, testArtifacts.size() ); + List testArtifacts = verifier.loadLines(targetDir + "/test-artifacts.txt", "UTF-8"); + assertTrue(testArtifacts.toString(), testArtifacts.contains("org.apache.maven.its.it0143:direct:jar:0.1")); + assertTrue(testArtifacts.toString(), testArtifacts.contains("org.apache.maven.its.it0143:compile:jar:0.1")); + assertTrue(testArtifacts.toString(), testArtifacts.contains("org.apache.maven.its.it0143:runtime:jar:0.1")); + assertEquals(3, testArtifacts.size()); - List testClassPath = verifier.loadLines( targetDir + "/test-cp.txt", "UTF-8" ); - assertTrue( testClassPath.toString(), testClassPath.contains( "classes" ) ); - assertTrue( testClassPath.toString(), testClassPath.contains( "test-classes" ) ); - assertTrue( testClassPath.toString(), testClassPath.contains( "direct-0.1.jar" ) ); - assertTrue( testClassPath.toString(), testClassPath.contains( "compile-0.1.jar" ) ); - assertTrue( testClassPath.toString(), testClassPath.contains( "runtime-0.1.jar" ) ); - assertEquals( 5, testClassPath.size() ); + List testClassPath = verifier.loadLines(targetDir + "/test-cp.txt", "UTF-8"); + assertTrue(testClassPath.toString(), testClassPath.contains("classes")); + assertTrue(testClassPath.toString(), testClassPath.contains("test-classes")); + assertTrue(testClassPath.toString(), testClassPath.contains("direct-0.1.jar")); + assertTrue(testClassPath.toString(), testClassPath.contains("compile-0.1.jar")); + assertTrue(testClassPath.toString(), testClassPath.contains("runtime-0.1.jar")); + assertEquals(5, testClassPath.size()); } /** @@ -158,45 +157,46 @@ public class MavenIT0143TransitiveDependencyScopesTest * @throws Exception in case of failure */ @Test - public void testitRuntimeScope() - throws Exception - { - Verifier verifier = run( "runtime" ); + public void testitRuntimeScope() throws Exception { + Verifier verifier = run("runtime"); String targetDir = "target-runtime"; - List compileArtifacts = verifier.loadLines( targetDir + "/compile-artifacts.txt", "UTF-8" ); - assertEquals( 0, compileArtifacts.size() ); + List compileArtifacts = verifier.loadLines(targetDir + "/compile-artifacts.txt", "UTF-8"); + assertEquals(0, compileArtifacts.size()); - List compileClassPath = verifier.loadLines( targetDir + "/compile-cp.txt", "UTF-8" ); - assertTrue( compileClassPath.toString(), compileClassPath.contains( "classes" ) ); - assertEquals( 1, compileClassPath.size() ); + List compileClassPath = verifier.loadLines(targetDir + "/compile-cp.txt", "UTF-8"); + assertTrue(compileClassPath.toString(), compileClassPath.contains("classes")); + assertEquals(1, compileClassPath.size()); - List runtimeArtifacts = verifier.loadLines( targetDir + "/runtime-artifacts.txt", "UTF-8" ); - assertTrue( runtimeArtifacts.toString(), runtimeArtifacts.contains( "org.apache.maven.its.it0143:direct:jar:0.1" ) ); - assertTrue( runtimeArtifacts.toString(), runtimeArtifacts.contains( "org.apache.maven.its.it0143:compile:jar:0.1" ) ); - assertTrue( runtimeArtifacts.toString(), runtimeArtifacts.contains( "org.apache.maven.its.it0143:runtime:jar:0.1" ) ); - assertEquals( 3, runtimeArtifacts.size() ); + List runtimeArtifacts = verifier.loadLines(targetDir + "/runtime-artifacts.txt", "UTF-8"); + assertTrue( + runtimeArtifacts.toString(), runtimeArtifacts.contains("org.apache.maven.its.it0143:direct:jar:0.1")); + assertTrue( + runtimeArtifacts.toString(), runtimeArtifacts.contains("org.apache.maven.its.it0143:compile:jar:0.1")); + assertTrue( + runtimeArtifacts.toString(), runtimeArtifacts.contains("org.apache.maven.its.it0143:runtime:jar:0.1")); + assertEquals(3, runtimeArtifacts.size()); - List runtimeClassPath = verifier.loadLines( targetDir + "/runtime-cp.txt", "UTF-8" ); - assertTrue( runtimeClassPath.toString(), runtimeClassPath.contains( "classes" ) ); - assertTrue( runtimeClassPath.toString(), runtimeClassPath.contains( "direct-0.1.jar" ) ); - assertTrue( runtimeClassPath.toString(), runtimeClassPath.contains( "compile-0.1.jar" ) ); - assertTrue( runtimeClassPath.toString(), runtimeClassPath.contains( "runtime-0.1.jar" ) ); - assertEquals( 4, runtimeClassPath.size() ); + List runtimeClassPath = verifier.loadLines(targetDir + "/runtime-cp.txt", "UTF-8"); + assertTrue(runtimeClassPath.toString(), runtimeClassPath.contains("classes")); + assertTrue(runtimeClassPath.toString(), runtimeClassPath.contains("direct-0.1.jar")); + assertTrue(runtimeClassPath.toString(), runtimeClassPath.contains("compile-0.1.jar")); + assertTrue(runtimeClassPath.toString(), runtimeClassPath.contains("runtime-0.1.jar")); + assertEquals(4, runtimeClassPath.size()); - List testArtifacts = verifier.loadLines( targetDir + "/test-artifacts.txt", "UTF-8" ); - assertTrue( testArtifacts.toString(), testArtifacts.contains( "org.apache.maven.its.it0143:direct:jar:0.1" ) ); - assertTrue( testArtifacts.toString(), testArtifacts.contains( "org.apache.maven.its.it0143:compile:jar:0.1" ) ); - assertTrue( testArtifacts.toString(), testArtifacts.contains( "org.apache.maven.its.it0143:runtime:jar:0.1" ) ); - assertEquals( 3, testArtifacts.size() ); + List testArtifacts = verifier.loadLines(targetDir + "/test-artifacts.txt", "UTF-8"); + assertTrue(testArtifacts.toString(), testArtifacts.contains("org.apache.maven.its.it0143:direct:jar:0.1")); + assertTrue(testArtifacts.toString(), testArtifacts.contains("org.apache.maven.its.it0143:compile:jar:0.1")); + assertTrue(testArtifacts.toString(), testArtifacts.contains("org.apache.maven.its.it0143:runtime:jar:0.1")); + assertEquals(3, testArtifacts.size()); - List testClassPath = verifier.loadLines( targetDir + "/test-cp.txt", "UTF-8" ); - assertTrue( testClassPath.toString(), testClassPath.contains( "classes" ) ); - assertTrue( testClassPath.toString(), testClassPath.contains( "test-classes" ) ); - assertTrue( testClassPath.toString(), testClassPath.contains( "direct-0.1.jar" ) ); - assertTrue( testClassPath.toString(), testClassPath.contains( "compile-0.1.jar" ) ); - assertTrue( testClassPath.toString(), testClassPath.contains( "runtime-0.1.jar" ) ); - assertEquals( 5, testClassPath.size() ); + List testClassPath = verifier.loadLines(targetDir + "/test-cp.txt", "UTF-8"); + assertTrue(testClassPath.toString(), testClassPath.contains("classes")); + assertTrue(testClassPath.toString(), testClassPath.contains("test-classes")); + assertTrue(testClassPath.toString(), testClassPath.contains("direct-0.1.jar")); + assertTrue(testClassPath.toString(), testClassPath.contains("compile-0.1.jar")); + assertTrue(testClassPath.toString(), testClassPath.contains("runtime-0.1.jar")); + assertEquals(5, testClassPath.size()); } /** @@ -206,62 +206,57 @@ public class MavenIT0143TransitiveDependencyScopesTest * @throws Exception in case of failure */ @Test - public void testitTestScope() - throws Exception - { - Verifier verifier = run( "test" ); + public void testitTestScope() throws Exception { + Verifier verifier = run("test"); String targetDir = "target-test"; - List compileArtifacts = verifier.loadLines( targetDir + "/compile-artifacts.txt", "UTF-8" ); - assertEquals( 0, compileArtifacts.size() ); + List compileArtifacts = verifier.loadLines(targetDir + "/compile-artifacts.txt", "UTF-8"); + assertEquals(0, compileArtifacts.size()); - List compileClassPath = verifier.loadLines( targetDir + "/compile-cp.txt", "UTF-8" ); - assertTrue( compileClassPath.toString(), compileClassPath.contains( "classes" ) ); - assertEquals( 1, compileClassPath.size() ); + List compileClassPath = verifier.loadLines(targetDir + "/compile-cp.txt", "UTF-8"); + assertTrue(compileClassPath.toString(), compileClassPath.contains("classes")); + assertEquals(1, compileClassPath.size()); - List runtimeArtifacts = verifier.loadLines( targetDir + "/runtime-artifacts.txt", "UTF-8" ); - assertEquals( 0, runtimeArtifacts.size() ); + List runtimeArtifacts = verifier.loadLines(targetDir + "/runtime-artifacts.txt", "UTF-8"); + assertEquals(0, runtimeArtifacts.size()); - List runtimeClassPath = verifier.loadLines( targetDir + "/runtime-cp.txt", "UTF-8" ); - assertTrue( runtimeClassPath.toString(), runtimeClassPath.contains( "classes" ) ); - assertEquals( 1, runtimeClassPath.size() ); + List runtimeClassPath = verifier.loadLines(targetDir + "/runtime-cp.txt", "UTF-8"); + assertTrue(runtimeClassPath.toString(), runtimeClassPath.contains("classes")); + assertEquals(1, runtimeClassPath.size()); - List testArtifacts = verifier.loadLines( targetDir + "/test-artifacts.txt", "UTF-8" ); - assertTrue( testArtifacts.toString(), testArtifacts.contains( "org.apache.maven.its.it0143:direct:jar:0.1" ) ); - assertTrue( testArtifacts.toString(), testArtifacts.contains( "org.apache.maven.its.it0143:compile:jar:0.1" ) ); - assertTrue( testArtifacts.toString(), testArtifacts.contains( "org.apache.maven.its.it0143:runtime:jar:0.1" ) ); - assertEquals( 3, testArtifacts.size() ); + List testArtifacts = verifier.loadLines(targetDir + "/test-artifacts.txt", "UTF-8"); + assertTrue(testArtifacts.toString(), testArtifacts.contains("org.apache.maven.its.it0143:direct:jar:0.1")); + assertTrue(testArtifacts.toString(), testArtifacts.contains("org.apache.maven.its.it0143:compile:jar:0.1")); + assertTrue(testArtifacts.toString(), testArtifacts.contains("org.apache.maven.its.it0143:runtime:jar:0.1")); + assertEquals(3, testArtifacts.size()); - List testClassPath = verifier.loadLines( targetDir + "/test-cp.txt", "UTF-8" ); - assertTrue( testClassPath.toString(), testClassPath.contains( "classes" ) ); - assertTrue( testClassPath.toString(), testClassPath.contains( "test-classes" ) ); - assertTrue( testClassPath.toString(), testClassPath.contains( "direct-0.1.jar" ) ); - assertTrue( testClassPath.toString(), testClassPath.contains( "compile-0.1.jar" ) ); - assertTrue( testClassPath.toString(), testClassPath.contains( "runtime-0.1.jar" ) ); - assertEquals( 5, testClassPath.size() ); + List testClassPath = verifier.loadLines(targetDir + "/test-cp.txt", "UTF-8"); + assertTrue(testClassPath.toString(), testClassPath.contains("classes")); + assertTrue(testClassPath.toString(), testClassPath.contains("test-classes")); + assertTrue(testClassPath.toString(), testClassPath.contains("direct-0.1.jar")); + assertTrue(testClassPath.toString(), testClassPath.contains("compile-0.1.jar")); + assertTrue(testClassPath.toString(), testClassPath.contains("runtime-0.1.jar")); + assertEquals(5, testClassPath.size()); } - private Verifier run( String scope ) - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0143" ); + private Verifier run(String scope) throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/it0143"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target-" + scope ); - verifier.deleteArtifacts( "org.apache.maven.its.it0143" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target-" + scope); + verifier.deleteArtifacts("org.apache.maven.its.it0143"); Map filterProps = verifier.newDefaultFilterMap(); - filterProps.put( "@scope@", scope ); - verifier.filterFile( "pom-template.xml", "pom.xml", "UTF-8", filterProps ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.setLogFileName( "log-" + scope + ".txt" ); - verifier.addCliArgument( "validate" ); + filterProps.put("@scope@", scope); + verifier.filterFile("pom-template.xml", "pom.xml", "UTF-8", filterProps); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8", filterProps); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.setLogFileName("log-" + scope + ".txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); return verifier; } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0144LifecycleExecutionOrderTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0144LifecycleExecutionOrderTest.java index 1c10e2c504..340f45ae67 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0144LifecycleExecutionOrderTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0144LifecycleExecutionOrderTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,28 +16,24 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** * @author Benjamin Bentmann * */ -public class MavenIT0144LifecycleExecutionOrderTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenIT0144LifecycleExecutionOrderTest extends AbstractMavenIntegrationTestCase { - public MavenIT0144LifecycleExecutionOrderTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenIT0144LifecycleExecutionOrderTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -48,69 +42,62 @@ public class MavenIT0144LifecycleExecutionOrderTest * @throws Exception in case of failure */ @Test - public void testit0144() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0144" ); + public void testit0144() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/it0144"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.deleteDirectory( "target" ); - verifier.setAutoclean( false ); - verifier.addCliArguments( "post-clean", "deploy", "site-deploy" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.deleteDirectory("target"); + verifier.setAutoclean(false); + verifier.addCliArguments("post-clean", "deploy", "site-deploy"); verifier.execute(); verifier.verifyErrorFreeLog(); List expected = new ArrayList<>(); - expected.add( "pre-clean" ); - expected.add( "clean" ); - expected.add( "post-clean" ); + expected.add("pre-clean"); + expected.add("clean"); + expected.add("post-clean"); - expected.add( "validate" ); - expected.add( "initialize" ); - expected.add( "generate-sources" ); - expected.add( "process-sources" ); - expected.add( "generate-resources" ); - expected.add( "process-resources" ); - expected.add( "compile" ); - expected.add( "process-classes" ); - expected.add( "generate-test-sources" ); - expected.add( "process-test-sources" ); - expected.add( "generate-test-resources" ); - expected.add( "process-test-resources" ); - expected.add( "test-compile" ); - if ( matchesVersionRange( "(2.0.4,)" ) ) - { + expected.add("validate"); + expected.add("initialize"); + expected.add("generate-sources"); + expected.add("process-sources"); + expected.add("generate-resources"); + expected.add("process-resources"); + expected.add("compile"); + expected.add("process-classes"); + expected.add("generate-test-sources"); + expected.add("process-test-sources"); + expected.add("generate-test-resources"); + expected.add("process-test-resources"); + expected.add("test-compile"); + if (matchesVersionRange("(2.0.4,)")) { // MNG-1508 - expected.add( "process-test-classes" ); + expected.add("process-test-classes"); } - expected.add( "test" ); - if ( matchesVersionRange( "(2.1.0-M1,)" ) ) - { + expected.add("test"); + if (matchesVersionRange("(2.1.0-M1,)")) { // MNG-2097 - expected.add( "prepare-package" ); + expected.add("prepare-package"); } - expected.add( "package" ); - if ( matchesVersionRange( "(2.0.1,)" ) ) - { - expected.add( "pre-integration-test" ); + expected.add("package"); + if (matchesVersionRange("(2.0.1,)")) { + expected.add("pre-integration-test"); } - expected.add( "integration-test" ); - if ( matchesVersionRange( "(2.0.1,)" ) ) - { - expected.add( "post-integration-test" ); + expected.add("integration-test"); + if (matchesVersionRange("(2.0.1,)")) { + expected.add("post-integration-test"); } - expected.add( "verify" ); - expected.add( "install" ); - expected.add( "deploy" ); + expected.add("verify"); + expected.add("install"); + expected.add("deploy"); - expected.add( "pre-site" ); - expected.add( "site" ); - expected.add( "post-site" ); - expected.add( "site-deploy" ); + expected.add("pre-site"); + expected.add("site"); + expected.add("post-site"); + expected.add("site-deploy"); - List phases = verifier.loadLines( "target/phases.log", "UTF-8" ); - assertEquals( expected, phases ); + List phases = verifier.loadLines("target/phases.log", "UTF-8"); + assertEquals(expected, phases); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0146InstallerSnapshotNaming.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0146InstallerSnapshotNaming.java index cee4dc0241..26b97beb05 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0146InstallerSnapshotNaming.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0146InstallerSnapshotNaming.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,15 +16,15 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.io.IOException; import java.net.InetAddress; import java.util.Map; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.eclipse.jetty.server.Handler; import org.eclipse.jetty.server.NetworkConnector; import org.eclipse.jetty.server.Server; @@ -37,119 +35,102 @@ import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -public class MavenIT0146InstallerSnapshotNaming - extends AbstractMavenIntegrationTestCase -{ +public class MavenIT0146InstallerSnapshotNaming extends AbstractMavenIntegrationTestCase { private Server server; private int port; private final File testDir; - public MavenIT0146InstallerSnapshotNaming() - throws IOException - { - super( "(2.0.2,)" ); - testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0146" ); + public MavenIT0146InstallerSnapshotNaming() throws IOException { + super("(2.0.2,)"); + testDir = ResourceExtractor.simpleExtractResources(getClass(), "/it0146"); } @BeforeEach - protected void setUp() - throws Exception - { + protected void setUp() throws Exception { ResourceHandler resourceHandler = new ResourceHandler(); - resourceHandler.setResourceBase( new File( testDir, "repo" ).getAbsolutePath() ); + resourceHandler.setResourceBase(new File(testDir, "repo").getAbsolutePath()); HandlerList handlers = new HandlerList(); - handlers.setHandlers( new Handler[]{ resourceHandler, new DefaultHandler() } ); + handlers.setHandlers(new Handler[] {resourceHandler, new DefaultHandler()}); - server = new Server( 0 ); - server.setHandler( handlers ); + server = new Server(0); + server.setHandler(handlers); server.start(); - if ( server.isFailed() ) - { - fail( "Couldn't bind the server socket to a free port!" ); + if (server.isFailed()) { + fail("Couldn't bind the server socket to a free port!"); } - port = ( (NetworkConnector) server.getConnectors()[0] ).getLocalPort(); - System.out.println( "Bound server socket to the port " + port ); + port = ((NetworkConnector) server.getConnectors()[0]).getLocalPort(); + System.out.println("Bound server socket to the port " + port); } - @AfterEach - protected void tearDown() - throws Exception - { - if ( server != null ) - { + protected void tearDown() throws Exception { + if (server != null) { server.stop(); server.join(); } } @Test - public void testitRemoteDownloadTimestampedName() - throws Exception - { - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); + public void testitRemoteDownloadTimestampedName() throws Exception { + Verifier verifier = newVerifier(testDir.getAbsolutePath()); Map properties = verifier.newDefaultFilterMap(); - properties.put( "@host@", InetAddress.getLoopbackAddress().getCanonicalHostName() ); - properties.put( "@port@", Integer.toString( port ) ); + properties.put("@host@", InetAddress.getLoopbackAddress().getCanonicalHostName()); + properties.put("@port@", Integer.toString(port)); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", properties ); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8", properties); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); - verifier.deleteArtifacts( "org.apache.maven.its.it0146" ); + verifier.deleteArtifacts("org.apache.maven.its.it0146"); - verifier.addCliArgument( "-X" ); + verifier.addCliArgument("-X"); - verifier.deleteDirectory( "target" ); + verifier.deleteDirectory("target"); - verifier.addCliArgument( "validate" ); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/appassembler/repo/dep-0.1-20110726.105319-1.jar" ); + verifier.verifyFilePresent("target/appassembler/repo/dep-0.1-20110726.105319-1.jar"); } - @Test - public void testitNonTimestampedNameWithInstalledSNAPSHOT() - throws Exception - { - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.deleteArtifacts( "org.apache.maven.its.it0146" ); - verifier.addCliArgument( "-f" ); - verifier.addCliArgument( "project/pom.xml" ); - verifier.deleteDirectory( "project/target" ); - verifier.setLogFileName( "log2.txt" ); + public void testitNonTimestampedNameWithInstalledSNAPSHOT() throws Exception { + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.deleteArtifacts("org.apache.maven.its.it0146"); + verifier.addCliArgument("-f"); + verifier.addCliArgument("project/pom.xml"); + verifier.deleteDirectory("project/target"); + verifier.setLogFileName("log2.txt"); - verifier.addCliArgument( "install" ); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier = newVerifier( testDir.getAbsolutePath() ); + verifier = newVerifier(testDir.getAbsolutePath()); Map properties = verifier.newDefaultFilterMap(); - properties.put( "@host@", InetAddress.getLoopbackAddress().getCanonicalHostName() ); - properties.put( "@port@", Integer.toString( port ) ); + properties.put("@host@", InetAddress.getLoopbackAddress().getCanonicalHostName()); + properties.put("@port@", Integer.toString(port)); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", properties ); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8", properties); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.setLogFileName( "log3.txt" ); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.setLogFileName("log3.txt"); + verifier.addCliArgument("-X"); - verifier.addCliArgument( "-X" ); + verifier.deleteDirectory("target"); - verifier.deleteDirectory( "target" ); - - verifier.addCliArgument( "validate" ); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/appassembler/repo/dep-0.1-SNAPSHOT.jar" ); + verifier.verifyFilePresent("target/appassembler/repo/dep-0.1-SNAPSHOT.jar"); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0199CyclicImportScopeTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0199CyclicImportScopeTest.java index 2ce7a7ce96..6021b676f1 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0199CyclicImportScopeTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0199CyclicImportScopeTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; public class MavenIT0199CyclicImportScopeTest extends AbstractMavenIntegrationTestCase { @@ -36,7 +34,8 @@ public class MavenIT0199CyclicImportScopeTest extends AbstractMavenIntegrationTe public void testit0199() throws Exception { // v1: parent not using BOM; explicit dep from componentB → componentA // v2: BOM introduced; componentB → componentA picks up implicit version 1 from main@v1 - // v3: components now inheriting indirectly from an older version of the BOM that includes them; componentB → componentA version overridden + // v3: components now inheriting indirectly from an older version of the BOM that includes them; componentB → + // componentA version overridden for (int i = 1; i <= 3; i++) { build("v" + i + "/parent", null); build("v" + i + "/componentA", "target/componentA-" + i + ".jar"); @@ -57,5 +56,4 @@ public class MavenIT0199CyclicImportScopeTest extends AbstractMavenIntegrationTe } verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITBootstrapTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITBootstrapTest.java index b73e61956c..2e30525b60 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITBootstrapTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITBootstrapTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,12 +31,9 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITBootstrapTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITBootstrapTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenITBootstrapTest extends AbstractMavenIntegrationTestCase { + public MavenITBootstrapTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -47,22 +42,20 @@ public class MavenITBootstrapTest * @throws Exception in case of failure */ @Test - public void testBootstrap() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/bootstrap" ); + public void testBootstrap() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/bootstrap"); - Verifier verifier = newVerifier( testDir.getAbsolutePath(), "remote" ); - verifier.setAutoclean( false ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "-Dbootstrap=" + getClass().getResource( "/bootstrap.txt" ).toURI().getPath() ); + Verifier verifier = newVerifier(testDir.getAbsolutePath(), "remote"); + verifier.setAutoclean(false); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("-Dbootstrap=" + + getClass().getResource("/bootstrap.txt").toURI().getPath()); // bootstrap plugin is bound to this phase, do not go further // important: maven-plugin packaging will fail at package phase, as there is no Mojo present! - verifier.addCliArgument( "process-resources" ); + verifier.addCliArgument("process-resources"); verifier.execute(); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0095ReactorFailureBehaviorTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0095ReactorFailureBehaviorTest.java index b0641a0a13..7165136424 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0095ReactorFailureBehaviorTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0095ReactorFailureBehaviorTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,12 +31,9 @@ import org.junit.jupiter.api.Test; * @author John Casey * */ -public class MavenITmng0095ReactorFailureBehaviorTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng0095ReactorFailureBehaviorTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenITmng0095ReactorFailureBehaviorTest extends AbstractMavenIntegrationTestCase { + public MavenITmng0095ReactorFailureBehaviorTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -48,34 +43,29 @@ public class MavenITmng0095ReactorFailureBehaviorTest * @throws Exception in case of failure */ @Test - public void testitFailFast() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-0095" ); + public void testitFailFast() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-0095"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteDirectory( "subproject1/target" ); - verifier.deleteDirectory( "subproject2/target" ); - verifier.deleteDirectory( "subproject3/target" ); - verifier.addCliArgument( "--fail-fast" ); - verifier.setLogFileName( "log-ff.txt" ); - try - { - verifier.addCliArgument( "org.apache.maven.its.plugins:maven-it-plugin-touch:touch" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteDirectory("subproject1/target"); + verifier.deleteDirectory("subproject2/target"); + verifier.deleteDirectory("subproject3/target"); + verifier.addCliArgument("--fail-fast"); + verifier.setLogFileName("log-ff.txt"); + try { + verifier.addCliArgument("org.apache.maven.its.plugins:maven-it-plugin-touch:touch"); verifier.execute(); verifier.verifyErrorFreeLog(); - } - catch ( VerificationException e ) - { + } catch (VerificationException e) { // expected } - verifier.verifyFilePresent( "target/touch.txt" ); - verifier.verifyFileNotPresent( "subproject1/target/touch.txt" ); - verifier.verifyFileNotPresent( "subproject2/target/touch.txt" ); - verifier.verifyFileNotPresent( "subproject3/target/touch.txt" ); + verifier.verifyFilePresent("target/touch.txt"); + verifier.verifyFileNotPresent("subproject1/target/touch.txt"); + verifier.verifyFileNotPresent("subproject2/target/touch.txt"); + verifier.verifyFileNotPresent("subproject3/target/touch.txt"); } /** @@ -85,26 +75,24 @@ public class MavenITmng0095ReactorFailureBehaviorTest * @throws Exception in case of failure */ @Test - public void testitFailNever() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-0095" ); + public void testitFailNever() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-0095"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteDirectory( "subproject1/target" ); - verifier.deleteDirectory( "subproject2/target" ); - verifier.deleteDirectory( "subproject3/target" ); - verifier.addCliArgument( "--fail-never" ); - verifier.setLogFileName( "log-fn.txt" ); - verifier.addCliArgument( "org.apache.maven.its.plugins:maven-it-plugin-touch:touch" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteDirectory("subproject1/target"); + verifier.deleteDirectory("subproject2/target"); + verifier.deleteDirectory("subproject3/target"); + verifier.addCliArgument("--fail-never"); + verifier.setLogFileName("log-fn.txt"); + verifier.addCliArgument("org.apache.maven.its.plugins:maven-it-plugin-touch:touch"); verifier.execute(); - verifier.verifyFilePresent( "target/touch.txt" ); - verifier.verifyFileNotPresent( "subproject1/target/touch.txt" ); - verifier.verifyFilePresent( "subproject2/target/touch.txt" ); - verifier.verifyFilePresent( "subproject3/target/touch.txt" ); + verifier.verifyFilePresent("target/touch.txt"); + verifier.verifyFileNotPresent("subproject1/target/touch.txt"); + verifier.verifyFilePresent("subproject2/target/touch.txt"); + verifier.verifyFilePresent("subproject3/target/touch.txt"); } /** @@ -115,34 +103,28 @@ public class MavenITmng0095ReactorFailureBehaviorTest * @throws Exception in case of failure */ @Test - public void testitFailAtEnd() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-0095" ); + public void testitFailAtEnd() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-0095"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteDirectory( "subproject1/target" ); - verifier.deleteDirectory( "subproject2/target" ); - verifier.deleteDirectory( "subproject3/target" ); - verifier.addCliArgument( "--fail-at-end" ); - verifier.setLogFileName( "log-fae.txt" ); - try - { - verifier.addCliArgument( "org.apache.maven.its.plugins:maven-it-plugin-touch:touch" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteDirectory("subproject1/target"); + verifier.deleteDirectory("subproject2/target"); + verifier.deleteDirectory("subproject3/target"); + verifier.addCliArgument("--fail-at-end"); + verifier.setLogFileName("log-fae.txt"); + try { + verifier.addCliArgument("org.apache.maven.its.plugins:maven-it-plugin-touch:touch"); verifier.execute(); verifier.verifyErrorFreeLog(); - } - catch ( VerificationException e ) - { + } catch (VerificationException e) { // expected } - verifier.verifyFilePresent( "target/touch.txt" ); - verifier.verifyFileNotPresent( "subproject1/target/touch.txt" ); - verifier.verifyFilePresent( "subproject2/target/touch.txt" ); - verifier.verifyFileNotPresent( "subproject3/target/touch.txt" ); + verifier.verifyFilePresent("target/touch.txt"); + verifier.verifyFileNotPresent("subproject1/target/touch.txt"); + verifier.verifyFilePresent("subproject2/target/touch.txt"); + verifier.verifyFileNotPresent("subproject3/target/touch.txt"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0187CollectedProjectsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0187CollectedProjectsTest.java index e04637e89d..b579e92946 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0187CollectedProjectsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0187CollectedProjectsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,9 +16,7 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.ArrayList; @@ -29,6 +25,8 @@ import java.util.Collections; import java.util.List; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -36,13 +34,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng0187CollectedProjectsTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng0187CollectedProjectsTest extends AbstractMavenIntegrationTestCase { - public MavenITmng0187CollectedProjectsTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng0187CollectedProjectsTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -52,51 +47,45 @@ public class MavenITmng0187CollectedProjectsTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-0187" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-0187"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteDirectory( "sub-1/target" ); - verifier.deleteDirectory( "sub-1/sub-2/target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteDirectory("sub-1/target"); + verifier.deleteDirectory("sub-1/sub-2/target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); Properties props; - props = verifier.loadProperties( "target/project.properties" ); - assertEquals( "2", props.getProperty( "project.collectedProjects.size" ) ); - assertEquals( Arrays.asList( new String[]{ "sub-1", "sub-2" } ), getProjects( props ) ); + props = verifier.loadProperties("target/project.properties"); + assertEquals("2", props.getProperty("project.collectedProjects.size")); + assertEquals(Arrays.asList(new String[] {"sub-1", "sub-2"}), getProjects(props)); - props = verifier.loadProperties( "sub-1/target/project.properties" ); - assertEquals( "1", props.getProperty( "project.collectedProjects.size" ) ); - assertEquals( Arrays.asList( new String[]{ "sub-2" } ), getProjects( props ) ); + props = verifier.loadProperties("sub-1/target/project.properties"); + assertEquals("1", props.getProperty("project.collectedProjects.size")); + assertEquals(Arrays.asList(new String[] {"sub-2"}), getProjects(props)); - props = verifier.loadProperties( "sub-1/sub-2/target/project.properties" ); - assertEquals( "0", props.getProperty( "project.collectedProjects.size" ) ); - assertEquals( Arrays.asList( new String[]{} ), getProjects( props ) ); + props = verifier.loadProperties("sub-1/sub-2/target/project.properties"); + assertEquals("0", props.getProperty("project.collectedProjects.size")); + assertEquals(Arrays.asList(new String[] {}), getProjects(props)); } - private List getProjects( Properties props ) - { + private List getProjects(Properties props) { List projects = new ArrayList<>(); - for ( Object o : props.keySet() ) - { + for (Object o : props.keySet()) { String key = o.toString(); - if ( key.startsWith( "project.collectedProjects." ) && !key.endsWith( ".size" ) ) - { - projects.add( props.getProperty( key ) ); + if (key.startsWith("project.collectedProjects.") && !key.endsWith(".size")) { + projects.add(props.getProperty(key)); } } - Collections.sort( projects ); + Collections.sort(projects); return projects; } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0249ResolveDepsFromReactorTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0249ResolveDepsFromReactorTest.java index 7c1ae8231f..edbc5b8414 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0249ResolveDepsFromReactorTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0249ResolveDepsFromReactorTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,12 +31,9 @@ import org.junit.jupiter.api.Test; * @author Brett Porter * */ -public class MavenITmng0249ResolveDepsFromReactorTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng0249ResolveDepsFromReactorTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenITmng0249ResolveDepsFromReactorTest extends AbstractMavenIntegrationTestCase { + public MavenITmng0249ResolveDepsFromReactorTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -47,31 +42,28 @@ public class MavenITmng0249ResolveDepsFromReactorTest * @throws Exception in case of failure */ @Test - public void testitMNG0249() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-0249" ); + public void testitMNG0249() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-0249"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List ccp = verifier.loadLines( "test-component-c/target/compile.txt", "UTF-8" ); - assertTrue( ccp.toString(), ccp.contains( "test-component-c/classes" ) ); - assertTrue( ccp.toString(), ccp.contains( "test-component-b/classes" ) ); - assertTrue( ccp.toString(), ccp.contains( "test-component-a/classes" ) ); + List ccp = verifier.loadLines("test-component-c/target/compile.txt", "UTF-8"); + assertTrue(ccp.toString(), ccp.contains("test-component-c/classes")); + assertTrue(ccp.toString(), ccp.contains("test-component-b/classes")); + assertTrue(ccp.toString(), ccp.contains("test-component-a/classes")); - List rcp = verifier.loadLines( "test-component-c/target/runtime.txt", "UTF-8" ); - assertTrue( rcp.toString(), rcp.contains( "test-component-c/classes" ) ); - assertTrue( rcp.toString(), rcp.contains( "test-component-b/classes" ) ); - assertTrue( rcp.toString(), rcp.contains( "test-component-a/classes" ) ); + List rcp = verifier.loadLines("test-component-c/target/runtime.txt", "UTF-8"); + assertTrue(rcp.toString(), rcp.contains("test-component-c/classes")); + assertTrue(rcp.toString(), rcp.contains("test-component-b/classes")); + assertTrue(rcp.toString(), rcp.contains("test-component-a/classes")); - List tcp = verifier.loadLines( "test-component-c/target/test.txt", "UTF-8" ); - assertTrue( tcp.toString(), tcp.contains( "test-component-c/classes" ) ); - assertTrue( tcp.toString(), tcp.contains( "test-component-b/classes" ) ); - assertTrue( tcp.toString(), tcp.contains( "test-component-a/classes" ) ); + List tcp = verifier.loadLines("test-component-c/target/test.txt", "UTF-8"); + assertTrue(tcp.toString(), tcp.contains("test-component-c/classes")); + assertTrue(tcp.toString(), tcp.contains("test-component-b/classes")); + assertTrue(tcp.toString(), tcp.contains("test-component-a/classes")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0282NonReactorExecWhenProjectIndependentTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0282NonReactorExecWhenProjectIndependentTest.java index d27812e3de..9f02ad1c6d 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0282NonReactorExecWhenProjectIndependentTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0282NonReactorExecWhenProjectIndependentTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,12 +30,9 @@ import org.junit.jupiter.api.Test; * @author John Casey * */ -public class MavenITmng0282NonReactorExecWhenProjectIndependentTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng0282NonReactorExecWhenProjectIndependentTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenITmng0282NonReactorExecWhenProjectIndependentTest extends AbstractMavenIntegrationTestCase { + public MavenITmng0282NonReactorExecWhenProjectIndependentTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -46,20 +41,17 @@ public class MavenITmng0282NonReactorExecWhenProjectIndependentTest * @throws Exception in case of failure */ @Test - public void testitMNG282() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-0282" ); + public void testitMNG282() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-0282"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteDirectory( "subproject/target" ); - verifier.addCliArgument( "org.apache.maven.its.plugins:maven-it-plugin-no-project:light-touch" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteDirectory("subproject/target"); + verifier.addCliArgument("org.apache.maven.its.plugins:maven-it-plugin-no-project:light-touch"); verifier.execute(); - verifier.verifyFilePresent( "target/touch.txt" ); - verifier.verifyFileNotPresent( "subproject/target/touch.txt" ); + verifier.verifyFilePresent("target/touch.txt"); + verifier.verifyFileNotPresent("subproject/target/touch.txt"); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0294MergeGlobalAndUserSettingsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0294MergeGlobalAndUserSettingsTest.java index 5451678332..3ec17fbd93 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0294MergeGlobalAndUserSettingsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0294MergeGlobalAndUserSettingsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * @author John Casey * */ -public class MavenITmng0294MergeGlobalAndUserSettingsTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng0294MergeGlobalAndUserSettingsTest extends AbstractMavenIntegrationTestCase { - public MavenITmng0294MergeGlobalAndUserSettingsTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng0294MergeGlobalAndUserSettingsTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -47,24 +42,21 @@ public class MavenITmng0294MergeGlobalAndUserSettingsTest * @throws Exception in case of failure */ @Test - public void testitMNG294() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-0294" ); + public void testitMNG294() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-0294"); - Verifier verifier = new Verifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "user-settings.xml" ); + Verifier verifier = new Verifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("user-settings.xml"); // dedicated CLI option only available since MNG-3914 - verifier.addCliArgument( "--global-settings" ); - verifier.addCliArgument( "global-settings.xml" ); - verifier.addCliArgument( "org.apache.maven.its.plugins:maven-it-plugin-touch:touch" ); + verifier.addCliArgument("--global-settings"); + verifier.addCliArgument("global-settings.xml"); + verifier.addCliArgument("org.apache.maven.its.plugins:maven-it-plugin-touch:touch"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/test.txt" ); + verifier.verifyFilePresent("target/test.txt"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0377PluginLookupFromPrefixTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0377PluginLookupFromPrefixTest.java index 3487ac7607..49538bf477 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0377PluginLookupFromPrefixTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0377PluginLookupFromPrefixTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,12 +30,9 @@ import org.junit.jupiter.api.Test; * @author John Casey * */ -public class MavenITmng0377PluginLookupFromPrefixTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng0377PluginLookupFromPrefixTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenITmng0377PluginLookupFromPrefixTest extends AbstractMavenIntegrationTestCase { + public MavenITmng0377PluginLookupFromPrefixTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -47,24 +42,21 @@ public class MavenITmng0377PluginLookupFromPrefixTest * @throws Exception in case of failure */ @Test - public void testitMNG377() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-0377" ); + public void testitMNG377() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-0377"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng0377" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "-Dtouch.outputFile=target/file.txt" ); - verifier.addCliArgument( "itprefix:touch" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng0377"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("-Dtouch.outputFile=target/file.txt"); + verifier.addCliArgument("itprefix:touch"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/file.txt" ); + verifier.verifyFilePresent("target/file.txt"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0449PluginVersionResolutionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0449PluginVersionResolutionTest.java index fd93b3ab18..797fbbb8a9 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0449PluginVersionResolutionTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0449PluginVersionResolutionTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng0449PluginVersionResolutionTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng0449PluginVersionResolutionTest extends AbstractMavenIntegrationTestCase { - public MavenITmng0449PluginVersionResolutionTest() - { - super( "[2.0,)" ); + public MavenITmng0449PluginVersionResolutionTest() { + super("[2.0,)"); } /** @@ -48,42 +43,34 @@ public class MavenITmng0449PluginVersionResolutionTest * @throws Exception in case of failure */ @Test - public void testitLifecycleInvocation() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-0449" ); - testDir = new File( testDir, "lifecycle" ); + public void testitLifecycleInvocation() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-0449"); + testDir = new File(testDir, "lifecycle"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - try - { - verifier.deleteArtifacts( "org.apache.maven.its.mng0449" ); - } - catch ( Exception e ) - { + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + try { + verifier.deleteArtifacts("org.apache.maven.its.mng0449"); + } catch (Exception e) { // when we run Maven embedded, the plugin class realm locks the artifacts so we can't delete them } - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.filterFile( "../settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "validate" ); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.filterFile("../settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); // Maven 3.x prefers RELEASE over LATEST (see MNG-4206) - if ( matchesVersionRange( "(,3.0-alpha-3)" ) ) - { - verifier.verifyFileNotPresent( "target/touch-release.txt" ); - verifier.verifyFilePresent( "target/touch-snapshot.txt" ); + if (matchesVersionRange("(,3.0-alpha-3)")) { + verifier.verifyFileNotPresent("target/touch-release.txt"); + verifier.verifyFilePresent("target/touch-snapshot.txt"); + } else { + verifier.verifyFilePresent("target/touch-release.txt"); + verifier.verifyFileNotPresent("target/touch-snapshot.txt"); } - else - { - verifier.verifyFilePresent( "target/touch-release.txt" ); - verifier.verifyFileNotPresent( "target/touch-snapshot.txt" ); - } - verifier.verifyFilePresent( "target/package.txt" ); + verifier.verifyFilePresent("target/package.txt"); } /** @@ -93,41 +80,32 @@ public class MavenITmng0449PluginVersionResolutionTest * @throws Exception in case of failure */ @Test - public void testitCliInvocation() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-0449" ); - testDir = new File( testDir, "direct" ); + public void testitCliInvocation() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-0449"); + testDir = new File(testDir, "direct"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - try - { - verifier.deleteArtifacts( "org.apache.maven.its.mng0449" ); - } - catch ( Exception e ) - { + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + try { + verifier.deleteArtifacts("org.apache.maven.its.mng0449"); + } catch (Exception e) { // when we run Maven embedded, the plugin class realm locks the artifacts so we can't delete them } - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.filterFile( "../settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "org.apache.maven.its.mng0449:maven-it-plugin-a:touch" ); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.filterFile("../settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("org.apache.maven.its.mng0449:maven-it-plugin-a:touch"); verifier.execute(); verifier.verifyErrorFreeLog(); // Maven 3.x prefers RELEASE over LATEST (see MNG-4206) - if ( matchesVersionRange( "(,3.0-alpha-3)" ) ) - { - verifier.verifyFileNotPresent( "target/touch-release.txt" ); - verifier.verifyFilePresent( "target/touch-snapshot.txt" ); - } - else - { - verifier.verifyFilePresent( "target/touch-release.txt" ); - verifier.verifyFileNotPresent( "target/touch-snapshot.txt" ); + if (matchesVersionRange("(,3.0-alpha-3)")) { + verifier.verifyFileNotPresent("target/touch-release.txt"); + verifier.verifyFilePresent("target/touch-snapshot.txt"); + } else { + verifier.verifyFilePresent("target/touch-release.txt"); + verifier.verifyFileNotPresent("target/touch-snapshot.txt"); } } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0461TolerateMissingDependencyPomTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0461TolerateMissingDependencyPomTest.java index 19448f154b..f8dbeb33c3 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0461TolerateMissingDependencyPomTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0461TolerateMissingDependencyPomTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng0461TolerateMissingDependencyPomTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng0461TolerateMissingDependencyPomTest extends AbstractMavenIntegrationTestCase { - public MavenITmng0461TolerateMissingDependencyPomTest() - { - super( "[2.0.3,3.0-alpha-1),[3.0-alpha-2,)" ); + public MavenITmng0461TolerateMissingDependencyPomTest() { + super("[2.0.3,3.0-alpha-1),[3.0-alpha-2,)"); } /** @@ -47,24 +42,21 @@ public class MavenITmng0461TolerateMissingDependencyPomTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-0461" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-0461"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng0461" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng0461"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List classpath = verifier.loadLines( "target/classpath.txt", "UTF-8" ); - assertTrue( classpath.toString(), classpath.contains( "dep-0.1.jar" ) ); + List classpath = verifier.loadLines("target/classpath.txt", "UTF-8"); + assertTrue(classpath.toString(), classpath.contains("dep-0.1.jar")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0469ReportConfigTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0469ReportConfigTest.java index 38595673a8..023083e31d 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0469ReportConfigTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0469ReportConfigTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng0469ReportConfigTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng0469ReportConfigTest extends AbstractMavenIntegrationTestCase { - public MavenITmng0469ReportConfigTest() - { - super( "[2.0.0,)" ); + public MavenITmng0469ReportConfigTest() { + super("[2.0.0,)"); } /** @@ -48,18 +43,16 @@ public class MavenITmng0469ReportConfigTest * @throws Exception in case of failure */ @Test - public void testitBuildConfigDominantDuringBuild() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-0469/test1" ); + public void testitBuildConfigDominantDuringBuild() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-0469/test1"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.deleteDirectory( "target" ); - verifier.setAutoclean( false ); - verifier.addCliArgument( "org.apache.maven.its.plugins:maven-it-plugin-configuration:2.1-SNAPSHOT:config" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.deleteDirectory("target"); + verifier.setAutoclean(false); + verifier.addCliArgument("org.apache.maven.its.plugins:maven-it-plugin-configuration:2.1-SNAPSHOT:config"); verifier.execute(); - verifier.verifyFilePresent( "target/build.txt" ); - verifier.verifyFileNotPresent( "target/reporting.txt" ); + verifier.verifyFilePresent("target/build.txt"); + verifier.verifyFileNotPresent("target/reporting.txt"); verifier.verifyErrorFreeLog(); } @@ -69,29 +62,25 @@ public class MavenITmng0469ReportConfigTest * @throws Exception in case of failure */ @Test - public void testitBuildConfigIrrelevantForReports() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-0469/test2" ); + public void testitBuildConfigIrrelevantForReports() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-0469/test2"); - Verifier verifier = newVerifier( testDir.getAbsolutePath(), "remote" ); - verifier.deleteDirectory( "target" ); - verifier.setAutoclean( false ); - if ( matchesVersionRange( "(,3.0-alpha-1)" ) ) - { - verifier.addCliArgument( "org.apache.maven.its.plugins:maven-it-plugin-site:2.1-SNAPSHOT:generate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath(), "remote"); + verifier.deleteDirectory("target"); + verifier.setAutoclean(false); + if (matchesVersionRange("(,3.0-alpha-1)")) { + verifier.addCliArgument("org.apache.maven.its.plugins:maven-it-plugin-site:2.1-SNAPSHOT:generate"); verifier.execute(); - verifier.verifyFilePresent( "target/site/info.properties" ); - } - else - { - verifier.addCliArgument( "validate" ); + verifier.verifyFilePresent("target/site/info.properties"); + } else { + verifier.addCliArgument("validate"); verifier.execute(); - Properties props = verifier.loadProperties( "target/config.properties" ); - assertEquals( "maven-it-plugin-site", props.getProperty( "project.reporting.plugins.0.artifactId" ) ); - assertNotEquals( "fail.properties", props.getProperty( "project.reporting.plugins.0.configuration.children.infoFile.0.value" ) ); + Properties props = verifier.loadProperties("target/config.properties"); + assertEquals("maven-it-plugin-site", props.getProperty("project.reporting.plugins.0.artifactId")); + assertNotEquals( + "fail.properties", + props.getProperty("project.reporting.plugins.0.configuration.children.infoFile.0.value")); } verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0471CustomLifecycleTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0471CustomLifecycleTest.java index 25ed910ed7..5deef8815e 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0471CustomLifecycleTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0471CustomLifecycleTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; -import java.util.Arrays; -import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -34,12 +30,9 @@ import org.junit.jupiter.api.Test; * @author Brett Porter * */ -public class MavenITmng0471CustomLifecycleTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng0471CustomLifecycleTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenITmng0471CustomLifecycleTest extends AbstractMavenIntegrationTestCase { + public MavenITmng0471CustomLifecycleTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -48,21 +41,19 @@ public class MavenITmng0471CustomLifecycleTest * @throws Exception in case of failure */ @Test - public void testitMNG471() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-0471" ); + public void testitMNG471() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-0471"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArguments( "org.apache.maven.its.plugins:maven-it-plugin-fork:fork", - "org.apache.maven.its.plugins:maven-it-plugin-fork:fork-goal" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArguments( + "org.apache.maven.its.plugins:maven-it-plugin-fork:fork", + "org.apache.maven.its.plugins:maven-it-plugin-fork:fork-goal"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/forked/touch.txt" ); - verifier.verifyFilePresent( "target/forked2/touch.txt" ); + verifier.verifyFilePresent("target/forked/touch.txt"); + verifier.verifyFilePresent("target/forked2/touch.txt"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0479OverrideCentralRepoTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0479OverrideCentralRepoTest.java index 6a452cdd8c..256c9c4ad9 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0479OverrideCentralRepoTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0479OverrideCentralRepoTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -34,12 +32,9 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng0479OverrideCentralRepoTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng0479OverrideCentralRepoTest() - { - super( "[2.0.3,3.0-alpha-1),[3.0-beta-3,)" ); +public class MavenITmng0479OverrideCentralRepoTest extends AbstractMavenIntegrationTestCase { + public MavenITmng0479OverrideCentralRepoTest() { + super("[2.0.3,3.0-alpha-1),[3.0-beta-3,)"); } /** @@ -48,73 +43,67 @@ public class MavenITmng0479OverrideCentralRepoTest * @throws Exception in case of failure */ @Test - public void testitModel() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-0479" ); + public void testitModel() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-0479"); // Phase 1: Ensure the test plugin is downloaded before the test cuts off access to central - File child1 = new File( testDir, "setup" ); - Verifier verifier = newVerifier( child1.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); + File child1 = new File(testDir, "setup"); + Verifier verifier = newVerifier(child1.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); - verifier.addCliArgument( "org.apache.maven.its.plugins:maven-it-plugin-expression:2.1-SNAPSHOT:eval" ); + verifier.addCliArgument("org.apache.maven.its.plugins:maven-it-plugin-expression:2.1-SNAPSHOT:eval"); verifier.execute(); verifier.verifyErrorFreeLog(); // Phase 2: Now run the test - File child2 = new File( testDir, "test" ); - verifier = newVerifier( child2.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); + File child2 = new File(testDir, "test"); + verifier = newVerifier(child2.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "org.apache.maven.its.plugins:maven-it-plugin-expression:2.1-SNAPSHOT:eval" ); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("org.apache.maven.its.plugins:maven-it-plugin-expression:2.1-SNAPSHOT:eval"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/expression.properties" ); - Properties props = verifier.loadProperties( "target/expression.properties" ); + verifier.verifyFilePresent("target/expression.properties"); + Properties props = verifier.loadProperties("target/expression.properties"); - int count = Integer.parseInt( props.getProperty( "project.repositories", "0" ) ); - assertTrue( count > 0 ); - for ( int i = 0; i < count; i++ ) - { + int count = Integer.parseInt(props.getProperty("project.repositories", "0")); + assertTrue(count > 0); + for (int i = 0; i < count; i++) { String key = "project.repositories." + i; - if ( "central".equals( props.getProperty( key + ".id" ) ) ) - { - assertEquals( "mng-0479", props.getProperty( key + ".name" ) ); - assertTrue( props.getProperty( key + ".url" ).endsWith( "/target/mng-0479" ) ); + if ("central".equals(props.getProperty(key + ".id"))) { + assertEquals("mng-0479", props.getProperty(key + ".name")); + assertTrue(props.getProperty(key + ".url").endsWith("/target/mng-0479")); - assertEquals( "false", props.getProperty( key + ".releases.enabled" ) ); - assertEquals( "ignore", props.getProperty( key + ".releases.checksumPolicy" ) ); - assertEquals( "always", props.getProperty( key + ".releases.updatePolicy" ) ); + assertEquals("false", props.getProperty(key + ".releases.enabled")); + assertEquals("ignore", props.getProperty(key + ".releases.checksumPolicy")); + assertEquals("always", props.getProperty(key + ".releases.updatePolicy")); - assertEquals( "true", props.getProperty( key + ".snapshots.enabled" ) ); - assertEquals( "fail", props.getProperty( key + ".snapshots.checksumPolicy" ) ); - assertEquals( "never", props.getProperty( key + ".snapshots.updatePolicy" ) ); + assertEquals("true", props.getProperty(key + ".snapshots.enabled")); + assertEquals("fail", props.getProperty(key + ".snapshots.checksumPolicy")); + assertEquals("never", props.getProperty(key + ".snapshots.updatePolicy")); } } - count = Integer.parseInt( props.getProperty( "project.pluginRepositories", "0" ) ); - for ( int i = 0; i < count; i++ ) - { + count = Integer.parseInt(props.getProperty("project.pluginRepositories", "0")); + for (int i = 0; i < count; i++) { String key = "project.pluginRepositories." + i; - if ( "central".equals( props.getProperty( key + ".id" ) ) ) - { - assertEquals( "mng-0479", props.getProperty( key + ".name" ) ); - assertTrue( props.getProperty( key + ".url" ).endsWith( "/target/mng-0479" ) ); + if ("central".equals(props.getProperty(key + ".id"))) { + assertEquals("mng-0479", props.getProperty(key + ".name")); + assertTrue(props.getProperty(key + ".url").endsWith("/target/mng-0479")); - assertEquals( "false", props.getProperty( key + ".releases.enabled" ) ); - assertEquals( "ignore", props.getProperty( key + ".releases.checksumPolicy" ) ); - assertEquals( "always", props.getProperty( key + ".releases.updatePolicy" ) ); + assertEquals("false", props.getProperty(key + ".releases.enabled")); + assertEquals("ignore", props.getProperty(key + ".releases.checksumPolicy")); + assertEquals("always", props.getProperty(key + ".releases.updatePolicy")); - assertEquals( "true", props.getProperty( key + ".snapshots.enabled" ) ); - assertEquals( "fail", props.getProperty( key + ".snapshots.checksumPolicy" ) ); - assertEquals( "never", props.getProperty( key + ".snapshots.updatePolicy" ) ); + assertEquals("true", props.getProperty(key + ".snapshots.enabled")); + assertEquals("fail", props.getProperty(key + ".snapshots.checksumPolicy")); + assertEquals("never", props.getProperty(key + ".snapshots.updatePolicy")); } } } @@ -125,91 +114,79 @@ public class MavenITmng0479OverrideCentralRepoTest * @throws Exception in case of failure */ @Test - public void testitResolution() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-0479" ); + public void testitResolution() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-0479"); - Verifier verifier = newVerifier( new File( testDir, "test-1" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng0479" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(new File(testDir, "test-1").getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng0479"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/touch.txt" ); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng0479", "parent", "0.1-SNAPSHOT", "pom" ); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng0479", "a", "0.1-SNAPSHOT", "jar" ); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng0479", "a", "0.1-SNAPSHOT", "pom" ); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng0479", "a-parent", "0.1-SNAPSHOT", "pom" ); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng0479", "b", "0.1-SNAPSHOT", "jar" ); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng0479", "b", "0.1-SNAPSHOT", "pom" ); + verifier.verifyFilePresent("target/touch.txt"); + verifier.verifyArtifactPresent("org.apache.maven.its.mng0479", "parent", "0.1-SNAPSHOT", "pom"); + verifier.verifyArtifactPresent("org.apache.maven.its.mng0479", "a", "0.1-SNAPSHOT", "jar"); + verifier.verifyArtifactPresent("org.apache.maven.its.mng0479", "a", "0.1-SNAPSHOT", "pom"); + verifier.verifyArtifactPresent("org.apache.maven.its.mng0479", "a-parent", "0.1-SNAPSHOT", "pom"); + verifier.verifyArtifactPresent("org.apache.maven.its.mng0479", "b", "0.1-SNAPSHOT", "jar"); + verifier.verifyArtifactPresent("org.apache.maven.its.mng0479", "b", "0.1-SNAPSHOT", "pom"); - verifier = newVerifier( new File( testDir, "test-2" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - try - { - verifier.addCliArgument( "validate" ); + verifier = newVerifier(new File(testDir, "test-2").getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + try { + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - fail( "Build should have failed to resolve parent POM" ); - } - catch ( VerificationException e ) - { + fail("Build should have failed to resolve parent POM"); + } catch (VerificationException e) { // expected } - verifier.verifyArtifactNotPresent( "org.apache.maven.its.mng0479", "parent", "0.1", "pom" ); + verifier.verifyArtifactNotPresent("org.apache.maven.its.mng0479", "parent", "0.1", "pom"); - verifier = newVerifier( new File( testDir, "test-3" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - try - { - verifier.addCliArgument( "org.apache.maven.its.mng0479:maven-mng0479-plugin:0.1-SNAPSHOT:touch" ); + verifier = newVerifier(new File(testDir, "test-3").getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + try { + verifier.addCliArgument("org.apache.maven.its.mng0479:maven-mng0479-plugin:0.1-SNAPSHOT:touch"); verifier.execute(); verifier.verifyErrorFreeLog(); - fail( "Build should have failed to resolve direct dependency" ); - } - catch ( VerificationException e ) - { + fail("Build should have failed to resolve direct dependency"); + } catch (VerificationException e) { // expected } - verifier.verifyArtifactNotPresent( "org.apache.maven.its.mng0479", "a", "0.1", "jar" ); - verifier.verifyArtifactNotPresent( "org.apache.maven.its.mng0479", "a", "0.1", "pom" ); + verifier.verifyArtifactNotPresent("org.apache.maven.its.mng0479", "a", "0.1", "jar"); + verifier.verifyArtifactNotPresent("org.apache.maven.its.mng0479", "a", "0.1", "pom"); - verifier = newVerifier( new File( testDir, "test-4" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - try - { - verifier.addCliArgument( "org.apache.maven.its.mng0479:maven-mng0479-plugin:0.1-SNAPSHOT:touch" ); + verifier = newVerifier(new File(testDir, "test-4").getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + try { + verifier.addCliArgument("org.apache.maven.its.mng0479:maven-mng0479-plugin:0.1-SNAPSHOT:touch"); verifier.execute(); verifier.verifyErrorFreeLog(); - fail( "Build should have failed to resolve transitive dependency" ); - } - catch ( VerificationException e ) - { + fail("Build should have failed to resolve transitive dependency"); + } catch (VerificationException e) { // expected } - verifier.verifyArtifactNotPresent( "org.apache.maven.its.mng0479", "b", "0.1", "jar" ); - verifier.verifyArtifactNotPresent( "org.apache.maven.its.mng0479", "b", "0.1", "pom" ); + verifier.verifyArtifactNotPresent("org.apache.maven.its.mng0479", "b", "0.1", "jar"); + verifier.verifyArtifactNotPresent("org.apache.maven.its.mng0479", "b", "0.1", "pom"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0496IgnoreUnknownPluginParametersTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0496IgnoreUnknownPluginParametersTest.java index 8301579c12..9b156f3e07 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0496IgnoreUnknownPluginParametersTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0496IgnoreUnknownPluginParametersTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,12 +30,9 @@ import org.junit.jupiter.api.Test; * @author John Casey * */ -public class MavenITmng0496IgnoreUnknownPluginParametersTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng0496IgnoreUnknownPluginParametersTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenITmng0496IgnoreUnknownPluginParametersTest extends AbstractMavenIntegrationTestCase { + public MavenITmng0496IgnoreUnknownPluginParametersTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -47,18 +42,15 @@ public class MavenITmng0496IgnoreUnknownPluginParametersTest * @throws Exception in case of failure */ @Test - public void testitMNG496() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-0496" ); + public void testitMNG496() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-0496"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "org.apache.maven.its.plugins:maven-it-plugin-log-file:2.1-SNAPSHOT:reset" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("org.apache.maven.its.plugins:maven-it-plugin-log-file:2.1-SNAPSHOT:reset"); verifier.execute(); - verifier.verifyFilePresent( "target/file.txt" ); + verifier.verifyFilePresent("target/file.txt"); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0505VersionRangeTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0505VersionRangeTest.java index b86d6cd8f6..676633f5f4 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0505VersionRangeTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0505VersionRangeTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Collection; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,16 +31,13 @@ import org.junit.jupiter.api.Test; * @author Brett Porter * */ -public class MavenITmng0505VersionRangeTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng0505VersionRangeTest extends AbstractMavenIntegrationTestCase { /** * Oleg 2009.04.30: the same functionality but simpler - no multiple ranges - syntax * is tested in MNG-4150 */ - public MavenITmng0505VersionRangeTest() - { - super( "(,3.0-alpha-1),[3.0-alpha-3,)" ); + public MavenITmng0505VersionRangeTest() { + super("(,3.0-alpha-1),[3.0-alpha-3,)"); } /** @@ -51,28 +46,25 @@ public class MavenITmng0505VersionRangeTest * @throws Exception in case of failure */ @Test - public void testitMNG505() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-0505" ); + public void testitMNG505() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-0505"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng0505" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng0505"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Collection artifacts = verifier.loadLines( "target/artifacts.txt", "UTF-8" ); - assertEquals( 4, artifacts.size() ); - assertTrue( artifacts.toString(), artifacts.contains( "org.apache.maven.its.mng0505:a:jar:1.1" ) ); - assertTrue( artifacts.toString(), artifacts.contains( "org.apache.maven.its.mng0505:b:jar:1.0" ) ); - assertTrue( artifacts.toString(), artifacts.contains( "org.apache.maven.its.mng0505:c:jar:3.8" ) ); - assertTrue( artifacts.toString(), artifacts.contains( "org.apache.maven.its.mng0505:d:jar:2.1.1" ) ); + Collection artifacts = verifier.loadLines("target/artifacts.txt", "UTF-8"); + assertEquals(4, artifacts.size()); + assertTrue(artifacts.toString(), artifacts.contains("org.apache.maven.its.mng0505:a:jar:1.1")); + assertTrue(artifacts.toString(), artifacts.contains("org.apache.maven.its.mng0505:b:jar:1.0")); + assertTrue(artifacts.toString(), artifacts.contains("org.apache.maven.its.mng0505:c:jar:3.8")); + assertTrue(artifacts.toString(), artifacts.contains("org.apache.maven.its.mng0505:d:jar:2.1.1")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0507ArtifactRelocationTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0507ArtifactRelocationTest.java index 40883ae45c..f5d6265485 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0507ArtifactRelocationTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0507ArtifactRelocationTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,12 +31,9 @@ import org.junit.jupiter.api.Test; * @author Brett Porter * */ -public class MavenITmng0507ArtifactRelocationTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng0507ArtifactRelocationTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenITmng0507ArtifactRelocationTest extends AbstractMavenIntegrationTestCase { + public MavenITmng0507ArtifactRelocationTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -47,29 +42,26 @@ public class MavenITmng0507ArtifactRelocationTest * @throws Exception in case of failure */ @Test - public void testitMNG507() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-0507" ); + public void testitMNG507() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-0507"); - Verifier verifier = newVerifier( testDir.getAbsolutePath(), "remote" ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven", "maven-core-it-support", "1.1" ); - verifier.deleteArtifacts( "org.apache.maven", "maven-core-it-support-old-location", "1.1" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath(), "remote"); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven", "maven-core-it-support", "1.1"); + verifier.deleteArtifacts("org.apache.maven", "maven-core-it-support-old-location", "1.1"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyArtifactPresent( "org.apache.maven", "maven-core-it-support", "1.1", "jar" ); - verifier.verifyArtifactPresent( "org.apache.maven", "maven-core-it-support", "1.1", "pom" ); - verifier.verifyArtifactPresent( "org.apache.maven", "maven-core-it-support-old-location", "1.1", "pom" ); - verifier.verifyArtifactNotPresent( "org.apache.maven", "maven-core-it-support-old-location", "1.1", "jar" ); + verifier.verifyArtifactPresent("org.apache.maven", "maven-core-it-support", "1.1", "jar"); + verifier.verifyArtifactPresent("org.apache.maven", "maven-core-it-support", "1.1", "pom"); + verifier.verifyArtifactPresent("org.apache.maven", "maven-core-it-support-old-location", "1.1", "pom"); + verifier.verifyArtifactNotPresent("org.apache.maven", "maven-core-it-support-old-location", "1.1", "jar"); - List artifacts = verifier.loadLines( "target/artifacts.txt", "UTF-8" ); - assertTrue( artifacts.toString(), artifacts.contains( "org.apache.maven:maven-core-it-support:jar:1.1" ) ); + List artifacts = verifier.loadLines("target/artifacts.txt", "UTF-8"); + assertTrue(artifacts.toString(), artifacts.contains("org.apache.maven:maven-core-it-support:jar:1.1")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0522InheritedPluginMgmtConfigTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0522InheritedPluginMgmtConfigTest.java index 043422821c..096c462915 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0522InheritedPluginMgmtConfigTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0522InheritedPluginMgmtConfigTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,12 +30,9 @@ import org.junit.jupiter.api.Test; * @author John Casey * */ -public class MavenITmng0522InheritedPluginMgmtConfigTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng0522InheritedPluginMgmtConfigTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenITmng0522InheritedPluginMgmtConfigTest extends AbstractMavenIntegrationTestCase { + public MavenITmng0522InheritedPluginMgmtConfigTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -46,20 +41,17 @@ public class MavenITmng0522InheritedPluginMgmtConfigTest * @throws Exception in case of failure */ @Test - public void testitMNG522() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-0522" ); + public void testitMNG522() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-0522"); - Verifier verifier = newVerifier( new File( testDir, "child-project" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "process-resources" ); + Verifier verifier = newVerifier(new File(testDir, "child-project").getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("process-resources"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/plugin-mngt-config-1.txt" ); - verifier.verifyFilePresent( "target/plugin-mngt-config-2.txt" ); + verifier.verifyFilePresent("target/plugin-mngt-config-1.txt"); + verifier.verifyFilePresent("target/plugin-mngt-config-2.txt"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0553SettingsAuthzEncryptionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0553SettingsAuthzEncryptionTest.java index 88e490b5fe..9508923a8d 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0553SettingsAuthzEncryptionTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0553SettingsAuthzEncryptionTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,15 +16,15 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.HashMap; import java.util.List; import java.util.Map; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.eclipse.jetty.security.ConstraintMapping; import org.eclipse.jetty.security.ConstraintSecurityHandler; import org.eclipse.jetty.security.HashLoginService; @@ -49,9 +47,7 @@ import static org.eclipse.jetty.util.security.Constraint.__BASIC_AUTH; * * @author Benjamin Bentmann */ -public class MavenITmng0553SettingsAuthzEncryptionTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng0553SettingsAuthzEncryptionTest extends AbstractMavenIntegrationTestCase { private File testDir; @@ -59,59 +55,52 @@ public class MavenITmng0553SettingsAuthzEncryptionTest private int port; - public MavenITmng0553SettingsAuthzEncryptionTest() - { - super( "[2.1.0,3.0-alpha-1),[3.0-alpha-3,)" ); + public MavenITmng0553SettingsAuthzEncryptionTest() { + super("[2.1.0,3.0-alpha-1),[3.0-alpha-3,)"); } @BeforeEach - protected void setUp() - throws Exception - { - testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-0553" ); + protected void setUp() throws Exception { + testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-0553"); - Constraint constraint = new Constraint( __BASIC_AUTH, "user" ); - constraint.setAuthenticate( true ); + Constraint constraint = new Constraint(__BASIC_AUTH, "user"); + constraint.setAuthenticate(true); ConstraintMapping constraintMapping = new ConstraintMapping(); - constraintMapping.setConstraint( constraint ); - constraintMapping.setPathSpec( "/*" ); + constraintMapping.setConstraint(constraint); + constraintMapping.setPathSpec("/*"); - HashLoginService userRealm = new HashLoginService( "TestRealm" ); + HashLoginService userRealm = new HashLoginService("TestRealm"); UserStore userStore = new UserStore(); - userStore.addUser( "testuser", new Password( "testtest" ), new String[] { "user" } ); - userRealm.setUserStore( userStore ); + userStore.addUser("testuser", new Password("testtest"), new String[] {"user"}); + userRealm.setUserStore(userStore); - server = new Server( 0 ); + server = new Server(0); ConstraintSecurityHandler securityHandler = new ConstraintSecurityHandler(); - securityHandler.setLoginService( userRealm ); - securityHandler.setAuthMethod( __BASIC_AUTH ); - securityHandler.setConstraintMappings( new ConstraintMapping[] { constraintMapping } ); + securityHandler.setLoginService(userRealm); + securityHandler.setAuthMethod(__BASIC_AUTH); + securityHandler.setConstraintMappings(new ConstraintMapping[] {constraintMapping}); ResourceHandler repoHandler = new ResourceHandler(); - repoHandler.setResourceBase( new File( testDir, "repo" ).getAbsolutePath() ); + repoHandler.setResourceBase(new File(testDir, "repo").getAbsolutePath()); HandlerList handlerList = new HandlerList(); - handlerList.addHandler( securityHandler ); - handlerList.addHandler( repoHandler ); - handlerList.addHandler( new DefaultHandler() ); + handlerList.addHandler(securityHandler); + handlerList.addHandler(repoHandler); + handlerList.addHandler(new DefaultHandler()); - server.setHandler( handlerList ); + server.setHandler(handlerList); server.start(); - if ( server.isFailed() ) - { - fail( "Couldn't bind the server socket to a free port!" ); + if (server.isFailed()) { + fail("Couldn't bind the server socket to a free port!"); } - port = ( (NetworkConnector) server.getConnectors()[0] ).getLocalPort(); - System.out.println( "Bound server socket to the port " + port ); + port = ((NetworkConnector) server.getConnectors()[0]).getLocalPort(); + System.out.println("Bound server socket to the port " + port); } @AfterEach - protected void tearDown() - throws Exception - { - if ( server != null ) - { + protected void tearDown() throws Exception { + if (server != null) { server.stop(); server.join(); } @@ -123,27 +112,25 @@ public class MavenITmng0553SettingsAuthzEncryptionTest * @throws Exception in case of failure */ @Test - public void testitBasic() - throws Exception - { - testDir = new File( testDir, "test-1" ); + public void testitBasic() throws Exception { + testDir = new File(testDir, "test-1"); Map filterProps = new HashMap<>(); - filterProps.put( "@port@", Integer.toString( port ) ); + filterProps.put("@port@", Integer.toString(port)); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng0553" ); - verifier.verifyArtifactNotPresent( "org.apache.maven.its.mng0553", "a", "0.1-SNAPSHOT", "jar" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps ); - setUserHome( verifier, new File( testDir, "userhome" ) ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng0553"); + verifier.verifyArtifactNotPresent("org.apache.maven.its.mng0553", "a", "0.1-SNAPSHOT", "jar"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8", filterProps); + setUserHome(verifier, new File(testDir, "userhome")); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng0553", "a", "0.1-SNAPSHOT", "jar" ); + verifier.verifyArtifactPresent("org.apache.maven.its.mng0553", "a", "0.1-SNAPSHOT", "jar"); } /** @@ -153,35 +140,37 @@ public class MavenITmng0553SettingsAuthzEncryptionTest * @throws Exception in case of failure */ @Test - public void testitRelocation() - throws Exception - { - testDir = new File( testDir, "test-2" ); + public void testitRelocation() throws Exception { + testDir = new File(testDir, "test-2"); Map filterProps = new HashMap<>(); - filterProps.put( "@port@", Integer.toString( port ) ); + filterProps.put("@port@", Integer.toString(port)); // NOTE: The upper-case scheme name is essential part of the test - String secUrl = "FILE://" + new File( testDir, "relocated-settings-security.xml" ).toURI().getRawPath(); - filterProps.put( "@relocation@", secUrl ); + String secUrl = "FILE://" + + new File(testDir, "relocated-settings-security.xml").toURI().getRawPath(); + filterProps.put("@relocation@", secUrl); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng0553" ); - verifier.verifyArtifactNotPresent( "org.apache.maven.its.mng0553", "a", "0.1-SNAPSHOT", "jar" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng0553"); + verifier.verifyArtifactNotPresent("org.apache.maven.its.mng0553", "a", "0.1-SNAPSHOT", "jar"); // NOTE: The tilde ~ in the file name is essential part of the test - verifier.filterFile( "security-template.xml", "settings~security.xml", "UTF-8", filterProps ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps ); + verifier.filterFile("security-template.xml", "settings~security.xml", "UTF-8", filterProps); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8", filterProps); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); // NOTE: The selection of the Turkish language for the JVM locale is essential part of the test - verifier.setEnvironmentVariable( "MAVEN_OPTS", "-Dsettings.security=" + new File( testDir, "settings~security.xml" ).getAbsolutePath() + " -Duser.language=tr" ); - verifier.addCliArgument( "validate" ); + verifier.setEnvironmentVariable( + "MAVEN_OPTS", + "-Dsettings.security=" + new File(testDir, "settings~security.xml").getAbsolutePath() + + " -Duser.language=tr"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng0553", "a", "0.1-SNAPSHOT", "jar" ); + verifier.verifyArtifactPresent("org.apache.maven.its.mng0553", "a", "0.1-SNAPSHOT", "jar"); } /** @@ -190,46 +179,41 @@ public class MavenITmng0553SettingsAuthzEncryptionTest * @throws Exception in case of failure */ @Test - public void testitEncryption() - throws Exception - { - requiresMavenVersion( "[2.1.0,3.0-alpha-1),[3.0-alpha-7,)" ); + public void testitEncryption() throws Exception { + requiresMavenVersion("[2.1.0,3.0-alpha-1),[3.0-alpha-7,)"); - testDir = new File( testDir, "test-3" ); + testDir = new File(testDir, "test-3"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - setUserHome( verifier, new File( testDir, "userhome" ) ); - verifier.addCliArgument( "--encrypt-master-password" ); - verifier.addCliArgument( "test" ); - verifier.setLogFileName( "log-emp.txt" ); - verifier.addCliArgument( "-e" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + setUserHome(verifier, new File(testDir, "userhome")); + verifier.addCliArgument("--encrypt-master-password"); + verifier.addCliArgument("test"); + verifier.setLogFileName("log-emp.txt"); + verifier.addCliArgument("-e"); verifier.execute(); verifier.verifyErrorFreeLog(); - List log = verifier.loadLines( verifier.getLogFileName(), null ); - assertNotNull( findPassword( log ) ); + List log = verifier.loadLines(verifier.getLogFileName(), null); + assertNotNull(findPassword(log)); - verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - setUserHome( verifier, new File( testDir, "userhome" ) ); - verifier.addCliArgument( "--encrypt-password" ); - verifier.addCliArgument( "testpass" ); - verifier.setLogFileName( "log-ep.txt" ); - verifier.addCliArgument( "-e" ); + verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + setUserHome(verifier, new File(testDir, "userhome")); + verifier.addCliArgument("--encrypt-password"); + verifier.addCliArgument("testpass"); + verifier.setLogFileName("log-ep.txt"); + verifier.addCliArgument("-e"); verifier.execute(); verifier.verifyErrorFreeLog(); - log = verifier.loadLines( verifier.getLogFileName(), null ); - assertNotNull( findPassword( log ) ); + log = verifier.loadLines(verifier.getLogFileName(), null); + assertNotNull(findPassword(log)); } - private String findPassword( List log ) - { - for ( String line : log ) - { - if ( line.matches( ".*\\{[A-Za-z0-9+/=]+\\}.*" ) ) - { + private String findPassword(List log) { + for (String line : log) { + if (line.matches(".*\\{[A-Za-z0-9+/=]+\\}.*")) { return line; } } @@ -237,17 +221,13 @@ public class MavenITmng0553SettingsAuthzEncryptionTest return null; } - private void setUserHome( Verifier verifier, File home ) - { + private void setUserHome(Verifier verifier, File home) { // NOTE: We set the user.home directory instead of say settings.security to reflect Maven's normal behavior String path = home.getAbsolutePath(); - if ( path.indexOf( ' ' ) < 0 ) - { - verifier.setEnvironmentVariable( "MAVEN_OPTS", "-Duser.home=" + path ); - } - else - { - verifier.setEnvironmentVariable( "MAVEN_OPTS", "\"-Duser.home=" + path + "\"" ); + if (path.indexOf(' ') < 0) { + verifier.setEnvironmentVariable("MAVEN_OPTS", "-Duser.home=" + path); + } else { + verifier.setEnvironmentVariable("MAVEN_OPTS", "\"-Duser.home=" + path + "\""); } } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0557UserSettingsCliOptionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0557UserSettingsCliOptionTest.java index 5851b33965..6f80474057 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0557UserSettingsCliOptionTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0557UserSettingsCliOptionTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,12 +30,9 @@ import org.junit.jupiter.api.Test; * @author John Casey * */ -public class MavenITmng0557UserSettingsCliOptionTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng0557UserSettingsCliOptionTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenITmng0557UserSettingsCliOptionTest extends AbstractMavenIntegrationTestCase { + public MavenITmng0557UserSettingsCliOptionTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -46,21 +41,18 @@ public class MavenITmng0557UserSettingsCliOptionTest * @throws Exception in case of failure */ @Test - public void testitMNG557() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-0557" ); + public void testitMNG557() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-0557"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "org.apache.maven.its.plugins:maven-it-plugin-touch:touch" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("org.apache.maven.its.plugins:maven-it-plugin-touch:touch"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/test.txt" ); + verifier.verifyFilePresent("target/test.txt"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0612NewestConflictResolverTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0612NewestConflictResolverTest.java index f2932b8d66..d0d0a69471 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0612NewestConflictResolverTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0612NewestConflictResolverTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; @@ -34,12 +32,9 @@ import org.junit.jupiter.api.Test; * */ @Disabled -public class MavenITmng0612NewestConflictResolverTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng0612NewestConflictResolverTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenITmng0612NewestConflictResolverTest extends AbstractMavenIntegrationTestCase { + public MavenITmng0612NewestConflictResolverTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -48,24 +43,22 @@ public class MavenITmng0612NewestConflictResolverTest * @throws Exception in case of failure */ @Test - public void testitMNG612() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-0612/dependency" ); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.addCliArgument( "install" ); + public void testitMNG612() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-0612/dependency"); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); - testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-0612/plugin" ); - verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.addCliArgument( "install" ); + testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-0612/plugin"); + verifier = newVerifier(testDir.getAbsolutePath()); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); - testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-0612/project" ); - verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.addCliArgument( "verify" ); + testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-0612/project"); + verifier = newVerifier(testDir.getAbsolutePath()); + verifier.addCliArgument("verify"); verifier.execute(); verifier.verifyErrorFreeLog(); } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0666IgnoreLegacyPomTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0666IgnoreLegacyPomTest.java index 821a80b988..dfc9b2c90d 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0666IgnoreLegacyPomTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0666IgnoreLegacyPomTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,12 +31,9 @@ import org.junit.jupiter.api.Test; * @author John Casey * */ -public class MavenITmng0666IgnoreLegacyPomTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng0666IgnoreLegacyPomTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenITmng0666IgnoreLegacyPomTest extends AbstractMavenIntegrationTestCase { + public MavenITmng0666IgnoreLegacyPomTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -48,26 +43,23 @@ public class MavenITmng0666IgnoreLegacyPomTest * @throws Exception in case of failure */ @Test - public void testitMNG666() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-0666" ); + public void testitMNG666() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-0666"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.it0059" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.it0059"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); // don't verify error free log - verifier.verifyArtifactPresent( "org.apache.maven.its.it0059", "test", "3.8.1", "jar" ); + verifier.verifyArtifactPresent("org.apache.maven.its.it0059", "test", "3.8.1", "jar"); - List artifacts = verifier.loadLines( "target/artifacts.txt", "UTF-8" ); - assertTrue( artifacts.toString(), artifacts.contains( "org.apache.maven.its.it0059:test:jar:3.8.1" ) ); + List artifacts = verifier.loadLines("target/artifacts.txt", "UTF-8"); + assertTrue(artifacts.toString(), artifacts.contains("org.apache.maven.its.it0059:test:jar:3.8.1")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0674PluginParameterAliasTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0674PluginParameterAliasTest.java index 9f1a4d0514..68c478045a 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0674PluginParameterAliasTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0674PluginParameterAliasTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -34,13 +32,10 @@ import org.junit.jupiter.api.Test; * @author John Casey * */ -public class MavenITmng0674PluginParameterAliasTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng0674PluginParameterAliasTest extends AbstractMavenIntegrationTestCase { - public MavenITmng0674PluginParameterAliasTest() - { - super( "[3.0,)" ); + public MavenITmng0674PluginParameterAliasTest() { + super("[3.0,)"); } /** @@ -49,23 +44,21 @@ public class MavenITmng0674PluginParameterAliasTest * @throws Exception in case of failure */ @Test - public void testitLifecycle() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-0674" ); + public void testitLifecycle() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-0674"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.setLogFileName( "log-lifecycle.txt" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.setLogFileName("log-lifecycle.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/config.properties" ); - assertEquals( "MNG-674-1", props.getProperty( "aliasParam" ) ); - assertEquals( "MNG-674-2", props.getProperty( "aliasDefaultExpressionParam" ) ); - assertEquals( "MNG-4997", props.getProperty( "aliasStringParams.0" ) ); + Properties props = verifier.loadProperties("target/config.properties"); + assertEquals("MNG-674-1", props.getProperty("aliasParam")); + assertEquals("MNG-674-2", props.getProperty("aliasDefaultExpressionParam")); + assertEquals("MNG-4997", props.getProperty("aliasStringParams.0")); } /** @@ -74,23 +67,20 @@ public class MavenITmng0674PluginParameterAliasTest * @throws Exception in case of failure */ @Test - public void testitCli() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-0674" ); + public void testitCli() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-0674"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.setLogFileName( "log-cli.txt" ); - verifier.addCliArgument( "org.apache.maven.its.plugins:maven-it-plugin-configuration:config" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.setLogFileName("log-cli.txt"); + verifier.addCliArgument("org.apache.maven.its.plugins:maven-it-plugin-configuration:config"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/config.properties" ); - assertEquals( "MNG-674-1", props.getProperty( "aliasParam" ) ); - assertEquals( "MNG-674-2", props.getProperty( "aliasDefaultExpressionParam" ) ); - assertEquals( "MNG-4997", props.getProperty( "aliasStringParams.0" ) ); + Properties props = verifier.loadProperties("target/config.properties"); + assertEquals("MNG-674-1", props.getProperty("aliasParam")); + assertEquals("MNG-674-2", props.getProperty("aliasDefaultExpressionParam")); + assertEquals("MNG-4997", props.getProperty("aliasStringParams.0")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0680ParentBasedirTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0680ParentBasedirTest.java index d1c5ae14b8..15373739b2 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0680ParentBasedirTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0680ParentBasedirTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,12 +31,9 @@ import org.junit.jupiter.api.Test; * @author Brett Porter * */ -public class MavenITmng0680ParentBasedirTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng0680ParentBasedirTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenITmng0680ParentBasedirTest extends AbstractMavenIntegrationTestCase { + public MavenITmng0680ParentBasedirTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -47,25 +42,22 @@ public class MavenITmng0680ParentBasedirTest * @throws Exception in case of failure */ @Test - public void testitMNG680() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-0680" ); + public void testitMNG680() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-0680"); testDir = testDir.getCanonicalFile(); - File subDir = new File( testDir, "subproject" ); + File subDir = new File(testDir, "subproject"); - Verifier verifier = newVerifier( subDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(subDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/basedir.properties" ); - assertEquals( subDir, new File( props.getProperty( "project.basedir" ) ) ); - assertEquals( testDir, new File( props.getProperty( "project.parent.basedir" ) ) ); + Properties props = verifier.loadProperties("target/basedir.properties"); + assertEquals(subDir, new File(props.getProperty("project.basedir"))); + assertEquals(testDir, new File(props.getProperty("project.parent.basedir"))); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0761MissingSnapshotDistRepoTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0761MissingSnapshotDistRepoTest.java index 6bcd09d9b3..78cbe1bcc8 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0761MissingSnapshotDistRepoTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0761MissingSnapshotDistRepoTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * @author Brett Porter * */ -public class MavenITmng0761MissingSnapshotDistRepoTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng0761MissingSnapshotDistRepoTest extends AbstractMavenIntegrationTestCase { - public MavenITmng0761MissingSnapshotDistRepoTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng0761MissingSnapshotDistRepoTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -48,20 +43,17 @@ public class MavenITmng0761MissingSnapshotDistRepoTest * @throws Exception in case of failure */ @Test - public void testitMNG761() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-0761" ); + public void testitMNG761() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-0761"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng0761" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng0761"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/repo/org/apache/maven/its/mng0761/test/1.0-SNAPSHOT/test-1.0-*.jar" ); + verifier.verifyFilePresent("target/repo/org/apache/maven/its/mng0761/test/1.0-SNAPSHOT/test-1.0-*.jar"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0768OfflineModeTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0768OfflineModeTest.java index 64e97218e2..339fd6d38c 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0768OfflineModeTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0768OfflineModeTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,10 +16,7 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -34,6 +29,9 @@ import java.util.Collections; import java.util.List; import java.util.Properties; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.eclipse.jetty.server.Handler; import org.eclipse.jetty.server.NetworkConnector; import org.eclipse.jetty.server.Request; @@ -47,13 +45,10 @@ import org.junit.jupiter.api.Test; * @author John Casey * */ -public class MavenITmng0768OfflineModeTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng0768OfflineModeTest extends AbstractMavenIntegrationTestCase { - public MavenITmng0768OfflineModeTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng0768OfflineModeTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -62,77 +57,68 @@ public class MavenITmng0768OfflineModeTest * @throws Exception in case of failure */ @Test - public void testitMNG768() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-0768" ); + public void testitMNG768() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-0768"); - final List requestedUris = Collections.synchronizedList( new ArrayList() ); + final List requestedUris = Collections.synchronizedList(new ArrayList()); - Handler repoHandler = new AbstractHandler() - { - public void handle( String target, Request baseRequest, HttpServletRequest request, - HttpServletResponse response ) - throws IOException - { - System.out.println( "Handling " + request.getMethod() + " " + request.getRequestURL() ); + Handler repoHandler = new AbstractHandler() { + public void handle( + String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) + throws IOException { + System.out.println("Handling " + request.getMethod() + " " + request.getRequestURL()); - requestedUris.add( request.getRequestURI() ); + requestedUris.add(request.getRequestURI()); PrintWriter writer = response.getWriter(); - response.setStatus( HttpServletResponse.SC_OK ); + response.setStatus(HttpServletResponse.SC_OK); - if ( request.getRequestURI().endsWith( ".pom" ) ) - { - writer.println( "" ); - writer.println( " 4.0.0" ); - writer.println( " org.apache.maven.its.mng0768" ); - writer.println( " dep" ); - writer.println( " 0.1" ); - writer.println( "" ); - } - else if ( request.getRequestURI().endsWith( ".jar" ) ) - { - writer.println( "empty" ); - } - else if ( request.getRequestURI().endsWith( ".md5" ) || request.getRequestURI().endsWith( ".sha1" ) ) - { - response.setStatus( HttpServletResponse.SC_NOT_FOUND ); + if (request.getRequestURI().endsWith(".pom")) { + writer.println(""); + writer.println(" 4.0.0"); + writer.println(" org.apache.maven.its.mng0768"); + writer.println(" dep"); + writer.println(" 0.1"); + writer.println(""); + } else if (request.getRequestURI().endsWith(".jar")) { + writer.println("empty"); + } else if (request.getRequestURI().endsWith(".md5") + || request.getRequestURI().endsWith(".sha1")) { + response.setStatus(HttpServletResponse.SC_NOT_FOUND); } - ( (Request) request ).setHandled( true ); + ((Request) request).setHandled(true); } }; - Server server = new Server( 0 ); - server.setHandler( repoHandler ); + Server server = new Server(0); + server.setHandler(repoHandler); - try - { + try { server.start(); - if ( server.isFailed() ) - { - fail( "Couldn't bind the server socket to a free port!" ); + if (server.isFailed()) { + fail("Couldn't bind the server socket to a free port!"); } - int port = ( (NetworkConnector) server.getConnectors()[0] ).getLocalPort(); + int port = ((NetworkConnector) server.getConnectors()[0]).getLocalPort(); { // phase 1: run build in online mode to fill local repo - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng0768" ); - verifier.setLogFileName( "log1.txt" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng0768"); + verifier.setLogFileName("log1.txt"); Properties props = new Properties(); - props.put( "@port@", Integer.toString( port ) ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", props ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "org.apache.maven.its.plugins:maven-it-plugin-dependency-resolution:2.1-SNAPSHOT:compile" ); + props.put("@port@", Integer.toString(port)); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8", props); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument( + "org.apache.maven.its.plugins:maven-it-plugin-dependency-resolution:2.1-SNAPSHOT:compile"); verifier.execute(); - verifier.verifyFilePresent( "target/compile.txt" ); + verifier.verifyFilePresent("target/compile.txt"); verifier.verifyErrorFreeLog(); } @@ -140,51 +126,48 @@ public class MavenITmng0768OfflineModeTest { // phase 2: run build in offline mode to check it still passes, without network accesses - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "-o" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.setLogFileName( "log2.txt" ); - verifier.addCliArgument( "org.apache.maven.its.plugins:maven-it-plugin-dependency-resolution:2.1-SNAPSHOT:compile" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("-o"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.setLogFileName("log2.txt"); + verifier.addCliArgument( + "org.apache.maven.its.plugins:maven-it-plugin-dependency-resolution:2.1-SNAPSHOT:compile"); verifier.execute(); - verifier.verifyFilePresent( "target/compile.txt" ); + verifier.verifyFilePresent("target/compile.txt"); verifier.verifyErrorFreeLog(); } - assertTrue( requestedUris.toString(), requestedUris.isEmpty() ); + assertTrue(requestedUris.toString(), requestedUris.isEmpty()); { // phase 3: delete test artifact and run build in offline mode to check it fails now // NOTE: Adding the settings again to offer Maven the bad choice of using the remote repo - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng0768" ); - verifier.addCliArgument( "-o" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.setLogFileName( "log3.txt" ); - try - { - verifier.addCliArgument( "org.apache.maven.its.plugins:maven-it-plugin-dependency-resolution:2.1-SNAPSHOT:compile" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng0768"); + verifier.addCliArgument("-o"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.setLogFileName("log3.txt"); + try { + verifier.addCliArgument( + "org.apache.maven.its.plugins:maven-it-plugin-dependency-resolution:2.1-SNAPSHOT:compile"); verifier.execute(); verifier.verifyErrorFreeLog(); - fail( "Build did not fail to resolve missing dependency although Maven ought to work offline!" ); - } - catch( VerificationException e ) - { + fail("Build did not fail to resolve missing dependency although Maven ought to work offline!"); + } catch (VerificationException e) { // expected, should fail } } - System.out.println( "Bound server socket to the port " + port ); + System.out.println("Bound server socket to the port " + port); - assertTrue( requestedUris.toString(), requestedUris.isEmpty() ); - } - finally - { + assertTrue(requestedUris.toString(), requestedUris.isEmpty()); + } finally { server.stop(); server.join(); } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0773SettingsProfileReactorPollutionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0773SettingsProfileReactorPollutionTest.java index c8bd3acada..70380b77ff 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0773SettingsProfileReactorPollutionTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0773SettingsProfileReactorPollutionTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,12 +30,9 @@ import org.junit.jupiter.api.Test; * @author John Casey * */ -public class MavenITmng0773SettingsProfileReactorPollutionTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng0773SettingsProfileReactorPollutionTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenITmng0773SettingsProfileReactorPollutionTest extends AbstractMavenIntegrationTestCase { + public MavenITmng0773SettingsProfileReactorPollutionTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -46,18 +41,15 @@ public class MavenITmng0773SettingsProfileReactorPollutionTest * @throws Exception in case of failure */ @Test - public void testitMNG773() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-0773" ); + public void testitMNG773() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-0773"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0781PluginConfigVsExecConfigTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0781PluginConfigVsExecConfigTest.java index f5ea72bb9c..5f710a1f52 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0781PluginConfigVsExecConfigTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0781PluginConfigVsExecConfigTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,12 +30,9 @@ import org.junit.jupiter.api.Test; * @author John Casey * */ -public class MavenITmng0781PluginConfigVsExecConfigTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng0781PluginConfigVsExecConfigTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenITmng0781PluginConfigVsExecConfigTest extends AbstractMavenIntegrationTestCase { + public MavenITmng0781PluginConfigVsExecConfigTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -47,20 +42,17 @@ public class MavenITmng0781PluginConfigVsExecConfigTest * @throws Exception in case of failure */ @Test - public void testitMNG0781() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-0781" ); + public void testitMNG0781() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-0781"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "process-resources" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("process-resources"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/exec-level.txt" ); - verifier.verifyFilePresent( "target/resources-resources.txt" ); + verifier.verifyFilePresent("target/exec-level.txt"); + verifier.verifyFilePresent("target/resources-resources.txt"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0786ProfileAwareReactorTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0786ProfileAwareReactorTest.java index bdd033a8c6..42bbf9525e 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0786ProfileAwareReactorTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0786ProfileAwareReactorTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,12 +30,9 @@ import org.junit.jupiter.api.Test; * @author John Casey * */ -public class MavenITmng0786ProfileAwareReactorTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng0786ProfileAwareReactorTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenITmng0786ProfileAwareReactorTest extends AbstractMavenIntegrationTestCase { + public MavenITmng0786ProfileAwareReactorTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -47,22 +42,19 @@ public class MavenITmng0786ProfileAwareReactorTest * @throws Exception in case of failure */ @Test - public void testitMNG0786() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-0786" ); + public void testitMNG0786() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-0786"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "sub1/target" ); - verifier.deleteDirectory( "sub2/target" ); - verifier.addCliArgument( "-Dexpression.outputFile=target/expression.properties" ); - verifier.addCliArgument( "-Dactivate=anything" ); - verifier.addCliArgument( "org.apache.maven.its.plugins:maven-it-plugin-expression:2.1-SNAPSHOT:eval" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("sub1/target"); + verifier.deleteDirectory("sub2/target"); + verifier.addCliArgument("-Dexpression.outputFile=target/expression.properties"); + verifier.addCliArgument("-Dactivate=anything"); + verifier.addCliArgument("org.apache.maven.its.plugins:maven-it-plugin-expression:2.1-SNAPSHOT:eval"); verifier.execute(); - verifier.verifyFilePresent( "sub1/target/expression.properties" ); - verifier.verifyFilePresent( "sub2/target/expression.properties" ); + verifier.verifyFilePresent("sub1/target/expression.properties"); + verifier.verifyFilePresent("sub2/target/expression.properties"); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0814ExplicitProfileActivationTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0814ExplicitProfileActivationTest.java index da16bfb443..77d54f0cd6 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0814ExplicitProfileActivationTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0814ExplicitProfileActivationTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,12 +31,9 @@ import org.junit.jupiter.api.Test; * @author John Casey * */ -public class MavenITmng0814ExplicitProfileActivationTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng0814ExplicitProfileActivationTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenITmng0814ExplicitProfileActivationTest extends AbstractMavenIntegrationTestCase { + public MavenITmng0814ExplicitProfileActivationTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -47,22 +42,19 @@ public class MavenITmng0814ExplicitProfileActivationTest * @throws Exception in case of failure */ @Test - public void testitMNG814() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-0814" ); + public void testitMNG814() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-0814"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "-P" ); - verifier.addCliArgument( "test-profile" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("-P"); + verifier.addCliArgument("test-profile"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/profile.properties" ); - assertEquals( "PASSED", props.getProperty( "project.properties.testProp" ) ); + Properties props = verifier.loadProperties("target/profile.properties"); + assertEquals("PASSED", props.getProperty("project.properties.testProp")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0818WarDepsNotTransitiveTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0818WarDepsNotTransitiveTest.java index cb3d9f7133..95faf9af0e 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0818WarDepsNotTransitiveTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0818WarDepsNotTransitiveTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Collection; import java.util.Collections; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -34,12 +32,9 @@ import org.junit.jupiter.api.Test; * @author Brett Porter * */ -public class MavenITmng0818WarDepsNotTransitiveTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng0818WarDepsNotTransitiveTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenITmng0818WarDepsNotTransitiveTest extends AbstractMavenIntegrationTestCase { + public MavenITmng0818WarDepsNotTransitiveTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -48,24 +43,21 @@ public class MavenITmng0818WarDepsNotTransitiveTest * @throws Exception in case of failure */ @Test - public void testitMNG0818() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-0818" ); + public void testitMNG0818() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-0818"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.it0080" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.it0080"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Collection artifacts = verifier.loadLines( "target/artifacts.txt", "UTF-8" ); - assertEquals( Collections.singletonList( "org.apache.maven.its.it0080:war:war:0.1" ), artifacts ); + Collection artifacts = verifier.loadLines("target/artifacts.txt", "UTF-8"); + assertEquals(Collections.singletonList("org.apache.maven.its.it0080:war:war:0.1"), artifacts); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0820ConflictResolutionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0820ConflictResolutionTest.java index 37747b4cad..42f798a83c 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0820ConflictResolutionTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0820ConflictResolutionTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Collection; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,12 +31,9 @@ import org.junit.jupiter.api.Test; * @author Brett Porter * */ -public class MavenITmng0820ConflictResolutionTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng0820ConflictResolutionTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenITmng0820ConflictResolutionTest extends AbstractMavenIntegrationTestCase { + public MavenITmng0820ConflictResolutionTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -47,28 +42,25 @@ public class MavenITmng0820ConflictResolutionTest * @throws Exception in case of failure */ @Test - public void testitMNG0820() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-0820" ); + public void testitMNG0820() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-0820"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng0820" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng0820"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Collection artifacts = verifier.loadLines( "target/artifacts.txt", "UTF-8" ); - assertEquals( 3, artifacts.size() ); - assertTrue( artifacts.toString(), artifacts.contains( "org.apache.maven.its.mng0820:d:jar:2.0" ) ); - assertTrue( artifacts.toString(), artifacts.contains( "org.apache.maven.its.mng0820:c:jar:1.4" ) ); - assertTrue( artifacts.toString(), artifacts.contains( "org.apache.maven.its.mng0820:a:jar:1.0" ) ); - assertFalse( artifacts.toString(), artifacts.contains( "org.apache.maven.its.mng0505:b:jar:1.0" ) ); + Collection artifacts = verifier.loadLines("target/artifacts.txt", "UTF-8"); + assertEquals(3, artifacts.size()); + assertTrue(artifacts.toString(), artifacts.contains("org.apache.maven.its.mng0820:d:jar:2.0")); + assertTrue(artifacts.toString(), artifacts.contains("org.apache.maven.its.mng0820:c:jar:1.4")); + assertTrue(artifacts.toString(), artifacts.contains("org.apache.maven.its.mng0820:a:jar:1.0")); + assertFalse(artifacts.toString(), artifacts.contains("org.apache.maven.its.mng0505:b:jar:1.0")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0823MojoContextPassingTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0823MojoContextPassingTest.java index 9f437851c7..be446da280 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0823MojoContextPassingTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0823MojoContextPassingTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; -import java.util.Arrays; -import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -34,12 +30,9 @@ import org.junit.jupiter.api.Test; * @author John Casey * */ -public class MavenITmng0823MojoContextPassingTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng0823MojoContextPassingTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenITmng0823MojoContextPassingTest extends AbstractMavenIntegrationTestCase { + public MavenITmng0823MojoContextPassingTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -48,19 +41,17 @@ public class MavenITmng0823MojoContextPassingTest * @throws Exception in case of failure */ @Test - public void testitMNG0823() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-0823" ); + public void testitMNG0823() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-0823"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArguments( "org.apache.maven.its.plugins:maven-it-plugin-context-passing:throw", - "org.apache.maven.its.plugins:maven-it-plugin-context-passing:catch" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArguments( + "org.apache.maven.its.plugins:maven-it-plugin-context-passing:throw", + "org.apache.maven.its.plugins:maven-it-plugin-context-passing:catch"); verifier.execute(); - verifier.verifyFilePresent( "target/thrown-value" ); + verifier.verifyFilePresent("target/thrown-value"); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0828PluginConfigValuesInDebugTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0828PluginConfigValuesInDebugTest.java index c643cc3242..f5b0438686 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0828PluginConfigValuesInDebugTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0828PluginConfigValuesInDebugTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,9 +16,7 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.text.SimpleDateFormat; @@ -28,6 +24,8 @@ import java.util.Date; import java.util.Locale; import org.apache.maven.shared.utils.io.FileUtils; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -35,15 +33,12 @@ import org.junit.jupiter.api.Test; * * @author Slawomir Jaranowski */ -public class MavenITmng0828PluginConfigValuesInDebugTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng0828PluginConfigValuesInDebugTest extends AbstractMavenIntegrationTestCase { private static final String NL = System.lineSeparator(); - public MavenITmng0828PluginConfigValuesInDebugTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng0828PluginConfigValuesInDebugTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -52,70 +47,70 @@ public class MavenITmng0828PluginConfigValuesInDebugTest * @throws Exception in case of failure */ @Test - public void testitMNG0828() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-0828" ); + public void testitMNG0828() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-0828"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "-X" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("-X"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - String log = FileUtils.fileRead( new File( verifier.getBasedir(), verifier.getLogFileName() ) ); + String log = FileUtils.fileRead(new File(verifier.getBasedir(), verifier.getLogFileName())); - checkLog( log, "[DEBUG] (f) aliasDefaultExpressionParam = test" ); - checkLog( log, "[DEBUG] (f) basedir = " + testDir.getCanonicalPath() ); - checkLog( log, - "[DEBUG] (f) beanParam = org.apache.maven.plugin.coreit.Bean[fieldParam=field, setterParam=setter, setterCalled=true]" ); - checkLog( log, "[DEBUG] (f) booleanParam = true" ); - checkLog( log, "[DEBUG] (f) byteParam = 42" ); - checkLog( log, "[DEBUG] (f) byteParam = 42" ); - checkLog( log, "[DEBUG] (f) characterParam = X" ); + checkLog(log, "[DEBUG] (f) aliasDefaultExpressionParam = test"); + checkLog(log, "[DEBUG] (f) basedir = " + testDir.getCanonicalPath()); + checkLog( + log, + "[DEBUG] (f) beanParam = org.apache.maven.plugin.coreit.Bean[fieldParam=field, setterParam=setter, setterCalled=true]"); + checkLog(log, "[DEBUG] (f) booleanParam = true"); + checkLog(log, "[DEBUG] (f) byteParam = 42"); + checkLog(log, "[DEBUG] (f) byteParam = 42"); + checkLog(log, "[DEBUG] (f) characterParam = X"); - Date date = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss.S a", Locale.US ).parse( "2008-11-09 11:59:03.0 AM" ); - checkLog( log, "[DEBUG] (f) dateParam = " + date ); + Date date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S a", Locale.US).parse("2008-11-09 11:59:03.0 AM"); + checkLog(log, "[DEBUG] (f) dateParam = " + date); - checkLog( log, "[DEBUG] (f) defaultParam = maven-core-it" ); - checkLog( log, "[DEBUG] (f) defaultParamWithExpression = org.apache.maven.its.mng0828:test1:1.0-SNAPSHOT" ); + checkLog(log, "[DEBUG] (f) defaultParam = maven-core-it"); + checkLog(log, "[DEBUG] (f) defaultParamWithExpression = org.apache.maven.its.mng0828:test1:1.0-SNAPSHOT"); // new line of dumping dom is not guaranteed, but all items should be present - checkLog( log, "[DEBUG] (f) domParam = one" ); - checkLog( log, "two" ); - checkLog( log, "three" ); - checkLog( log, "four" ); - checkLog( log, "" ); + checkLog(log, "[DEBUG] (f) domParam = one"); + checkLog(log, "two"); + checkLog(log, "three"); + checkLog(log, "four"); + checkLog(log, ""); - checkLog( log, "[DEBUG] (f) doubleParam = -1.5" ); - checkLog( log, "[DEBUG] (f) fieldParam = field" ); - checkLog( log, "[DEBUG] (f) fileParam = " + new File( testDir, "pom.xml" ).getCanonicalPath() ); - checkLog( log, "[DEBUG] (f) floatParam = 0.0" ); - checkLog( log, "[DEBUG] (f) integerParam = 0" ); - checkLog( log, "[DEBUG] (f) listParam = [one, two, three, four]" ); - checkLog( log, "[DEBUG] (f) longParam = 9876543210" ); + checkLog(log, "[DEBUG] (f) doubleParam = -1.5"); + checkLog(log, "[DEBUG] (f) fieldParam = field"); + checkLog(log, "[DEBUG] (f) fileParam = " + new File(testDir, "pom.xml").getCanonicalPath()); + checkLog(log, "[DEBUG] (f) floatParam = 0.0"); + checkLog(log, "[DEBUG] (f) integerParam = 0"); + checkLog(log, "[DEBUG] (f) listParam = [one, two, three, four]"); + checkLog(log, "[DEBUG] (f) longParam = 9876543210"); // Map items order is not guaranteed, so only check begin of params ... - checkLog( log, "[DEBUG] (f) mapParam = {key" ); - checkLog( log, "[DEBUG] (f) propertiesFile = " - + new File( testDir, "target/plugin-config.properties" ).getCanonicalPath() ); + checkLog(log, "[DEBUG] (f) mapParam = {key"); + checkLog( + log, + "[DEBUG] (f) propertiesFile = " + + new File(testDir, "target/plugin-config.properties").getCanonicalPath()); // Properties item order is not guaranteed, so only check begin of params ... - checkLog( log, "[DEBUG] (f) propertiesParam = {key" ); - checkLog( log, "[DEBUG] (f) setParam = [item]" ); - checkLog( log, "[DEBUG] (f) shortParam = -12345" ); - checkLog( log, "[DEBUG] (f) stringParam = Hello World!" ); - checkLog( log, "[DEBUG] (f) stringParams = [one, two, three, four]" ); - checkLog( log, "[DEBUG] (f) urlParam = http://maven.apache.org/" ); - checkLog( log, "[DEBUG] (s) setterParam = setter" ); + checkLog(log, "[DEBUG] (f) propertiesParam = {key"); + checkLog(log, "[DEBUG] (f) setParam = [item]"); + checkLog(log, "[DEBUG] (f) shortParam = -12345"); + checkLog(log, "[DEBUG] (f) stringParam = Hello World!"); + checkLog(log, "[DEBUG] (f) stringParams = [one, two, three, four]"); + checkLog(log, "[DEBUG] (f) urlParam = http://maven.apache.org/"); + checkLog(log, "[DEBUG] (s) setterParam = setter"); } - private void checkLog( String log, String expected ) - { - assertTrue( NL + ">>>" + NL + log + "<<<" + NL + NL + "does not contains: " + NL + expected + NL, - log.contains( expected ) ); + private void checkLog(String log, String expected) { + assertTrue( + NL + ">>>" + NL + log + "<<<" + NL + NL + "does not contains: " + NL + expected + NL, + log.contains(expected)); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0836PluginParentResolutionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0836PluginParentResolutionTest.java index 1ecfd44321..fc9e9f2f83 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0836PluginParentResolutionTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0836PluginParentResolutionTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,12 +31,9 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng0836PluginParentResolutionTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng0836PluginParentResolutionTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenITmng0836PluginParentResolutionTest extends AbstractMavenIntegrationTestCase { + public MavenITmng0836PluginParentResolutionTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -49,39 +44,30 @@ public class MavenITmng0836PluginParentResolutionTest * @throws Exception in case of failure */ @Test - public void testitMNG836() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-0836" ); + public void testitMNG836() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-0836"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng836" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng836"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); // Maven 3.x aims to separate plugins and project dependencies (MNG-4191) - if ( matchesVersionRange( "(,3.0-alpha-1),(3.0-alpha-1,3.0-alpha-7)" ) ) - { - verifier.addCliArgument( "validate" ); + if (matchesVersionRange("(,3.0-alpha-1),(3.0-alpha-1,3.0-alpha-7)")) { + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - } - else - { - try - { - verifier.addCliArgument( "validate" ); + } else { + try { + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - fail( "Plugin parent POM was erroneously resolved from non-plugin repository." ); - } - catch ( VerificationException e ) - { + fail("Plugin parent POM was erroneously resolved from non-plugin repository."); + } catch (VerificationException e) { // expected } } } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0848UserPropertyOverridesDefaultValueTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0848UserPropertyOverridesDefaultValueTest.java index 4571665de0..8cb8f49128 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0848UserPropertyOverridesDefaultValueTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0848UserPropertyOverridesDefaultValueTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng0848UserPropertyOverridesDefaultValueTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng0848UserPropertyOverridesDefaultValueTest extends AbstractMavenIntegrationTestCase { - public MavenITmng0848UserPropertyOverridesDefaultValueTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng0848UserPropertyOverridesDefaultValueTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -48,22 +43,19 @@ public class MavenITmng0848UserPropertyOverridesDefaultValueTest * @throws Exception in case of failure */ @Test - public void testitMNG848() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-0848" ); + public void testitMNG848() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-0848"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "-Dconfig.aliasDefaultExpressionParam=PASSED" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("-Dconfig.aliasDefaultExpressionParam=PASSED"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties configProps = verifier.loadProperties( "target/config.properties" ); - assertEquals( "maven-core-it", configProps.getProperty( "defaultParam" ) ); - assertEquals( "PASSED", configProps.getProperty( "aliasDefaultExpressionParam" ) ); + Properties configProps = verifier.loadProperties("target/config.properties"); + assertEquals("maven-core-it", configProps.getProperty("defaultParam")); + assertEquals("PASSED", configProps.getProperty("aliasDefaultExpressionParam")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0866EvaluateDefaultValueTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0866EvaluateDefaultValueTest.java index 0ec4e5d3b2..562c6412b3 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0866EvaluateDefaultValueTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0866EvaluateDefaultValueTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -34,13 +32,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng0866EvaluateDefaultValueTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng0866EvaluateDefaultValueTest extends AbstractMavenIntegrationTestCase { - public MavenITmng0866EvaluateDefaultValueTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng0866EvaluateDefaultValueTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -49,21 +44,20 @@ public class MavenITmng0866EvaluateDefaultValueTest * @throws Exception in case of failure */ @Test - public void testitMNG866() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-0866" ); + public void testitMNG866() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-0866"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties configProps = verifier.loadProperties( "target/config.properties" ); - assertEquals( "maven-core-it", configProps.getProperty( "defaultParam" ) ); - assertEquals( "org.apache.maven.its.mng0866:test:1.0-SNAPSHOT", configProps.getProperty( "defaultParamWithExpression" ) ); + Properties configProps = verifier.loadProperties("target/config.properties"); + assertEquals("maven-core-it", configProps.getProperty("defaultParam")); + assertEquals( + "org.apache.maven.its.mng0866:test:1.0-SNAPSHOT", + configProps.getProperty("defaultParamWithExpression")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0870ReactorAwarePluginDiscoveryTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0870ReactorAwarePluginDiscoveryTest.java index 4184e44778..522d9a0150 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0870ReactorAwarePluginDiscoveryTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0870ReactorAwarePluginDiscoveryTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng0870ReactorAwarePluginDiscoveryTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng0870ReactorAwarePluginDiscoveryTest extends AbstractMavenIntegrationTestCase { - public MavenITmng0870ReactorAwarePluginDiscoveryTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng0870ReactorAwarePluginDiscoveryTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -48,23 +43,20 @@ public class MavenITmng0870ReactorAwarePluginDiscoveryTest * @throws Exception in case of failure */ @Test - public void testitMNG0870() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-0870" ); + public void testitMNG0870() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-0870"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "project/target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng0870" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "initialize" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("project/target"); + verifier.deleteArtifacts("org.apache.maven.its.mng0870"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("initialize"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "project/target/touch.txt" ); + verifier.verifyFilePresent("project/target/touch.txt"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0947OptionalDependencyTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0947OptionalDependencyTest.java index 032791dc19..de5509ab05 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0947OptionalDependencyTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0947OptionalDependencyTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng0947OptionalDependencyTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng0947OptionalDependencyTest extends AbstractMavenIntegrationTestCase { - public MavenITmng0947OptionalDependencyTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng0947OptionalDependencyTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -48,40 +43,37 @@ public class MavenITmng0947OptionalDependencyTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - failingMavenVersions( "(,3.1.0-alpha-1)" ); + public void testit() throws Exception { + failingMavenVersions("(,3.1.0-alpha-1)"); - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-0947" ); + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-0947"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng0947" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng0947"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List compile = verifier.loadLines( "target/compile.txt", "UTF-8" ); - assertTrue( compile.toString(), compile.contains( "org.apache.maven.its.mng0947:d:jar:0.1 (optional)" ) ); - assertTrue( compile.toString(), compile.contains( "org.apache.maven.its.mng0947:e:jar:0.1 (optional)" ) ); - assertEquals( 2, compile.size() ); + List compile = verifier.loadLines("target/compile.txt", "UTF-8"); + assertTrue(compile.toString(), compile.contains("org.apache.maven.its.mng0947:d:jar:0.1 (optional)")); + assertTrue(compile.toString(), compile.contains("org.apache.maven.its.mng0947:e:jar:0.1 (optional)")); + assertEquals(2, compile.size()); - List runtime = verifier.loadLines( "target/runtime.txt", "UTF-8" ); - assertTrue( runtime.toString(), runtime.contains( "org.apache.maven.its.mng0947:c:jar:0.1" ) ); - assertTrue( runtime.toString(), runtime.contains( "org.apache.maven.its.mng0947:d:jar:0.1 (optional)" ) ); - assertTrue( runtime.toString(), runtime.contains( "org.apache.maven.its.mng0947:e:jar:0.1 (optional)" ) ); - assertEquals( 3, runtime.size() ); + List runtime = verifier.loadLines("target/runtime.txt", "UTF-8"); + assertTrue(runtime.toString(), runtime.contains("org.apache.maven.its.mng0947:c:jar:0.1")); + assertTrue(runtime.toString(), runtime.contains("org.apache.maven.its.mng0947:d:jar:0.1 (optional)")); + assertTrue(runtime.toString(), runtime.contains("org.apache.maven.its.mng0947:e:jar:0.1 (optional)")); + assertEquals(3, runtime.size()); - List test = verifier.loadLines( "target/test.txt", "UTF-8" ); - assertTrue( test.toString(), test.contains( "org.apache.maven.its.mng0947:c:jar:0.1" ) ); - assertTrue( test.toString(), test.contains( "org.apache.maven.its.mng0947:d:jar:0.1 (optional)" ) ); - assertTrue( test.toString(), test.contains( "org.apache.maven.its.mng0947:e:jar:0.1 (optional)" ) ); - assertEquals( 3, test.size() ); + List test = verifier.loadLines("target/test.txt", "UTF-8"); + assertTrue(test.toString(), test.contains("org.apache.maven.its.mng0947:c:jar:0.1")); + assertTrue(test.toString(), test.contains("org.apache.maven.its.mng0947:d:jar:0.1 (optional)")); + assertTrue(test.toString(), test.contains("org.apache.maven.its.mng0947:e:jar:0.1 (optional)")); + assertEquals(3, test.size()); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0956ComponentInjectionViaProjectLevelPluginDepTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0956ComponentInjectionViaProjectLevelPluginDepTest.java index 7780bee6c8..fcbe0fc872 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0956ComponentInjectionViaProjectLevelPluginDepTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0956ComponentInjectionViaProjectLevelPluginDepTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,12 +31,9 @@ import org.junit.jupiter.api.Test; * @author Brett Porter * */ -public class MavenITmng0956ComponentInjectionViaProjectLevelPluginDepTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng0956ComponentInjectionViaProjectLevelPluginDepTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenITmng0956ComponentInjectionViaProjectLevelPluginDepTest extends AbstractMavenIntegrationTestCase { + public MavenITmng0956ComponentInjectionViaProjectLevelPluginDepTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -47,23 +42,20 @@ public class MavenITmng0956ComponentInjectionViaProjectLevelPluginDepTest * @throws Exception in case of failure */ @Test - public void testitMNG0956() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-0956" ); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng0956" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + public void testitMNG0956() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-0956"); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng0956"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties apiProps = verifier.loadProperties( "target/component.properties" ); - assertEquals( "true", apiProps.getProperty( "org.apache.maven.plugin.coreit.DefaultTestComponent" ) ); + Properties apiProps = verifier.loadProperties("target/component.properties"); + assertEquals("true", apiProps.getProperty("org.apache.maven.plugin.coreit.DefaultTestComponent")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0985NonExecutedPluginMgmtGoalsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0985NonExecutedPluginMgmtGoalsTest.java index c23fe5c643..a1fbd26a1f 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0985NonExecutedPluginMgmtGoalsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0985NonExecutedPluginMgmtGoalsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,12 +30,9 @@ import org.junit.jupiter.api.Test; * @author John Casey * */ -public class MavenITmng0985NonExecutedPluginMgmtGoalsTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng0985NonExecutedPluginMgmtGoalsTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenITmng0985NonExecutedPluginMgmtGoalsTest extends AbstractMavenIntegrationTestCase { + public MavenITmng0985NonExecutedPluginMgmtGoalsTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -48,17 +43,14 @@ public class MavenITmng0985NonExecutedPluginMgmtGoalsTest * @throws Exception in case of failure */ @Test - public void testitMNG0985() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-0985" ); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "initialize" ); + public void testitMNG0985() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-0985"); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("initialize"); verifier.execute(); - verifier.verifyFileNotPresent( "target/unexpected.txt" ); + verifier.verifyFileNotPresent("target/unexpected.txt"); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1021EqualAttachmentBuildNumberTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1021EqualAttachmentBuildNumberTest.java index b6ea234a28..7247dcb928 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1021EqualAttachmentBuildNumberTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1021EqualAttachmentBuildNumberTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,12 +30,9 @@ import org.junit.jupiter.api.Test; * @author John Casey * */ -public class MavenITmng1021EqualAttachmentBuildNumberTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng1021EqualAttachmentBuildNumberTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenITmng1021EqualAttachmentBuildNumberTest extends AbstractMavenIntegrationTestCase { + public MavenITmng1021EqualAttachmentBuildNumberTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -47,54 +42,48 @@ public class MavenITmng1021EqualAttachmentBuildNumberTest * @throws Exception in case of failure */ @Test - public void testitMNG1021() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-1021" ); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "repo" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng1021" ); - verifier.addCliArgument( "initialize" ); + public void testitMNG1021() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-1021"); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("repo"); + verifier.deleteArtifacts("org.apache.maven.its.mng1021"); + verifier.addCliArgument("initialize"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng1021", "test", "1-SNAPSHOT", "pom" ); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng1021", "test", "1-SNAPSHOT", "jar" ); + verifier.verifyArtifactPresent("org.apache.maven.its.mng1021", "test", "1-SNAPSHOT", "pom"); + verifier.verifyArtifactPresent("org.apache.maven.its.mng1021", "test", "1-SNAPSHOT", "jar"); String dir = "repo/org/apache/maven/its/mng1021/test/"; - String snapshot = getSnapshotVersion( new File( testDir, dir + "1-SNAPSHOT" ) ); - assertTrue( snapshot, snapshot.endsWith( "-1" ) ); + String snapshot = getSnapshotVersion(new File(testDir, dir + "1-SNAPSHOT")); + assertTrue(snapshot, snapshot.endsWith("-1")); - verifier.verifyFilePresent( dir + "maven-metadata.xml" ); - verifier.verifyFilePresent( dir + "maven-metadata.xml.md5" ); - verifier.verifyFilePresent( dir + "maven-metadata.xml.sha1" ); - verifier.verifyFilePresent( dir + "1-SNAPSHOT/maven-metadata.xml" ); - verifier.verifyFilePresent( dir + "1-SNAPSHOT/maven-metadata.xml.md5" ); - verifier.verifyFilePresent( dir + "1-SNAPSHOT/maven-metadata.xml.sha1" ); - verifier.verifyFilePresent( dir + "1-SNAPSHOT/test-" + snapshot + ".pom" ); - verifier.verifyFilePresent( dir + "1-SNAPSHOT/test-" + snapshot + ".pom.md5" ); - verifier.verifyFilePresent( dir + "1-SNAPSHOT/test-" + snapshot + ".pom.sha1" ); - verifier.verifyFilePresent( dir + "1-SNAPSHOT/test-" + snapshot + ".jar" ); - verifier.verifyFilePresent( dir + "1-SNAPSHOT/test-" + snapshot + ".jar.md5" ); - verifier.verifyFilePresent( dir + "1-SNAPSHOT/test-" + snapshot + ".jar.sha1" ); - verifier.verifyFilePresent( dir + "1-SNAPSHOT/test-" + snapshot + "-it.jar" ); - verifier.verifyFilePresent( dir + "1-SNAPSHOT/test-" + snapshot + "-it.jar.md5" ); - verifier.verifyFilePresent( dir + "1-SNAPSHOT/test-" + snapshot + "-it.jar.sha1" ); + verifier.verifyFilePresent(dir + "maven-metadata.xml"); + verifier.verifyFilePresent(dir + "maven-metadata.xml.md5"); + verifier.verifyFilePresent(dir + "maven-metadata.xml.sha1"); + verifier.verifyFilePresent(dir + "1-SNAPSHOT/maven-metadata.xml"); + verifier.verifyFilePresent(dir + "1-SNAPSHOT/maven-metadata.xml.md5"); + verifier.verifyFilePresent(dir + "1-SNAPSHOT/maven-metadata.xml.sha1"); + verifier.verifyFilePresent(dir + "1-SNAPSHOT/test-" + snapshot + ".pom"); + verifier.verifyFilePresent(dir + "1-SNAPSHOT/test-" + snapshot + ".pom.md5"); + verifier.verifyFilePresent(dir + "1-SNAPSHOT/test-" + snapshot + ".pom.sha1"); + verifier.verifyFilePresent(dir + "1-SNAPSHOT/test-" + snapshot + ".jar"); + verifier.verifyFilePresent(dir + "1-SNAPSHOT/test-" + snapshot + ".jar.md5"); + verifier.verifyFilePresent(dir + "1-SNAPSHOT/test-" + snapshot + ".jar.sha1"); + verifier.verifyFilePresent(dir + "1-SNAPSHOT/test-" + snapshot + "-it.jar"); + verifier.verifyFilePresent(dir + "1-SNAPSHOT/test-" + snapshot + "-it.jar.md5"); + verifier.verifyFilePresent(dir + "1-SNAPSHOT/test-" + snapshot + "-it.jar.sha1"); } - private String getSnapshotVersion( File artifactDir ) - { + private String getSnapshotVersion(File artifactDir) { File[] files = artifactDir.listFiles(); - for ( File file : files ) - { + for (File file : files) { String name = file.getName(); - if ( name.endsWith( ".pom" ) ) - { - return name.substring( "test-".length(), name.length() - ".pom".length() ); + if (name.endsWith(".pom")) { + return name.substring("test-".length(), name.length() - ".pom".length()); } } - throw new IllegalStateException( "POM not found in " + artifactDir ); + throw new IllegalStateException("POM not found in " + artifactDir); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1052PluginMgmtConfigTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1052PluginMgmtConfigTest.java index f6955153af..0582fce93a 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1052PluginMgmtConfigTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1052PluginMgmtConfigTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,12 +30,9 @@ import org.junit.jupiter.api.Test; * @author John Casey * */ -public class MavenITmng1052PluginMgmtConfigTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng1052PluginMgmtConfigTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenITmng1052PluginMgmtConfigTest extends AbstractMavenIntegrationTestCase { + public MavenITmng1052PluginMgmtConfigTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -48,18 +43,15 @@ public class MavenITmng1052PluginMgmtConfigTest * @throws Exception in case of failure */ @Test - public void testitMNG1052() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-1052" ); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "process-resources" ); + public void testitMNG1052() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-1052"); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("process-resources"); verifier.execute(); - verifier.verifyFilePresent( "target/plugin-management.txt" ); - verifier.verifyFileNotPresent( "target/resources-resources.txt" ); + verifier.verifyFilePresent("target/plugin-management.txt"); + verifier.verifyFileNotPresent("target/resources-resources.txt"); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1073AggregatorForksReactorTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1073AggregatorForksReactorTest.java index 219080b2d9..abbde70416 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1073AggregatorForksReactorTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1073AggregatorForksReactorTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng1073AggregatorForksReactorTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng1073AggregatorForksReactorTest extends AbstractMavenIntegrationTestCase { - public MavenITmng1073AggregatorForksReactorTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng1073AggregatorForksReactorTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -46,27 +41,26 @@ public class MavenITmng1073AggregatorForksReactorTest * @throws Exception in case of failure */ @Test - public void testitForkLifecycle() - throws Exception - { + public void testitForkLifecycle() throws Exception { // excluded 2.1.x and 2.2.x due to MNG-4325 - requiresMavenVersion( "[2.0,2.1.0),[3.0-alpha-3,)" ); + requiresMavenVersion("[2.0,2.1.0),[3.0-alpha-3,)"); - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-1073" ); + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-1073"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteDirectory( "sub-1/target" ); - verifier.deleteDirectory( "sub-2/target" ); - verifier.setLogFileName( "log-lifecycle.txt" ); - verifier.addCliArgument( "org.apache.maven.its.plugins:maven-it-plugin-fork:2.1-SNAPSHOT:fork-lifecycle-aggregator" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteDirectory("sub-1/target"); + verifier.deleteDirectory("sub-2/target"); + verifier.setLogFileName("log-lifecycle.txt"); + verifier.addCliArgument( + "org.apache.maven.its.plugins:maven-it-plugin-fork:2.1-SNAPSHOT:fork-lifecycle-aggregator"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/forked/touch.txt" ); - verifier.verifyFilePresent( "sub-1/target/forked/touch.txt" ); - verifier.verifyFilePresent( "sub-2/target/forked/touch.txt" ); + verifier.verifyFilePresent("target/forked/touch.txt"); + verifier.verifyFilePresent("sub-1/target/forked/touch.txt"); + verifier.verifyFilePresent("sub-2/target/forked/touch.txt"); } /** @@ -75,24 +69,21 @@ public class MavenITmng1073AggregatorForksReactorTest * @throws Exception in case of failure */ @Test - public void testitForkGoal() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-1073" ); + public void testitForkGoal() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-1073"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteDirectory( "sub-1/target" ); - verifier.deleteDirectory( "sub-2/target" ); - verifier.setLogFileName( "log-goal.txt" ); - verifier.addCliArgument( "org.apache.maven.its.plugins:maven-it-plugin-fork:2.1-SNAPSHOT:fork-goal-aggregator" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteDirectory("sub-1/target"); + verifier.deleteDirectory("sub-2/target"); + verifier.setLogFileName("log-goal.txt"); + verifier.addCliArgument("org.apache.maven.its.plugins:maven-it-plugin-fork:2.1-SNAPSHOT:fork-goal-aggregator"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/touch.txt" ); - verifier.verifyFilePresent( "sub-1/target/touch.txt" ); - verifier.verifyFilePresent( "sub-2/target/touch.txt" ); + verifier.verifyFilePresent("target/touch.txt"); + verifier.verifyFilePresent("sub-1/target/touch.txt"); + verifier.verifyFilePresent("sub-2/target/touch.txt"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1088ReactorPluginResolutionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1088ReactorPluginResolutionTest.java index b555d46683..e457de456f 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1088ReactorPluginResolutionTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1088ReactorPluginResolutionTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * @author Brett Porter * */ -public class MavenITmng1088ReactorPluginResolutionTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng1088ReactorPluginResolutionTest extends AbstractMavenIntegrationTestCase { - public MavenITmng1088ReactorPluginResolutionTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng1088ReactorPluginResolutionTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -49,24 +44,21 @@ public class MavenITmng1088ReactorPluginResolutionTest * @throws Exception in case of failure */ @Test - public void testitMNG1088() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-1088" ); + public void testitMNG1088() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-1088"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "client/target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng1088" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("client/target"); + verifier.deleteArtifacts("org.apache.maven.its.mng1088"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); // NOTE: It's essential part of the test to invoke a phase before "compile" - verifier.addCliArgument( "initialize" ); + verifier.addCliArgument("initialize"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "client/target/touch.txt" ); + verifier.verifyFilePresent("client/target/touch.txt"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1142VersionRangeIntersectionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1142VersionRangeIntersectionTest.java index 299772a8fc..91e8fad21f 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1142VersionRangeIntersectionTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1142VersionRangeIntersectionTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng1142VersionRangeIntersectionTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng1142VersionRangeIntersectionTest extends AbstractMavenIntegrationTestCase { - public MavenITmng1142VersionRangeIntersectionTest() - { - super( "[2.0.7,3.0-alpha-1),[3.0,)" ); + public MavenITmng1142VersionRangeIntersectionTest() { + super("[2.0.7,3.0-alpha-1),[3.0,)"); } /** @@ -48,10 +43,8 @@ public class MavenITmng1142VersionRangeIntersectionTest * @throws Exception in case of failure */ @Test - public void testitAB() - throws Exception - { - testit( "test-ab" ); + public void testitAB() throws Exception { + testit("test-ab"); } /** @@ -61,33 +54,28 @@ public class MavenITmng1142VersionRangeIntersectionTest * @throws Exception in case of failure */ @Test - public void testitBA() - throws Exception - { - testit( "test-ba" ); + public void testitBA() throws Exception { + testit("test-ba"); } - private void testit( String project ) - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-1142" ); + private void testit(String project) throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-1142"); - Verifier verifier = newVerifier( new File( testDir, project ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng1142" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.filterFile( "../settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(new File(testDir, project).getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng1142"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.filterFile("../settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List classpath = verifier.loadLines( "target/classpath.txt", "UTF-8" ); + List classpath = verifier.loadLines("target/classpath.txt", "UTF-8"); - assertFalse( classpath.toString(), classpath.contains( "a-1.1.2.jar" ) ); - assertTrue( classpath.toString(), classpath.contains( "a-1.1.1.jar" ) ); - assertTrue( classpath.toString(), classpath.contains( "b-0.1.jar" ) ); + assertFalse(classpath.toString(), classpath.contains("a-1.1.2.jar")); + assertTrue(classpath.toString(), classpath.contains("a-1.1.1.jar")); + assertTrue(classpath.toString(), classpath.contains("b-0.1.jar")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1144MultipleDefaultGoalsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1144MultipleDefaultGoalsTest.java index 3920bb47d3..2b51a3e49a 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1144MultipleDefaultGoalsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1144MultipleDefaultGoalsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; -import java.util.Collections; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +29,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng1144MultipleDefaultGoalsTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng1144MultipleDefaultGoalsTest extends AbstractMavenIntegrationTestCase { - public MavenITmng1144MultipleDefaultGoalsTest() - { - super( "[3.0-alpha-7,)" ); + public MavenITmng1144MultipleDefaultGoalsTest() { + super("[3.0-alpha-7,)"); } /** @@ -47,19 +41,16 @@ public class MavenITmng1144MultipleDefaultGoalsTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-1144" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-1144"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/clean-clean.txt" ); - verifier.verifyFilePresent( "target/resources-resources.txt" ); + verifier.verifyFilePresent("target/clean-clean.txt"); + verifier.verifyFilePresent("target/resources-resources.txt"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1233WarDepWithProvidedScopeTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1233WarDepWithProvidedScopeTest.java index 309cbedf48..2163ebb99d 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1233WarDepWithProvidedScopeTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1233WarDepWithProvidedScopeTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Collection; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,12 +31,9 @@ import org.junit.jupiter.api.Test; * @author Brett Porter * */ -public class MavenITmng1233WarDepWithProvidedScopeTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng1233WarDepWithProvidedScopeTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenITmng1233WarDepWithProvidedScopeTest extends AbstractMavenIntegrationTestCase { + public MavenITmng1233WarDepWithProvidedScopeTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -47,33 +42,34 @@ public class MavenITmng1233WarDepWithProvidedScopeTest * @throws Exception in case of failure */ @Test - public void testitMNG1233() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-1233" ); + public void testitMNG1233() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-1233"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.it0083" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.it0083"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Collection compileArtifacts = verifier.loadLines( "target/compile.txt", "UTF-8" ); - assertTrue( compileArtifacts.toString(), - compileArtifacts.contains( "org.apache.maven.its.it0083:direct-dep:jar:0.1" ) ); - assertTrue( compileArtifacts.toString(), - compileArtifacts.contains( "org.apache.maven.its.it0083:trans-dep:jar:0.1" ) ); + Collection compileArtifacts = verifier.loadLines("target/compile.txt", "UTF-8"); + assertTrue( + compileArtifacts.toString(), + compileArtifacts.contains("org.apache.maven.its.it0083:direct-dep:jar:0.1")); + assertTrue( + compileArtifacts.toString(), + compileArtifacts.contains("org.apache.maven.its.it0083:trans-dep:jar:0.1")); - Collection runtimeArtifacts = verifier.loadLines( "target/runtime.txt", "UTF-8" ); - assertTrue( runtimeArtifacts.toString(), - runtimeArtifacts.contains( "org.apache.maven.its.it0083:direct-dep:jar:0.1" ) ); - assertFalse( runtimeArtifacts.toString(), - runtimeArtifacts.contains( "org.apache.maven.its.it0083:trans-dep:jar:0.1" ) ); + Collection runtimeArtifacts = verifier.loadLines("target/runtime.txt", "UTF-8"); + assertTrue( + runtimeArtifacts.toString(), + runtimeArtifacts.contains("org.apache.maven.its.it0083:direct-dep:jar:0.1")); + assertFalse( + runtimeArtifacts.toString(), + runtimeArtifacts.contains("org.apache.maven.its.it0083:trans-dep:jar:0.1")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1323AntrunDependenciesTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1323AntrunDependenciesTest.java index 6e4214495b..888a8d92d1 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1323AntrunDependenciesTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1323AntrunDependenciesTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng1323AntrunDependenciesTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng1323AntrunDependenciesTest extends AbstractMavenIntegrationTestCase { - public MavenITmng1323AntrunDependenciesTest() - { - super( "[3.0-alpha-1,)" ); + public MavenITmng1323AntrunDependenciesTest() { + super("[3.0-alpha-1,)"); } /** @@ -49,42 +44,39 @@ public class MavenITmng1323AntrunDependenciesTest * @throws Exception in case of failure */ @Test - public void testitMNG1323() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-1323" ); + public void testitMNG1323() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-1323"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteDirectory( "a/target" ); - verifier.deleteDirectory( "b/target" ); - verifier.deleteDirectory( "c/target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng1323" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteDirectory("a/target"); + verifier.deleteDirectory("b/target"); + verifier.deleteDirectory("c/target"); + verifier.deleteArtifacts("org.apache.maven.its.mng1323"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); Properties pclProps; - pclProps = verifier.loadProperties( "target/pcl.properties" ); - assertNull( pclProps.getProperty( "org.apache.maven.its.mng1323.ClassA" ) ); - assertNull( pclProps.getProperty( "org.apache.maven.its.mng1323.ClassB" ) ); + pclProps = verifier.loadProperties("target/pcl.properties"); + assertNull(pclProps.getProperty("org.apache.maven.its.mng1323.ClassA")); + assertNull(pclProps.getProperty("org.apache.maven.its.mng1323.ClassB")); - pclProps = verifier.loadProperties( "a/target/pcl.properties" ); - assertNotNull( pclProps.getProperty( "org.apache.maven.its.mng1323.ClassA" ) ); - assertNull( pclProps.getProperty( "org.apache.maven.its.mng1323.ClassB" ) ); + pclProps = verifier.loadProperties("a/target/pcl.properties"); + assertNotNull(pclProps.getProperty("org.apache.maven.its.mng1323.ClassA")); + assertNull(pclProps.getProperty("org.apache.maven.its.mng1323.ClassB")); - pclProps = verifier.loadProperties( "b/target/pcl.properties" ); - assertNull( pclProps.getProperty( "org.apache.maven.its.mng1323.ClassA" ) ); - assertNotNull( pclProps.getProperty( "org.apache.maven.its.mng1323.ClassB" ) ); + pclProps = verifier.loadProperties("b/target/pcl.properties"); + assertNull(pclProps.getProperty("org.apache.maven.its.mng1323.ClassA")); + assertNotNull(pclProps.getProperty("org.apache.maven.its.mng1323.ClassB")); - pclProps = verifier.loadProperties( "c/target/pcl.properties" ); - assertNull( pclProps.getProperty( "org.apache.maven.its.mng1323.ClassA" ) ); - assertNull( pclProps.getProperty( "org.apache.maven.its.mng1323.ClassB" ) ); + pclProps = verifier.loadProperties("c/target/pcl.properties"); + assertNull(pclProps.getProperty("org.apache.maven.its.mng1323.ClassA")); + assertNull(pclProps.getProperty("org.apache.maven.its.mng1323.ClassB")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1349ChecksumFormatsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1349ChecksumFormatsTest.java index 36f9f2f0db..65c670e749 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1349ChecksumFormatsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1349ChecksumFormatsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng1349ChecksumFormatsTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng1349ChecksumFormatsTest extends AbstractMavenIntegrationTestCase { - public MavenITmng1349ChecksumFormatsTest() - { - super( "(2.0.10,2.1.0-M1),(2.1.0-M1,)" ); + public MavenITmng1349ChecksumFormatsTest() { + super("(2.0.10,2.1.0-M1),(2.1.0-M1,)"); } /** @@ -47,38 +42,35 @@ public class MavenITmng1349ChecksumFormatsTest * @throws Exception in case of failure */ @Test - public void testitMNG1349() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-1349" ); + public void testitMNG1349() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-1349"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng1349" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng1349"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng1349", "md5-a", "0.1", "jar" ); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng1349", "md5-a", "0.1", "pom" ); + verifier.verifyArtifactPresent("org.apache.maven.its.mng1349", "md5-a", "0.1", "jar"); + verifier.verifyArtifactPresent("org.apache.maven.its.mng1349", "md5-a", "0.1", "pom"); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng1349", "md5-b", "0.1", "jar" ); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng1349", "md5-b", "0.1", "pom" ); + verifier.verifyArtifactPresent("org.apache.maven.its.mng1349", "md5-b", "0.1", "jar"); + verifier.verifyArtifactPresent("org.apache.maven.its.mng1349", "md5-b", "0.1", "pom"); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng1349", "md5-c", "0.1", "jar" ); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng1349", "md5-c", "0.1", "pom" ); + verifier.verifyArtifactPresent("org.apache.maven.its.mng1349", "md5-c", "0.1", "jar"); + verifier.verifyArtifactPresent("org.apache.maven.its.mng1349", "md5-c", "0.1", "pom"); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng1349", "sha1-a", "0.1", "jar" ); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng1349", "sha1-a", "0.1", "pom" ); + verifier.verifyArtifactPresent("org.apache.maven.its.mng1349", "sha1-a", "0.1", "jar"); + verifier.verifyArtifactPresent("org.apache.maven.its.mng1349", "sha1-a", "0.1", "pom"); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng1349", "sha1-b", "0.1", "jar" ); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng1349", "sha1-b", "0.1", "pom" ); + verifier.verifyArtifactPresent("org.apache.maven.its.mng1349", "sha1-b", "0.1", "jar"); + verifier.verifyArtifactPresent("org.apache.maven.its.mng1349", "sha1-b", "0.1", "pom"); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng1349", "sha1-c", "0.1", "jar" ); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng1349", "sha1-c", "0.1", "pom" ); + verifier.verifyArtifactPresent("org.apache.maven.its.mng1349", "sha1-c", "0.1", "jar"); + verifier.verifyArtifactPresent("org.apache.maven.its.mng1349", "sha1-c", "0.1", "pom"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1412DependenciesOrderTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1412DependenciesOrderTest.java index 47f92800fb..709b333661 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1412DependenciesOrderTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1412DependenciesOrderTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -34,67 +32,59 @@ import org.junit.jupiter.api.Test; * @author Hervé Boutemy * */ -public class MavenITmng1412DependenciesOrderTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng1412DependenciesOrderTest extends AbstractMavenIntegrationTestCase { - public MavenITmng1412DependenciesOrderTest() - { - super( "(2.0.8,)" ); // 2.0.9+ + public MavenITmng1412DependenciesOrderTest() { + super("(2.0.8,)"); // 2.0.9+ } @Test - public void testitMNG1412() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-1412" ); + public void testitMNG1412() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-1412"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng1412" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng1412"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List compileArtifacts = verifier.loadLines( "target/compile-artifacts.txt", "UTF-8" ); - assertArtifactOrder( compileArtifacts ); + List compileArtifacts = verifier.loadLines("target/compile-artifacts.txt", "UTF-8"); + assertArtifactOrder(compileArtifacts); - List compileClassPath = verifier.loadLines( "target/compile-classpath.txt", "UTF-8" ); - assertClassPathOrder( compileClassPath.subList( 1, compileClassPath.size() ) ); + List compileClassPath = verifier.loadLines("target/compile-classpath.txt", "UTF-8"); + assertClassPathOrder(compileClassPath.subList(1, compileClassPath.size())); - List runtimeArtifacts = verifier.loadLines( "target/runtime-artifacts.txt", "UTF-8" ); - assertArtifactOrder( runtimeArtifacts ); + List runtimeArtifacts = verifier.loadLines("target/runtime-artifacts.txt", "UTF-8"); + assertArtifactOrder(runtimeArtifacts); - List runtimeClassPath = verifier.loadLines( "target/runtime-classpath.txt", "UTF-8" ); - assertClassPathOrder( runtimeClassPath.subList( 1, runtimeClassPath.size() ) ); + List runtimeClassPath = verifier.loadLines("target/runtime-classpath.txt", "UTF-8"); + assertClassPathOrder(runtimeClassPath.subList(1, runtimeClassPath.size())); - List testArtifacts = verifier.loadLines( "target/test-artifacts.txt", "UTF-8" ); - assertArtifactOrder( testArtifacts ); + List testArtifacts = verifier.loadLines("target/test-artifacts.txt", "UTF-8"); + assertArtifactOrder(testArtifacts); - List testClassPath = verifier.loadLines( "target/test-classpath.txt", "UTF-8" ); - assertClassPathOrder( testClassPath.subList( 2, testClassPath.size() ) ); + List testClassPath = verifier.loadLines("target/test-classpath.txt", "UTF-8"); + assertClassPathOrder(testClassPath.subList(2, testClassPath.size())); } - private void assertArtifactOrder( List artifacts ) - { - assertEquals( 4, artifacts.size() ); - assertEquals( "org.apache.maven.its.mng1412:a:jar:0.1", artifacts.get( 0 ) ); - assertEquals( "org.apache.maven.its.mng1412:c:jar:0.1", artifacts.get( 1 ) ); - assertEquals( "org.apache.maven.its.mng1412:b:jar:0.1", artifacts.get( 2 ) ); - assertEquals( "org.apache.maven.its.mng1412:d:jar:0.1", artifacts.get( 3 ) ); + private void assertArtifactOrder(List artifacts) { + assertEquals(4, artifacts.size()); + assertEquals("org.apache.maven.its.mng1412:a:jar:0.1", artifacts.get(0)); + assertEquals("org.apache.maven.its.mng1412:c:jar:0.1", artifacts.get(1)); + assertEquals("org.apache.maven.its.mng1412:b:jar:0.1", artifacts.get(2)); + assertEquals("org.apache.maven.its.mng1412:d:jar:0.1", artifacts.get(3)); } - private void assertClassPathOrder( List classpath ) - { - assertEquals( 4, classpath.size() ); - assertEquals( "a-0.1.jar", classpath.get( 0 ) ); - assertEquals( "c-0.1.jar", classpath.get( 1 ) ); - assertEquals( "b-0.1.jar", classpath.get( 2 ) ); - assertEquals( "d-0.1.jar", classpath.get( 3 ) ); + private void assertClassPathOrder(List classpath) { + assertEquals(4, classpath.size()); + assertEquals("a-0.1.jar", classpath.get(0)); + assertEquals("c-0.1.jar", classpath.get(1)); + assertEquals("b-0.1.jar", classpath.get(2)); + assertEquals("d-0.1.jar", classpath.get(3)); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1415QuotedSystemPropertiesTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1415QuotedSystemPropertiesTest.java index d86cbc7f66..e6a8a1a245 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1415QuotedSystemPropertiesTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1415QuotedSystemPropertiesTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,12 +30,9 @@ import org.junit.jupiter.api.Test; * * */ -public class MavenITmng1415QuotedSystemPropertiesTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng1415QuotedSystemPropertiesTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenITmng1415QuotedSystemPropertiesTest extends AbstractMavenIntegrationTestCase { + public MavenITmng1415QuotedSystemPropertiesTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -46,21 +41,18 @@ public class MavenITmng1415QuotedSystemPropertiesTest * @throws Exception in case of failure */ @Test - public void testitMNG1415() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-1415" ); + public void testitMNG1415() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-1415"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "-Dtest.property=Test Property" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("-Dtest.property=Test Property"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/cli.properties" ); - assertEquals( "Test Property", props.getProperty( "stringParam" ) ); + Properties props = verifier.loadProperties("target/cli.properties"); + assertEquals("Test Property", props.getProperty("stringParam")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1491ReactorArtifactIdCollisionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1491ReactorArtifactIdCollisionTest.java index 15d1715719..92b98de953 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1491ReactorArtifactIdCollisionTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1491ReactorArtifactIdCollisionTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,37 +30,28 @@ import org.junit.jupiter.api.Test; * * */ -public class MavenITmng1491ReactorArtifactIdCollisionTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng1491ReactorArtifactIdCollisionTest extends AbstractMavenIntegrationTestCase { - public MavenITmng1491ReactorArtifactIdCollisionTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng1491ReactorArtifactIdCollisionTest() { + super(ALL_MAVEN_VERSIONS); } @Test - public void testitMNG1491() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-1491" ); + public void testitMNG1491() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-1491"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); - try - { - verifier.addCliArgument( "initialize" ); + try { + verifier.addCliArgument("initialize"); verifier.execute(); verifier.verifyErrorFreeLog(); - fail( "Build should fail due to duplicate artifactId's in the reactor." ); - } - catch( VerificationException e ) - { + fail("Build should fail due to duplicate artifactId's in the reactor."); + } catch (VerificationException e) { // expected. } } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1493NonStandardModulePomNamesTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1493NonStandardModulePomNamesTest.java index c669993b14..e35dd4713d 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1493NonStandardModulePomNamesTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1493NonStandardModulePomNamesTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,37 +16,32 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** * This is a test set for MNG-1493. */ -public class MavenITmng1493NonStandardModulePomNamesTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng1493NonStandardModulePomNamesTest() - { - super( "(2.0.8,)" ); // 2.0.9+ (including snapshots) +public class MavenITmng1493NonStandardModulePomNamesTest extends AbstractMavenIntegrationTestCase { + public MavenITmng1493NonStandardModulePomNamesTest() { + super("(2.0.8,)"); // 2.0.9+ (including snapshots) } @Test - public void testitMNG1493 () - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-1493" ); + public void testitMNG1493() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-1493"); Verifier verifier; - verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); + verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); - verifier.addCliArgument( "initialize" ); + verifier.addCliArgument("initialize"); verifier.execute(); /* diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1701DuplicatePluginTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1701DuplicatePluginTest.java index 472d42fcfc..f5431e2754 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1701DuplicatePluginTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1701DuplicatePluginTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng1701DuplicatePluginTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng1701DuplicatePluginTest extends AbstractMavenIntegrationTestCase { - public MavenITmng1701DuplicatePluginTest() - { - super( "[3.0-beta-1,)" ); + public MavenITmng1701DuplicatePluginTest() { + super("[3.0-beta-1,)"); } /** @@ -48,44 +43,36 @@ public class MavenITmng1701DuplicatePluginTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-1701" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-1701"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); try { - verifier.addCliArgument( "validate" ); + verifier.addCliArgument("validate"); verifier.execute(); - } - catch ( VerificationException e ) - { + } catch (VerificationException e) { // expected with Maven 4+ } String logLevel; - if ( matchesVersionRange( "(,4.0.0-alpha-1)" ) ) - { + if (matchesVersionRange("(,4.0.0-alpha-1)")) { logLevel = "WARNING"; - } - else - { + } else { logLevel = "ERROR"; } - List lines = verifier.loadLines( verifier.getLogFileName(), "UTF-8" ); + List lines = verifier.loadLines(verifier.getLogFileName(), "UTF-8"); boolean foundMessage = false; - for ( String line : lines ) - { - if ( line.startsWith( "[" + logLevel + "]" ) - && line.indexOf( "duplicate declaration of plugin org.apache.maven.its.plugins:maven-it-plugin-expression" ) > 0 ) - { + for (String line : lines) { + if (line.startsWith("[" + logLevel + "]") + && line.indexOf( + "duplicate declaration of plugin org.apache.maven.its.plugins:maven-it-plugin-expression") + > 0) { foundMessage = true; } } - assertTrue( "Duplicate plugin message wasn't generated.", foundMessage ); + assertTrue("Duplicate plugin message wasn't generated.", foundMessage); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1703PluginMgmtDepInheritanceTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1703PluginMgmtDepInheritanceTest.java index 4a3ecf9d55..d8e31365de 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1703PluginMgmtDepInheritanceTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1703PluginMgmtDepInheritanceTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng1703PluginMgmtDepInheritanceTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng1703PluginMgmtDepInheritanceTest extends AbstractMavenIntegrationTestCase { - public MavenITmng1703PluginMgmtDepInheritanceTest() - { - super( "(2.0.2,)" ); + public MavenITmng1703PluginMgmtDepInheritanceTest() { + super("(2.0.2,)"); } /** @@ -49,31 +44,28 @@ public class MavenITmng1703PluginMgmtDepInheritanceTest * @throws Exception in case of failure */ @Test - public void testitMNG1703() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-1703" ); + public void testitMNG1703() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-1703"); - Verifier verifier = newVerifier( new File( testDir, "child" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng1703" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(new File(testDir, "child").getAbsolutePath()); + verifier.setAutoclean(false); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng1703"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties pclProps = verifier.loadProperties( "target/pcl.properties" ); - assertNotNull( pclProps.getProperty( "org.apache.maven.plugin.coreit.ClassA" ) ); - assertNotNull( pclProps.getProperty( "org.apache.maven.plugin.coreit.ClassB" ) ); - assertNotNull( pclProps.getProperty( "org.apache.maven.its.mng1703.MNG1703" ) ); - assertNotNull( pclProps.getProperty( "src/main/java/org/apache/maven/its/mng1703/MNG1703.java" ) ); - assertEquals( "1", pclProps.getProperty( "src/main/java/org/apache/maven/its/mng1703/MNG1703.java.count" ) ); + Properties pclProps = verifier.loadProperties("target/pcl.properties"); + assertNotNull(pclProps.getProperty("org.apache.maven.plugin.coreit.ClassA")); + assertNotNull(pclProps.getProperty("org.apache.maven.plugin.coreit.ClassB")); + assertNotNull(pclProps.getProperty("org.apache.maven.its.mng1703.MNG1703")); + assertNotNull(pclProps.getProperty("src/main/java/org/apache/maven/its/mng1703/MNG1703.java")); + assertEquals("1", pclProps.getProperty("src/main/java/org/apache/maven/its/mng1703/MNG1703.java.count")); - Properties tcclProps = verifier.loadProperties( "target/tccl.properties" ); - assertEquals( pclProps, tcclProps ); + Properties tcclProps = verifier.loadProperties("target/tccl.properties"); + assertEquals(pclProps, tcclProps); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1751ForcedMetadataUpdateDuringDeploymentTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1751ForcedMetadataUpdateDuringDeploymentTest.java index 08077f8e47..41addbd184 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1751ForcedMetadataUpdateDuringDeploymentTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1751ForcedMetadataUpdateDuringDeploymentTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; import org.apache.maven.shared.utils.io.FileUtils; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng1751ForcedMetadataUpdateDuringDeploymentTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng1751ForcedMetadataUpdateDuringDeploymentTest extends AbstractMavenIntegrationTestCase { - public MavenITmng1751ForcedMetadataUpdateDuringDeploymentTest() - { - super( "[3.0-beta-1,)" ); + public MavenITmng1751ForcedMetadataUpdateDuringDeploymentTest() { + super("[3.0-beta-1,)"); } /** @@ -49,41 +44,38 @@ public class MavenITmng1751ForcedMetadataUpdateDuringDeploymentTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-1751" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-1751"); - File dir = new File( testDir, "repo/org/apache/maven/its/mng1751/dep/0.1-SNAPSHOT" ); - File templateMetadataFile = new File( dir, "template-metadata.xml" ); - File metadataFile = new File( dir, "maven-metadata.xml" ); - FileUtils.copyFile( templateMetadataFile, metadataFile ); - String checksum = ItUtils.calcHash( metadataFile, "SHA-1" ); - FileUtils.fileWrite( metadataFile.getPath() + ".sha1", checksum ); + File dir = new File(testDir, "repo/org/apache/maven/its/mng1751/dep/0.1-SNAPSHOT"); + File templateMetadataFile = new File(dir, "template-metadata.xml"); + File metadataFile = new File(dir, "maven-metadata.xml"); + FileUtils.copyFile(templateMetadataFile, metadataFile); + String checksum = ItUtils.calcHash(metadataFile, "SHA-1"); + FileUtils.fileWrite(metadataFile.getPath() + ".sha1", checksum); // phase 1: deploy a new snapshot, this should update the metadata despite its future timestamp - Verifier verifier = newVerifier( new File( testDir, "dep" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng1751" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(new File(testDir, "dep").getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng1751"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); // phase 2: resolve snapshot, if the previous deployment didn't update the metadata, we get the wrong file - verifier = newVerifier( new File( testDir, "test" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng1751" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + verifier = newVerifier(new File(testDir, "test").getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng1751"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties checksums = verifier.loadProperties( "target/checksum.properties" ); - String sha1 = checksums.getProperty( "dep-0.1-SNAPSHOT.jar", "" ).toLowerCase( java.util.Locale.ENGLISH ); - assertEquals( sha1, 40, sha1.length() ); - assertNotEquals( "fc081cd365b837dcb01eb9991f21c409b155ea5c", sha1 ); + Properties checksums = verifier.loadProperties("target/checksum.properties"); + String sha1 = checksums.getProperty("dep-0.1-SNAPSHOT.jar", "").toLowerCase(java.util.Locale.ENGLISH); + assertEquals(sha1, 40, sha1.length()); + assertNotEquals("fc081cd365b837dcb01eb9991f21c409b155ea5c", sha1); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1803PomValidationErrorIncludesLineNumberTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1803PomValidationErrorIncludesLineNumberTest.java index b4eb67e234..95c46a5ca9 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1803PomValidationErrorIncludesLineNumberTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1803PomValidationErrorIncludesLineNumberTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng1803PomValidationErrorIncludesLineNumberTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng1803PomValidationErrorIncludesLineNumberTest extends AbstractMavenIntegrationTestCase { - public MavenITmng1803PomValidationErrorIncludesLineNumberTest() - { - super( "[3.0-beta-2,)" ); + public MavenITmng1803PomValidationErrorIncludesLineNumberTest() { + super("[3.0-beta-2,)"); } /** @@ -47,38 +42,30 @@ public class MavenITmng1803PomValidationErrorIncludesLineNumberTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-1803" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-1803"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - try - { - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + try { + verifier.addCliArgument("validate"); verifier.execute(); - } - catch ( Exception e ) - { + } catch (Exception e) { // expected } boolean foundError = false; - List lines = verifier.loadLines( verifier.getLogFileName(), null ); - for ( String line : lines ) - { - if ( line.contains( ":bad/id:" ) ) - { - assertTrue( "Line number not found in: " + line, line.indexOf( "38" ) > 0 ); - assertTrue( "Column number not found in: " + line, line.indexOf( "19" ) > 0 ); + List lines = verifier.loadLines(verifier.getLogFileName(), null); + for (String line : lines) { + if (line.contains(":bad/id:")) { + assertTrue("Line number not found in: " + line, line.indexOf("38") > 0); + assertTrue("Column number not found in: " + line, line.indexOf("19") > 0); foundError = true; break; } } - assertTrue( "Build output did not mention validation error!", foundError ); + assertTrue("Build output did not mention validation error!", foundError); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1895ScopeConflictResolutionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1895ScopeConflictResolutionTest.java index 238df87d37..d0dd94d5b7 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1895ScopeConflictResolutionTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1895ScopeConflictResolutionTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; import java.util.Map; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng1895ScopeConflictResolutionTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng1895ScopeConflictResolutionTest extends AbstractMavenIntegrationTestCase { - public MavenITmng1895ScopeConflictResolutionTest() - { - super( "[2.0.3,)" ); + public MavenITmng1895ScopeConflictResolutionTest() { + super("[2.0.3,)"); } /** @@ -49,39 +44,37 @@ public class MavenITmng1895ScopeConflictResolutionTest * @throws Exception in case of failure */ @Test - public void testitDirectVsIndirect() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-1895/direct-vs-indirect" ); + public void testitDirectVsIndirect() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-1895/direct-vs-indirect"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng1895" ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng1895"); + verifier.deleteDirectory("target"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List compile = verifier.loadLines( "target/compile.txt", "UTF-8" ); - assertTrue( compile.toString(), compile.contains( "a-0.1.jar" ) ); - assertFalse( compile.toString(), compile.contains( "b-0.1.jar" ) ); - assertFalse( compile.toString(), compile.contains( "c-0.1.jar" ) ); - assertTrue( compile.toString(), compile.contains( "d-0.1.jar" ) ); + List compile = verifier.loadLines("target/compile.txt", "UTF-8"); + assertTrue(compile.toString(), compile.contains("a-0.1.jar")); + assertFalse(compile.toString(), compile.contains("b-0.1.jar")); + assertFalse(compile.toString(), compile.contains("c-0.1.jar")); + assertTrue(compile.toString(), compile.contains("d-0.1.jar")); - List runtime = verifier.loadLines( "target/runtime.txt", "UTF-8" ); - assertFalse( runtime.toString(), runtime.contains( "a-0.1.jar" ) ); - assertTrue( runtime.toString(), runtime.contains( "b-0.1.jar" ) ); - assertFalse( runtime.toString(), runtime.contains( "c-0.1.jar" ) ); - assertTrue( runtime.toString(), runtime.contains( "d-0.1.jar" ) ); + List runtime = verifier.loadLines("target/runtime.txt", "UTF-8"); + assertFalse(runtime.toString(), runtime.contains("a-0.1.jar")); + assertTrue(runtime.toString(), runtime.contains("b-0.1.jar")); + assertFalse(runtime.toString(), runtime.contains("c-0.1.jar")); + assertTrue(runtime.toString(), runtime.contains("d-0.1.jar")); - List test = verifier.loadLines( "target/test.txt", "UTF-8" ); - assertTrue( test.toString(), test.contains( "a-0.1.jar" ) ); - assertTrue( test.toString(), test.contains( "b-0.1.jar" ) ); - assertTrue( test.toString(), test.contains( "c-0.1.jar" ) ); - assertTrue( test.toString(), test.contains( "d-0.1.jar" ) ); + List test = verifier.loadLines("target/test.txt", "UTF-8"); + assertTrue(test.toString(), test.contains("a-0.1.jar")); + assertTrue(test.toString(), test.contains("b-0.1.jar")); + assertTrue(test.toString(), test.contains("c-0.1.jar")); + assertTrue(test.toString(), test.contains("d-0.1.jar")); } /** @@ -90,22 +83,20 @@ public class MavenITmng1895ScopeConflictResolutionTest * @throws Exception in case of failure */ @Test - public void testitCompileVsRuntime() - throws Exception - { - Verifier verifier = run( "compile", "runtime" ); + public void testitCompileVsRuntime() throws Exception { + Verifier verifier = run("compile", "runtime"); - List compile = verifier.loadLines( "target/compile.txt", "UTF-8" ); - assertTrue( compile.toString(), compile.contains( "x-0.1.jar" ) ); - assertFalse( compile.toString(), compile.contains( "a-0.1.jar" ) ); + List compile = verifier.loadLines("target/compile.txt", "UTF-8"); + assertTrue(compile.toString(), compile.contains("x-0.1.jar")); + assertFalse(compile.toString(), compile.contains("a-0.1.jar")); - List runtime = verifier.loadLines( "target/runtime.txt", "UTF-8" ); - assertTrue( runtime.toString(), runtime.contains( "x-0.1.jar" ) ); - assertTrue( runtime.toString(), runtime.contains( "a-0.1.jar" ) ); + List runtime = verifier.loadLines("target/runtime.txt", "UTF-8"); + assertTrue(runtime.toString(), runtime.contains("x-0.1.jar")); + assertTrue(runtime.toString(), runtime.contains("a-0.1.jar")); - List test = verifier.loadLines( "target/test.txt", "UTF-8" ); - assertTrue( test.toString(), test.contains( "x-0.1.jar" ) ); - assertTrue( test.toString(), test.contains( "a-0.1.jar" ) ); + List test = verifier.loadLines("target/test.txt", "UTF-8"); + assertTrue(test.toString(), test.contains("x-0.1.jar")); + assertTrue(test.toString(), test.contains("a-0.1.jar")); } /** @@ -114,22 +105,20 @@ public class MavenITmng1895ScopeConflictResolutionTest * @throws Exception in case of failure */ @Test - public void testitCompileVsTest() - throws Exception - { - Verifier verifier = run( "compile", "test" ); + public void testitCompileVsTest() throws Exception { + Verifier verifier = run("compile", "test"); - List compile = verifier.loadLines( "target/compile.txt", "UTF-8" ); - assertTrue( compile.toString(), compile.contains( "x-0.1.jar" ) ); - assertFalse( compile.toString(), compile.contains( "a-0.1.jar" ) ); + List compile = verifier.loadLines("target/compile.txt", "UTF-8"); + assertTrue(compile.toString(), compile.contains("x-0.1.jar")); + assertFalse(compile.toString(), compile.contains("a-0.1.jar")); - List runtime = verifier.loadLines( "target/runtime.txt", "UTF-8" ); - assertTrue( runtime.toString(), runtime.contains( "x-0.1.jar" ) ); - assertFalse( runtime.toString(), runtime.contains( "a-0.1.jar" ) ); + List runtime = verifier.loadLines("target/runtime.txt", "UTF-8"); + assertTrue(runtime.toString(), runtime.contains("x-0.1.jar")); + assertFalse(runtime.toString(), runtime.contains("a-0.1.jar")); - List test = verifier.loadLines( "target/test.txt", "UTF-8" ); - assertTrue( test.toString(), test.contains( "x-0.1.jar" ) ); - assertTrue( test.toString(), test.contains( "a-0.1.jar" ) ); + List test = verifier.loadLines("target/test.txt", "UTF-8"); + assertTrue(test.toString(), test.contains("x-0.1.jar")); + assertTrue(test.toString(), test.contains("a-0.1.jar")); } /** @@ -138,22 +127,20 @@ public class MavenITmng1895ScopeConflictResolutionTest * @throws Exception in case of failure */ @Test - public void testitCompileVsProvided() - throws Exception - { - Verifier verifier = run( "compile", "provided" ); + public void testitCompileVsProvided() throws Exception { + Verifier verifier = run("compile", "provided"); - List compile = verifier.loadLines( "target/compile.txt", "UTF-8" ); - assertTrue( compile.toString(), compile.contains( "x-0.1.jar" ) ); - assertTrue( compile.toString(), compile.contains( "a-0.1.jar" ) ); + List compile = verifier.loadLines("target/compile.txt", "UTF-8"); + assertTrue(compile.toString(), compile.contains("x-0.1.jar")); + assertTrue(compile.toString(), compile.contains("a-0.1.jar")); - List runtime = verifier.loadLines( "target/runtime.txt", "UTF-8" ); - assertTrue( runtime.toString(), runtime.contains( "x-0.1.jar" ) ); - assertFalse( runtime.toString(), runtime.contains( "a-0.1.jar" ) ); + List runtime = verifier.loadLines("target/runtime.txt", "UTF-8"); + assertTrue(runtime.toString(), runtime.contains("x-0.1.jar")); + assertFalse(runtime.toString(), runtime.contains("a-0.1.jar")); - List test = verifier.loadLines( "target/test.txt", "UTF-8" ); - assertTrue( test.toString(), test.contains( "x-0.1.jar" ) ); - assertTrue( test.toString(), test.contains( "a-0.1.jar" ) ); + List test = verifier.loadLines("target/test.txt", "UTF-8"); + assertTrue(test.toString(), test.contains("x-0.1.jar")); + assertTrue(test.toString(), test.contains("a-0.1.jar")); } /** @@ -162,22 +149,20 @@ public class MavenITmng1895ScopeConflictResolutionTest * @throws Exception in case of failure */ @Test - public void testitRuntimeVsTest() - throws Exception - { - Verifier verifier = run( "runtime", "test" ); + public void testitRuntimeVsTest() throws Exception { + Verifier verifier = run("runtime", "test"); - List compile = verifier.loadLines( "target/compile.txt", "UTF-8" ); - assertFalse( compile.toString(), compile.contains( "x-0.1.jar" ) ); - assertFalse( compile.toString(), compile.contains( "a-0.1.jar" ) ); + List compile = verifier.loadLines("target/compile.txt", "UTF-8"); + assertFalse(compile.toString(), compile.contains("x-0.1.jar")); + assertFalse(compile.toString(), compile.contains("a-0.1.jar")); - List runtime = verifier.loadLines( "target/runtime.txt", "UTF-8" ); - assertTrue( runtime.toString(), runtime.contains( "x-0.1.jar" ) ); - assertFalse( runtime.toString(), runtime.contains( "a-0.1.jar" ) ); + List runtime = verifier.loadLines("target/runtime.txt", "UTF-8"); + assertTrue(runtime.toString(), runtime.contains("x-0.1.jar")); + assertFalse(runtime.toString(), runtime.contains("a-0.1.jar")); - List test = verifier.loadLines( "target/test.txt", "UTF-8" ); - assertTrue( test.toString(), test.contains( "x-0.1.jar" ) ); - assertTrue( test.toString(), test.contains( "a-0.1.jar" ) ); + List test = verifier.loadLines("target/test.txt", "UTF-8"); + assertTrue(test.toString(), test.contains("x-0.1.jar")); + assertTrue(test.toString(), test.contains("a-0.1.jar")); } /** @@ -186,22 +171,20 @@ public class MavenITmng1895ScopeConflictResolutionTest * @throws Exception in case of failure */ @Test - public void testitRuntimeVsProvided() - throws Exception - { - Verifier verifier = run( "runtime", "provided" ); + public void testitRuntimeVsProvided() throws Exception { + Verifier verifier = run("runtime", "provided"); - List compile = verifier.loadLines( "target/compile.txt", "UTF-8" ); - assertFalse( compile.toString(), compile.contains( "x-0.1.jar" ) ); - assertTrue( compile.toString(), compile.contains( "a-0.1.jar" ) ); + List compile = verifier.loadLines("target/compile.txt", "UTF-8"); + assertFalse(compile.toString(), compile.contains("x-0.1.jar")); + assertTrue(compile.toString(), compile.contains("a-0.1.jar")); - List runtime = verifier.loadLines( "target/runtime.txt", "UTF-8" ); - assertTrue( runtime.toString(), runtime.contains( "x-0.1.jar" ) ); - assertFalse( runtime.toString(), runtime.contains( "a-0.1.jar" ) ); + List runtime = verifier.loadLines("target/runtime.txt", "UTF-8"); + assertTrue(runtime.toString(), runtime.contains("x-0.1.jar")); + assertFalse(runtime.toString(), runtime.contains("a-0.1.jar")); - List test = verifier.loadLines( "target/test.txt", "UTF-8" ); - assertTrue( test.toString(), test.contains( "x-0.1.jar" ) ); - assertTrue( test.toString(), test.contains( "a-0.1.jar" ) ); + List test = verifier.loadLines("target/test.txt", "UTF-8"); + assertTrue(test.toString(), test.contains("x-0.1.jar")); + assertTrue(test.toString(), test.contains("a-0.1.jar")); } /** @@ -210,48 +193,43 @@ public class MavenITmng1895ScopeConflictResolutionTest * @throws Exception in case of failure */ @Test - public void testitProvidedVsTest() - throws Exception - { - requiresMavenVersion( "[3.0-beta-3,)" ); // MNG-2686 + public void testitProvidedVsTest() throws Exception { + requiresMavenVersion("[3.0-beta-3,)"); // MNG-2686 - Verifier verifier = run( "provided", "test" ); + Verifier verifier = run("provided", "test"); - List compile = verifier.loadLines( "target/compile.txt", "UTF-8" ); - assertTrue( compile.toString(), compile.contains( "x-0.1.jar" ) ); - assertFalse( compile.toString(), compile.contains( "a-0.1.jar" ) ); + List compile = verifier.loadLines("target/compile.txt", "UTF-8"); + assertTrue(compile.toString(), compile.contains("x-0.1.jar")); + assertFalse(compile.toString(), compile.contains("a-0.1.jar")); - List runtime = verifier.loadLines( "target/runtime.txt", "UTF-8" ); - assertFalse( runtime.toString(), runtime.contains( "x-0.1.jar" ) ); - assertFalse( runtime.toString(), runtime.contains( "a-0.1.jar" ) ); + List runtime = verifier.loadLines("target/runtime.txt", "UTF-8"); + assertFalse(runtime.toString(), runtime.contains("x-0.1.jar")); + assertFalse(runtime.toString(), runtime.contains("a-0.1.jar")); - List test = verifier.loadLines( "target/test.txt", "UTF-8" ); - assertTrue( test.toString(), test.contains( "x-0.1.jar" ) ); - assertTrue( test.toString(), test.contains( "a-0.1.jar" ) ); + List test = verifier.loadLines("target/test.txt", "UTF-8"); + assertTrue(test.toString(), test.contains("x-0.1.jar")); + assertTrue(test.toString(), test.contains("a-0.1.jar")); } - private Verifier run( String scopeB, String scopeA ) - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-1895/strong-vs-weak" ); + private Verifier run(String scopeB, String scopeA) throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-1895/strong-vs-weak"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng1895" ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng1895"); + verifier.deleteDirectory("target"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); Map props = verifier.newDefaultFilterMap(); - props.put( "@scope.a@", scopeA ); - props.put( "@scope.b@", scopeB ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", props ); - verifier.filterFile( "pom-template.xml", "pom.xml", "UTF-8", props ); - verifier.setLogFileName( "log-" + scopeB + "-vs-" + scopeA + ".txt" ); - verifier.addCliArgument( "validate" ); + props.put("@scope.a@", scopeA); + props.put("@scope.b@", scopeB); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8", props); + verifier.filterFile("pom-template.xml", "pom.xml", "UTF-8", props); + verifier.setLogFileName("log-" + scopeB + "-vs-" + scopeA + ".txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); return verifier; } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1957JdkActivationWithVersionRangeTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1957JdkActivationWithVersionRangeTest.java index affd57f3c3..29c6cedd48 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1957JdkActivationWithVersionRangeTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1957JdkActivationWithVersionRangeTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng1957JdkActivationWithVersionRangeTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng1957JdkActivationWithVersionRangeTest extends AbstractMavenIntegrationTestCase { - public MavenITmng1957JdkActivationWithVersionRangeTest() - { - super( "[2.1.0,3.0-alpha-1),[3.0-alpha-6,)" ); + public MavenITmng1957JdkActivationWithVersionRangeTest() { + super("[2.1.0,3.0-alpha-1),[3.0-alpha-6,)"); } /** @@ -48,25 +43,22 @@ public class MavenITmng1957JdkActivationWithVersionRangeTest * @throws Exception in case of failure */ @Test - public void testitMNG1957() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-1957" ); + public void testitMNG1957() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-1957"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/jdk.properties" ); - assertEquals( "PASSED", props.getProperty( "project.properties.jdkProperty1" ) ); - assertEquals( "PASSED", props.getProperty( "project.properties.jdkProperty2" ) ); - assertEquals( "PASSED", props.getProperty( "project.properties.jdkProperty3" ) ); - assertNull( props.getProperty( "project.properties.jdkProperty4" ) ); - assertNull( props.getProperty( "project.properties.jdkProperty5" ) ); - assertEquals( "PASSED", props.getProperty( "project.properties.jdkProperty6" ) ); + Properties props = verifier.loadProperties("target/jdk.properties"); + assertEquals("PASSED", props.getProperty("project.properties.jdkProperty1")); + assertEquals("PASSED", props.getProperty("project.properties.jdkProperty2")); + assertEquals("PASSED", props.getProperty("project.properties.jdkProperty3")); + assertNull(props.getProperty("project.properties.jdkProperty4")); + assertNull(props.getProperty("project.properties.jdkProperty5")); + assertEquals("PASSED", props.getProperty("project.properties.jdkProperty6")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1992SystemPropOverridesPomPropTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1992SystemPropOverridesPomPropTest.java index 9bec893225..c06fbb7563 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1992SystemPropOverridesPomPropTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1992SystemPropOverridesPomPropTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng1992SystemPropOverridesPomPropTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng1992SystemPropOverridesPomPropTest extends AbstractMavenIntegrationTestCase { - public MavenITmng1992SystemPropOverridesPomPropTest() - { - super( "(2.1.0-M1,)" ); + public MavenITmng1992SystemPropOverridesPomPropTest() { + super("(2.1.0-M1,)"); } /** @@ -50,21 +45,18 @@ public class MavenITmng1992SystemPropOverridesPomPropTest * @throws Exception in case of failure */ @Test - public void testitMNG1992() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-1992" ); + public void testitMNG1992() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-1992"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.getSystemProperties().setProperty( "config.stringParam", "PASSED" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.getSystemProperties().setProperty("config.stringParam", "PASSED"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties configProps = verifier.loadProperties( "target/config.properties" ); - assertEquals( "PASSED", configProps.getProperty( "stringParam" ) ); + Properties configProps = verifier.loadProperties("target/config.properties"); + assertEquals("PASSED", configProps.getProperty("stringParam")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1995InterpolateBooleanModelElementsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1995InterpolateBooleanModelElementsTest.java index ad5f11f160..acc095d98d 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1995InterpolateBooleanModelElementsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1995InterpolateBooleanModelElementsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng1995InterpolateBooleanModelElementsTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng1995InterpolateBooleanModelElementsTest extends AbstractMavenIntegrationTestCase { - public MavenITmng1995InterpolateBooleanModelElementsTest() - { - super( "[3.0-alpha-1,)" ); + public MavenITmng1995InterpolateBooleanModelElementsTest() { + super("[3.0-alpha-1,)"); } /** @@ -48,30 +43,25 @@ public class MavenITmng1995InterpolateBooleanModelElementsTest * @throws Exception in case of failure */ @Test - public void testitMNG1995() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-1995" ); + public void testitMNG1995() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-1995"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); - verifier.addCliArgument( "validate" ); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/expression.properties" ); - assertEquals( "true", props.getProperty( "project.build.resources.0.filtering" ) ); + Properties props = verifier.loadProperties("target/expression.properties"); + assertEquals("true", props.getProperty("project.build.resources.0.filtering")); boolean foundTestRepo = false; - for ( int i = Integer.parseInt( props.getProperty( "project.repositories" ) ) - 1; i >= 0; i-- ) - { - if ( "maven-core-it".equals( props.getProperty( "project.repositories." + i + ".id" ) ) ) - { - assertEquals( "true", props.getProperty( "project.repositories." + i + ".releases.enabled" ) ); + for (int i = Integer.parseInt(props.getProperty("project.repositories")) - 1; i >= 0; i--) { + if ("maven-core-it".equals(props.getProperty("project.repositories." + i + ".id"))) { + assertEquals("true", props.getProperty("project.repositories." + i + ".releases.enabled")); foundTestRepo = true; } } - assertTrue( foundTestRepo ); + assertTrue(foundTestRepo); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2006ChildPathAwareUrlInheritanceTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2006ChildPathAwareUrlInheritanceTest.java index 60e906fbad..d0760828ec 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2006ChildPathAwareUrlInheritanceTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2006ChildPathAwareUrlInheritanceTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng2006ChildPathAwareUrlInheritanceTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng2006ChildPathAwareUrlInheritanceTest extends AbstractMavenIntegrationTestCase { - public MavenITmng2006ChildPathAwareUrlInheritanceTest() - { - super( "(2.0.2,)" ); + public MavenITmng2006ChildPathAwareUrlInheritanceTest() { + super("(2.0.2,)"); } /** @@ -49,28 +44,24 @@ public class MavenITmng2006ChildPathAwareUrlInheritanceTest * @throws Exception in case of failure */ @Test - public void testitMNG2006() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2006" ); + public void testitMNG2006() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2006"); - Verifier verifier = newVerifier( new File( testDir, "child" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(new File(testDir, "child").getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/pom.properties" ); - assertEquals( "http://project.url/child", props.getProperty( "project.url" ) ); - assertEquals( "http://viewvc.project.url/child", props.getProperty( "project.scm.url" ) ); - assertEquals( "http://scm.project.url/child", props.getProperty( "project.scm.connection" ) ); - assertEquals( "https://scm.project.url/child", props.getProperty( "project.scm.developerConnection" ) ); - if ( matchesVersionRange( "(2.0.7,)" ) ) - { + Properties props = verifier.loadProperties("target/pom.properties"); + assertEquals("http://project.url/child", props.getProperty("project.url")); + assertEquals("http://viewvc.project.url/child", props.getProperty("project.scm.url")); + assertEquals("http://scm.project.url/child", props.getProperty("project.scm.connection")); + assertEquals("https://scm.project.url/child", props.getProperty("project.scm.developerConnection")); + if (matchesVersionRange("(2.0.7,)")) { // MNG-3134 - assertEquals( "http://site.project.url/child", props.getProperty( "project.distributionManagement.site.url" ) ); + assertEquals("http://site.project.url/child", props.getProperty("project.distributionManagement.site.url")); } } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2045testJarDependenciesBrokenInReactorTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2045testJarDependenciesBrokenInReactorTest.java index 57d16eb0fd..beb0b29cd0 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2045testJarDependenciesBrokenInReactorTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2045testJarDependenciesBrokenInReactorTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -36,58 +34,51 @@ import org.junit.jupiter.api.Test; * @author Brian Fox * @author mikko.koponen@ri.fi */ -public class MavenITmng2045testJarDependenciesBrokenInReactorTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng2045testJarDependenciesBrokenInReactorTest extends AbstractMavenIntegrationTestCase { - public MavenITmng2045testJarDependenciesBrokenInReactorTest() - { - super( "(2.0.7,)" ); // 2.0.8+ + public MavenITmng2045testJarDependenciesBrokenInReactorTest() { + super("(2.0.7,)"); // 2.0.8+ } @Test - public void testitMNG2045() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2045" ); + public void testitMNG2045() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2045"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "test-user/target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng2045" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("test-user/target"); + verifier.deleteArtifacts("org.apache.maven.its.mng2045"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List compile = verifier.loadLines( "test-user/target/compile.txt", "UTF-8" ); - assertTestClasses( compile ); - assertNotMainClasses( compile ); + List compile = verifier.loadLines("test-user/target/compile.txt", "UTF-8"); + assertTestClasses(compile); + assertNotMainClasses(compile); - List runtime = verifier.loadLines( "test-user/target/runtime.txt", "UTF-8" ); - assertTestClasses( runtime ); - assertNotMainClasses( runtime ); + List runtime = verifier.loadLines("test-user/target/runtime.txt", "UTF-8"); + assertTestClasses(runtime); + assertNotMainClasses(runtime); - List test = verifier.loadLines( "test-user/target/test.txt", "UTF-8" ); - assertTestClasses( test ); - assertNotMainClasses( test ); + List test = verifier.loadLines("test-user/target/test.txt", "UTF-8"); + assertTestClasses(test); + assertNotMainClasses(test); } - private void assertTestClasses( List classpath ) - { + private void assertTestClasses(List classpath) { /* * Different Maven versions use the test-classes directory or the assembled test JAR but all that matters here * is merely that we have the test classes on the classpath. */ - assertTrue( "test classes missing in " + classpath, - classpath.contains( "test" ) || classpath.contains( "test.jar" ) - || classpath.contains( "test-jar-0.1-SNAPSHOT-tests.jar" ) ); + assertTrue( + "test classes missing in " + classpath, + classpath.contains("test") + || classpath.contains("test.jar") + || classpath.contains("test-jar-0.1-SNAPSHOT-tests.jar")); } - private void assertNotMainClasses( List classpath ) - { + private void assertNotMainClasses(List classpath) { // When depending on the test JAR of some module, we shouldn't get its main classes - assertFalse( "main classes present in " + classpath, - classpath.contains( "main" ) ); + assertFalse("main classes present in " + classpath, classpath.contains("main")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2052InterpolateWithSettingsProfilePropertiesTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2052InterpolateWithSettingsProfilePropertiesTest.java index 114a230b75..0da02efdad 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2052InterpolateWithSettingsProfilePropertiesTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2052InterpolateWithSettingsProfilePropertiesTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,12 +29,9 @@ import org.junit.jupiter.api.Test; * * */ -public class MavenITmng2052InterpolateWithSettingsProfilePropertiesTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng2052InterpolateWithSettingsProfilePropertiesTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenITmng2052InterpolateWithSettingsProfilePropertiesTest extends AbstractMavenIntegrationTestCase { + public MavenITmng2052InterpolateWithSettingsProfilePropertiesTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -47,18 +42,15 @@ public class MavenITmng2052InterpolateWithSettingsProfilePropertiesTest * @throws Exception in case of failure */ @Test - public void testitMNG2052() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2052" ); + public void testitMNG2052() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2052"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2054PluginExecutionInheritanceTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2054PluginExecutionInheritanceTest.java index 7f8b6801bb..6f9f3c0fd0 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2054PluginExecutionInheritanceTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2054PluginExecutionInheritanceTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Arrays; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * * */ -public class MavenITmng2054PluginExecutionInheritanceTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng2054PluginExecutionInheritanceTest extends AbstractMavenIntegrationTestCase { - public MavenITmng2054PluginExecutionInheritanceTest() - { - super( "(2.0.3,)" ); + public MavenITmng2054PluginExecutionInheritanceTest() { + super("(2.0.3,)"); } /** @@ -48,21 +43,18 @@ public class MavenITmng2054PluginExecutionInheritanceTest * @throws Exception in case of failure */ @Test - public void testitMNG2054() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2054" ); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "project/project-level2/project-level3/project-jar/target" ); - verifier.addCliArgument( "validate" ); + public void testitMNG2054() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2054"); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("project/project-level2/project-level3/project-jar/target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); List executions = - verifier.loadLines( "project/project-level2/project-level3/project-jar/target/exec.log", "UTF-8" ); - List expected = Arrays.asList( new String[] { "once" } ); - assertEquals( expected, executions ); + verifier.loadLines("project/project-level2/project-level3/project-jar/target/exec.log", "UTF-8"); + List expected = Arrays.asList(new String[] {"once"}); + assertEquals(expected, executions); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2068ReactorRelativeParentsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2068ReactorRelativeParentsTest.java index 20e18c5f2e..840baf2510 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2068ReactorRelativeParentsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2068ReactorRelativeParentsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -36,13 +34,10 @@ import org.junit.jupiter.api.Test; * @author jdcasey * */ -public class MavenITmng2068ReactorRelativeParentsTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng2068ReactorRelativeParentsTest extends AbstractMavenIntegrationTestCase { - public MavenITmng2068ReactorRelativeParentsTest() - { - super( "(2.0.6,)" ); // only test in 2.0.7+ + public MavenITmng2068ReactorRelativeParentsTest() { + super("(2.0.6,)"); // only test in 2.0.7+ } /** @@ -51,16 +46,14 @@ public class MavenITmng2068ReactorRelativeParentsTest * @throws Exception in case of failure */ @Test - public void testitInheritedIdFields() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2068/test-1" ); - File projectDir = new File( testDir, "parent" ); + public void testitInheritedIdFields() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2068/test-1"); + File projectDir = new File(testDir, "parent"); - Verifier verifier = newVerifier( projectDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng2068" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(projectDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng2068"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); } @@ -71,16 +64,14 @@ public class MavenITmng2068ReactorRelativeParentsTest * @throws Exception in case of failure */ @Test - public void testitExplicitIdFields() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2068/test-2" ); - File projectDir = new File( testDir, "parent" ); + public void testitExplicitIdFields() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2068/test-2"); + File projectDir = new File(testDir, "parent"); - Verifier verifier = newVerifier( projectDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng2068" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(projectDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng2068"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); } @@ -91,18 +82,15 @@ public class MavenITmng2068ReactorRelativeParentsTest * @throws Exception in case of failure */ @Test - public void testitComplex() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2068/test-3" ); + public void testitComplex() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2068/test-3"); File projectDir = testDir; - Verifier verifier = newVerifier( projectDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng2068" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(projectDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng2068"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2098VersionRangeSatisfiedFromWrongRepoTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2098VersionRangeSatisfiedFromWrongRepoTest.java index 44aa6106a2..c56a882d2b 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2098VersionRangeSatisfiedFromWrongRepoTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2098VersionRangeSatisfiedFromWrongRepoTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng2098VersionRangeSatisfiedFromWrongRepoTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng2098VersionRangeSatisfiedFromWrongRepoTest extends AbstractMavenIntegrationTestCase { - public MavenITmng2098VersionRangeSatisfiedFromWrongRepoTest() - { - super( "[3.0-alpha-3,)" ); + public MavenITmng2098VersionRangeSatisfiedFromWrongRepoTest() { + super("[3.0-alpha-3,)"); } /** @@ -49,22 +44,19 @@ public class MavenITmng2098VersionRangeSatisfiedFromWrongRepoTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2098" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2098"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng2098" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng2098"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng2098", "dep", "0.1", "jar" ); + verifier.verifyArtifactPresent("org.apache.maven.its.mng2098", "dep", "0.1", "jar"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2103PluginExecutionInheritanceTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2103PluginExecutionInheritanceTest.java index 05c07f567b..9332e27187 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2103PluginExecutionInheritanceTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2103PluginExecutionInheritanceTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Arrays; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng2103PluginExecutionInheritanceTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng2103PluginExecutionInheritanceTest extends AbstractMavenIntegrationTestCase { - public MavenITmng2103PluginExecutionInheritanceTest() - { - super( "[3.0-beta-1,)" ); + public MavenITmng2103PluginExecutionInheritanceTest() { + super("[3.0-beta-1,)"); } /** @@ -48,24 +43,21 @@ public class MavenITmng2103PluginExecutionInheritanceTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2103" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2103"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "child-1/target" ); - verifier.deleteDirectory( "child-2/target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("child-1/target"); + verifier.deleteDirectory("child-2/target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List execs = verifier.loadLines( "child-1/target/log.txt", "UTF-8" ); - assertEquals( Arrays.asList( new String[] { "inherited" } ), execs ); + List execs = verifier.loadLines("child-1/target/log.txt", "UTF-8"); + assertEquals(Arrays.asList(new String[] {"inherited"}), execs); - execs = verifier.loadLines( "child-2/target/log.txt", "UTF-8" ); - assertEquals( Arrays.asList( new String[] { "inherited" } ), execs ); + execs = verifier.loadLines("child-2/target/log.txt", "UTF-8"); + assertEquals(Arrays.asList(new String[] {"inherited"}), execs); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2123VersionRangeDependencyTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2123VersionRangeDependencyTest.java index ddfd6b3530..2f120fe5be 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2123VersionRangeDependencyTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2123VersionRangeDependencyTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,48 +16,42 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** * This is a test set for MNG-2123. */ -public class MavenITmng2123VersionRangeDependencyTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng2123VersionRangeDependencyTest extends AbstractMavenIntegrationTestCase { - public MavenITmng2123VersionRangeDependencyTest() - { - super( "(2.0.8,)" ); + public MavenITmng2123VersionRangeDependencyTest() { + super("(2.0.8,)"); } @Test - public void testitMNG2123() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2123" ); + public void testitMNG2123() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2123"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng2123" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng2123"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List artifacts = verifier.loadLines( "target/artifacts.txt", "UTF-8" ); - assertTrue( artifacts.toString(), artifacts.contains( "org.apache.maven.its.mng2123:fixed:jar:0.1" ) ); - assertTrue( artifacts.toString(), artifacts.contains( "org.apache.maven.its.mng2123:common:jar:3.1" ) ); - assertTrue( artifacts.toString(), artifacts.contains( "org.apache.maven.its.mng2123:range:jar:0.1" ) ); + List artifacts = verifier.loadLines("target/artifacts.txt", "UTF-8"); + assertTrue(artifacts.toString(), artifacts.contains("org.apache.maven.its.mng2123:fixed:jar:0.1")); + assertTrue(artifacts.toString(), artifacts.contains("org.apache.maven.its.mng2123:common:jar:3.1")); + assertTrue(artifacts.toString(), artifacts.contains("org.apache.maven.its.mng2123:range:jar:0.1")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2124PomInterpolationWithParentValuesTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2124PomInterpolationWithParentValuesTest.java index e1930135b4..176d8b1722 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2124PomInterpolationWithParentValuesTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2124PomInterpolationWithParentValuesTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,24 +16,21 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** * This is a test set for MNG-2124. */ -public class MavenITmng2124PomInterpolationWithParentValuesTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng2124PomInterpolationWithParentValuesTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenITmng2124PomInterpolationWithParentValuesTest extends AbstractMavenIntegrationTestCase { + public MavenITmng2124PomInterpolationWithParentValuesTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -44,21 +39,18 @@ public class MavenITmng2124PomInterpolationWithParentValuesTest * @throws Exception in case of failure */ @Test - public void testitMNG2124() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2124" ); - File child = new File( testDir, "parent/child" ); + public void testitMNG2124() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2124"); + File child = new File(testDir, "parent/child"); - Verifier verifier = newVerifier( child.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "initialize" ); + Verifier verifier = newVerifier(child.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("initialize"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/parent.properties" ); - assertEquals( "parent, child", props.getProperty( "project.description" ) ); + Properties props = verifier.loadProperties("target/parent.properties"); + assertEquals("parent, child", props.getProperty("project.description")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2130ParentLookupFromReactorCacheTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2130ParentLookupFromReactorCacheTest.java index ccc776336f..7c170e0a26 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2130ParentLookupFromReactorCacheTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2130ParentLookupFromReactorCacheTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,23 +16,20 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** * This is a test set for MNG-2130. */ -public class MavenITmng2130ParentLookupFromReactorCacheTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng2130ParentLookupFromReactorCacheTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenITmng2130ParentLookupFromReactorCacheTest extends AbstractMavenIntegrationTestCase { + public MavenITmng2130ParentLookupFromReactorCacheTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -44,17 +39,14 @@ public class MavenITmng2130ParentLookupFromReactorCacheTest * @throws Exception in case of failure */ @Test - public void testitMNG2130() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2130" ); + public void testitMNG2130() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2130"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.mng2130" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.mng2130"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2135PluginBuildInReactorTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2135PluginBuildInReactorTest.java index d0f5f90045..be3fff25ba 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2135PluginBuildInReactorTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2135PluginBuildInReactorTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng2135PluginBuildInReactorTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng2135PluginBuildInReactorTest extends AbstractMavenIntegrationTestCase { - public MavenITmng2135PluginBuildInReactorTest() - { - super( "[3.0-alpha-3,)" ); + public MavenITmng2135PluginBuildInReactorTest() { + super("[3.0-alpha-3,)"); } /** @@ -46,21 +41,18 @@ public class MavenITmng2135PluginBuildInReactorTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2135" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2135"); - Verifier verifier = newVerifier( testDir.getAbsolutePath(), "remote" ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "plugin/target" ); - verifier.deleteDirectory( "project/target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng2135" ); - verifier.addCliArgument( "package" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath(), "remote"); + verifier.setAutoclean(false); + verifier.deleteDirectory("plugin/target"); + verifier.deleteDirectory("project/target"); + verifier.deleteArtifacts("org.apache.maven.its.mng2135"); + verifier.addCliArgument("package"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "project/target/touch.txt" ); + verifier.verifyFilePresent("project/target/touch.txt"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2136ActiveByDefaultProfileTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2136ActiveByDefaultProfileTest.java index 632d98d5b2..09f8e1e463 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2136ActiveByDefaultProfileTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2136ActiveByDefaultProfileTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,12 +30,9 @@ import org.junit.jupiter.api.Test; * * */ -public class MavenITmng2136ActiveByDefaultProfileTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng2136ActiveByDefaultProfileTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenITmng2136ActiveByDefaultProfileTest extends AbstractMavenIntegrationTestCase { + public MavenITmng2136ActiveByDefaultProfileTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -47,33 +42,30 @@ public class MavenITmng2136ActiveByDefaultProfileTest * @throws Exception in case of failure */ @Test - public void testitMNG2136() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2136" ); + public void testitMNG2136() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2136"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); - verifier.addCliArgument( "-Dexpression.outputFile=" + new File( testDir, "target/expression.properties" ).getPath() ); - verifier.addCliArgument( "-Dexpression.expressions=project/properties" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "org.apache.maven.its.plugins:maven-it-plugin-expression:2.1-SNAPSHOT:eval" ); + verifier.addCliArgument( + "-Dexpression.outputFile=" + new File(testDir, "target/expression.properties").getPath()); + verifier.addCliArgument("-Dexpression.expressions=project/properties"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("org.apache.maven.its.plugins:maven-it-plugin-expression:2.1-SNAPSHOT:eval"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/expression.properties" ); - Properties props = verifier.loadProperties( "target/expression.properties" ); - assertNull( props.getProperty( "project.properties.it0102.testOutput" ) ); - assertEquals( "Success", props.getProperty( "project.properties.testOutput" ) ); - assertEquals( "PASSED", props.getProperty( "project.properties.settingsValue" ) ); - if ( matchesVersionRange( "[2.0,3.0-alpha-1)" ) ) - { + verifier.verifyFilePresent("target/expression.properties"); + Properties props = verifier.loadProperties("target/expression.properties"); + assertNull(props.getProperty("project.properties.it0102.testOutput")); + assertEquals("Success", props.getProperty("project.properties.testOutput")); + assertEquals("PASSED", props.getProperty("project.properties.settingsValue")); + if (matchesVersionRange("[2.0,3.0-alpha-1)")) { // support for profiles.xml removed from 3.x (see MNG-4060) - assertEquals( "Present", props.getProperty( "project.properties.profilesXmlValue" ) ); + assertEquals("Present", props.getProperty("project.properties.profilesXmlValue")); } } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2140ReactorAwareDepResolutionWhenForkTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2140ReactorAwareDepResolutionWhenForkTest.java index 8d9eff9619..7a9c65637b 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2140ReactorAwareDepResolutionWhenForkTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2140ReactorAwareDepResolutionWhenForkTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng2140ReactorAwareDepResolutionWhenForkTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng2140ReactorAwareDepResolutionWhenForkTest extends AbstractMavenIntegrationTestCase { - public MavenITmng2140ReactorAwareDepResolutionWhenForkTest() - { - super( "[3.0-alpha-3,)" ); + public MavenITmng2140ReactorAwareDepResolutionWhenForkTest() { + super("[3.0-alpha-3,)"); } /** @@ -47,20 +42,17 @@ public class MavenITmng2140ReactorAwareDepResolutionWhenForkTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2140" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2140"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List artifacts = verifier.loadLines( "project/target/test.txt", "UTF-8" ); - assertTrue( artifacts.toString(), artifacts.contains( "dependency/pom.xml" ) ); + List artifacts = verifier.loadLines("project/target/test.txt", "UTF-8"); + assertTrue(artifacts.toString(), artifacts.contains("dependency/pom.xml")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2174PluginDepsManagedByParentProfileTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2174PluginDepsManagedByParentProfileTest.java index 636b7c06a5..f88b05823e 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2174PluginDepsManagedByParentProfileTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2174PluginDepsManagedByParentProfileTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng2174PluginDepsManagedByParentProfileTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng2174PluginDepsManagedByParentProfileTest extends AbstractMavenIntegrationTestCase { - public MavenITmng2174PluginDepsManagedByParentProfileTest() - { - super( "[2.0.9,3.0-alpha-1),[3.0-alpha-3,)" ); + public MavenITmng2174PluginDepsManagedByParentProfileTest() { + super("[2.0.9,3.0-alpha-1),[3.0-alpha-3,)"); } /** @@ -49,25 +44,22 @@ public class MavenITmng2174PluginDepsManagedByParentProfileTest * @throws Exception in case of failure */ @Test - public void testitMNG2174() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2174" ); + public void testitMNG2174() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2174"); - Verifier verifier = newVerifier( new File( testDir, "sub" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng2174" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(new File(testDir, "sub").getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng2174"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/pcl.properties" ); - assertEquals( "1", props.getProperty( "mng-2174.properties.count" ) ); - assertNotNull( props.getProperty( "mng-2174.properties" ) ); + Properties props = verifier.loadProperties("target/pcl.properties"); + assertEquals("1", props.getProperty("mng-2174.properties.count")); + assertNotNull(props.getProperty("mng-2174.properties")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2196ParentResolutionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2196ParentResolutionTest.java index 0c89af10ac..d82c34af1b 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2196ParentResolutionTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2196ParentResolutionTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,25 +16,22 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** * This is a test set for MNG-2196. */ -public class MavenITmng2196ParentResolutionTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng2196ParentResolutionTest extends AbstractMavenIntegrationTestCase { - public MavenITmng2196ParentResolutionTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng2196ParentResolutionTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -47,35 +42,26 @@ public class MavenITmng2196ParentResolutionTest * @throws Exception in case of failure */ @Test - public void testitMNG2196() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2196" ); + public void testitMNG2196() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2196"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng2196" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng2196"); - if ( matchesVersionRange( "(,3.0-alpha-1)" ) ) - { - verifier.addCliArgument( "validate" ); + if (matchesVersionRange("(,3.0-alpha-1)")) { + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - } - else - { - try - { - verifier.addCliArgument( "validate" ); + } else { + try { + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - fail( "Build should have failed due to bad relativePath" ); - } - catch ( VerificationException e ) - { + fail("Build should have failed due to bad relativePath"); + } catch (VerificationException e) { // expected } } } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2199ParentVersionRangeTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2199ParentVersionRangeTest.java index 2d5c03dbac..ad9c670300 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2199ParentVersionRangeTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2199ParentVersionRangeTest.java @@ -1,177 +1,151 @@ /* - * Copyright 2014 The Apache Software Foundation. + * 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 * - * Licensed 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 * - * 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. + * 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.it; -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; - import java.io.File; import java.util.List; import java.util.regex.Pattern; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; -public class MavenITmng2199ParentVersionRangeTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng2199ParentVersionRangeTest extends AbstractMavenIntegrationTestCase { - public MavenITmng2199ParentVersionRangeTest() - { - super( "[3.2.2,)" ); + public MavenITmng2199ParentVersionRangeTest() { + super("[3.2.2,)"); } @Test - public void testValidParentVersionRangeWithInclusiveUpperBound() - throws Exception - { - failingMavenVersions( "(3.2.2,3.5.0-alpha-0)" ); + public void testValidParentVersionRangeWithInclusiveUpperBound() throws Exception { + failingMavenVersions("(3.2.2,3.5.0-alpha-0)"); + Verifier verifier = null; + File testDir = ResourceExtractor.simpleExtractResources( + getClass(), "/mng-2199-parent-version-range/valid-inclusive-upper-bound"); + + verifier = newVerifier(testDir.getAbsolutePath(), "remote"); + verifier.addCliArgument("-U"); + verifier.setAutoclean(false); + verifier.addCliArgument("verify"); + verifier.execute(); + verifier.verifyErrorFreeLog(); + + // All Maven versions not supporting remote parent version ranges will log a warning message whenever + // building a parent fails. The build succeeds without any parent. If that warning message appears in the + // log, parent resolution failed. + final List lines = verifier.loadFile(new File(testDir, "log.txt"), false); + assertFalse("Unexpected error message found.", indexOf(lines, ".*Failed to build parent project.*") >= 0); + } + + @Test + public void testValidParentVersionRangeWithExclusiveUpperBound() throws Exception { + failingMavenVersions("(3.2.2,3.5.0-alpha-0)"); + Verifier verifier = null; + File testDir = ResourceExtractor.simpleExtractResources( + getClass(), "/mng-2199-parent-version-range/valid-exclusive-upper-bound"); + + verifier = newVerifier(testDir.getAbsolutePath(), "remote"); + verifier.addCliArgument("-U"); + verifier.setAutoclean(false); + verifier.addCliArgument("verify"); + verifier.execute(); + verifier.verifyErrorFreeLog(); + + // All Maven versions not supporting remote parent version ranges will log a warning message whenever + // building a parent fails. The build succeeds without any parent. If that warning message appears in the + // log, parent resolution failed. + final List lines = verifier.loadFile(new File(testDir, "log.txt"), false); + assertFalse("Unexpected error message found.", indexOf(lines, ".*Failed to build parent project.*") >= 0); + } + + @Test + public void testInvalidParentVersionRangeWithoutUpperBound() throws Exception { + Verifier verifier = null; + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2199-parent-version-range/invalid"); + + try { + verifier = newVerifier(testDir.getAbsolutePath(), "remote"); + verifier.setAutoclean(false); + verifier.addCliArgument("-U"); + verifier.addCliArgument("verify"); + verifier.execute(); + fail("Expected 'VerificationException' not thrown."); + } catch (final VerificationException e) { + assertNotNull(verifier); + final List lines = verifier.loadFile(new File(testDir, "log.txt"), false); + assertTrue( + "Expected error message not found.", + indexOf(lines, ".*(parent)? version range.*does not specify an upper bound.*") >= 0); + } + } + + @Test + public void testValidParentVersionRangeInvalidVersionExpression() throws Exception { Verifier verifier = null; File testDir = - ResourceExtractor.simpleExtractResources( getClass(), - "/mng-2199-parent-version-range/valid-inclusive-upper-bound" ); + ResourceExtractor.simpleExtractResources(getClass(), "/mng-2199-parent-version-range/expression"); - verifier = newVerifier( testDir.getAbsolutePath(), "remote" ); - verifier.addCliArgument( "-U" ); - verifier.setAutoclean( false ); - verifier.addCliArgument( "verify" ); - verifier.execute(); - verifier.verifyErrorFreeLog(); - - // All Maven versions not supporting remote parent version ranges will log a warning message whenever - // building a parent fails. The build succeeds without any parent. If that warning message appears in the - // log, parent resolution failed. - final List lines = verifier.loadFile( new File( testDir, "log.txt" ), false ); - assertFalse( "Unexpected error message found.", - indexOf( lines, ".*Failed to build parent project.*" ) >= 0 ); - } - - @Test - public void testValidParentVersionRangeWithExclusiveUpperBound() - throws Exception - { - failingMavenVersions( "(3.2.2,3.5.0-alpha-0)" ); - Verifier verifier = null; - File testDir = ResourceExtractor.simpleExtractResources( - getClass(), "/mng-2199-parent-version-range/valid-exclusive-upper-bound" ); - - verifier = newVerifier( testDir.getAbsolutePath(), "remote" ); - verifier.addCliArgument( "-U" ); - verifier.setAutoclean( false ); - verifier.addCliArgument( "verify" ); - verifier.execute(); - verifier.verifyErrorFreeLog(); - - // All Maven versions not supporting remote parent version ranges will log a warning message whenever - // building a parent fails. The build succeeds without any parent. If that warning message appears in the - // log, parent resolution failed. - final List lines = verifier.loadFile( new File( testDir, "log.txt" ), false ); - assertFalse( "Unexpected error message found.", - indexOf( lines, ".*Failed to build parent project.*" ) >= 0 ); - } - - @Test - public void testInvalidParentVersionRangeWithoutUpperBound() - throws Exception - { - Verifier verifier = null; - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2199-parent-version-range/invalid" ); - - try - { - verifier = newVerifier( testDir.getAbsolutePath(), "remote" ); - verifier.setAutoclean( false ); - verifier.addCliArgument( "-U" ); - verifier.addCliArgument( "verify" ); + try { + verifier = newVerifier(testDir.getAbsolutePath(), "remote"); + verifier.setAutoclean(false); + verifier.addCliArgument("-U"); + verifier.addCliArgument("verify"); verifier.execute(); - fail( "Expected 'VerificationException' not thrown." ); - } - catch ( final VerificationException e ) - { - assertNotNull( verifier ); - final List lines = verifier.loadFile( new File( testDir, "log.txt" ), false ); - assertTrue( "Expected error message not found.", - indexOf( lines, ".*(parent)? version range.*does not specify an upper bound.*" ) >= 0 ); - + fail("Expected 'VerificationException' not thrown."); + } catch (final VerificationException e) { + assertNotNull(verifier); + final List lines = verifier.loadFile(new File(testDir, "log.txt"), false); + int msg = indexOf(lines, ".*Version must be a constant.*org.apache.maven.its.mng2199:expression.*"); + assertTrue("Expected error message not found.", msg >= 0); } } @Test - public void testValidParentVersionRangeInvalidVersionExpression() - throws Exception - { + public void testValidParentVersionRangeInvalidVersionInheritance() throws Exception { Verifier verifier = null; - File testDir = ResourceExtractor.simpleExtractResources( - getClass(), "/mng-2199-parent-version-range/expression" ); + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2199-parent-version-range/inherited"); - try - { - verifier = newVerifier( testDir.getAbsolutePath(), "remote" ); - verifier.setAutoclean( false ); - verifier.addCliArgument( "-U" ); - verifier.addCliArgument( "verify" ); + try { + verifier = newVerifier(testDir.getAbsolutePath(), "remote"); + verifier.setAutoclean(false); + verifier.addCliArgument("-U"); + verifier.addCliArgument("verify"); verifier.execute(); - fail( "Expected 'VerificationException' not thrown." ); - } - catch ( final VerificationException e ) - { - assertNotNull( verifier ); - final List lines = verifier.loadFile( new File( testDir, "log.txt" ), false ); - int msg = indexOf( lines, ".*Version must be a constant.*org.apache.maven.its.mng2199:expression.*" ); - assertTrue( "Expected error message not found.", msg >= 0 ); + fail("Expected 'VerificationException' not thrown."); + } catch (final VerificationException e) { + assertNotNull(verifier); + final List lines = verifier.loadFile(new File(testDir, "log.txt"), false); + int msg = indexOf(lines, ".*Version must be a constant.*org.apache.maven.its.mng2199:inherited.*"); + assertTrue("Expected error message not found.", msg >= 0); } } @Test - public void testValidParentVersionRangeInvalidVersionInheritance() - throws Exception - { + public void testValidLocalParentVersionRange() throws Exception { + failingMavenVersions("(,3.3.0),(3.3.9,3.5.0-alpha-0)"); Verifier verifier = null; File testDir = ResourceExtractor.simpleExtractResources( - getClass(), "/mng-2199-parent-version-range/inherited" ); + getClass(), "/mng-2199-parent-version-range/valid-local/child"); - try - { - verifier = newVerifier( testDir.getAbsolutePath(), "remote" ); - verifier.setAutoclean( false ); - verifier.addCliArgument( "-U" ); - verifier.addCliArgument( "verify" ); - verifier.execute(); - fail( "Expected 'VerificationException' not thrown." ); - } - catch ( final VerificationException e ) - { - assertNotNull( verifier ); - final List lines = verifier.loadFile( new File( testDir, "log.txt" ), false ); - int msg = indexOf( lines, ".*Version must be a constant.*org.apache.maven.its.mng2199:inherited.*" ); - assertTrue( "Expected error message not found.", msg >= 0 ); - } - } - - @Test - public void testValidLocalParentVersionRange() - throws Exception - { - failingMavenVersions( "(,3.3.0),(3.3.9,3.5.0-alpha-0)" ); - Verifier verifier = null; - File testDir = ResourceExtractor.simpleExtractResources( - getClass(), "/mng-2199-parent-version-range/valid-local/child" ); - - verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.addCliArgument( "verify" ); + verifier = newVerifier(testDir.getAbsolutePath()); + verifier.addCliArgument("verify"); verifier.execute(); verifier.verifyErrorFreeLog(); @@ -180,49 +154,41 @@ public class MavenITmng2199ParentVersionRangeTest // log, parent resolution failed. For this test, this really just tests the project on disk getting tested // is not corrupt. It's expected to find the local parent and not fall back to remote resolution. If it // falls back to remote resolution, this just catches the test project to be broken. - final List lines = verifier.loadFile( new File( testDir, "log.txt" ), false ); - assertFalse( "Unexpected error message found.", - indexOf( lines, ".*Failed to build parent project.*" ) >= 0 ); + final List lines = verifier.loadFile(new File(testDir, "log.txt"), false); + assertFalse("Unexpected error message found.", indexOf(lines, ".*Failed to build parent project.*") >= 0); } @Test - public void testInvalidLocalParentVersionRange() - throws Exception - { - failingMavenVersions( "[3.3.0,3.3.9)" ); + public void testInvalidLocalParentVersionRange() throws Exception { + failingMavenVersions("[3.3.0,3.3.9)"); // Fallback to remote resolution not tested here. Remote parent expected to not be available anywhere. Verifier verifier = null; File testDir = ResourceExtractor.simpleExtractResources( - getClass(), "/mng-2199-parent-version-range/invalid-local/child" ); + getClass(), "/mng-2199-parent-version-range/invalid-local/child"); - try - { - verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.addCliArgument( "verify" ); + try { + verifier = newVerifier(testDir.getAbsolutePath()); + verifier.addCliArgument("verify"); verifier.execute(); - fail( "Expected 'VerificationException' not thrown." ); - } - catch ( final VerificationException e ) - { - assertNotNull( verifier ); - final List lines = verifier.loadFile( new File( testDir, "log.txt" ), false ); - int msg = indexOf( lines, - ".*Non-resolvable parent POM org.apache.maven.its.mng2199:local-parent:\\[2,3\\].*" ); - assertTrue( "Expected error message not found.", msg >= 0 ); + fail("Expected 'VerificationException' not thrown."); + } catch (final VerificationException e) { + assertNotNull(verifier); + final List lines = verifier.loadFile(new File(testDir, "log.txt"), false); + int msg = + indexOf(lines, ".*Non-resolvable parent POM org.apache.maven.its.mng2199:local-parent:\\[2,3\\].*"); + assertTrue("Expected error message not found.", msg >= 0); } } @Test - public void testInvalidLocalParentVersionRangeFallingBackToRemote() - throws Exception - { - failingMavenVersions( "[3.3.9]" ); + public void testInvalidLocalParentVersionRangeFallingBackToRemote() throws Exception { + failingMavenVersions("[3.3.9]"); Verifier verifier = null; File testDir = ResourceExtractor.simpleExtractResources( - getClass(), "/mng-2199-parent-version-range/local-fallback-to-remote/child" ); + getClass(), "/mng-2199-parent-version-range/local-fallback-to-remote/child"); - verifier = newVerifier( testDir.getAbsolutePath(), "remote" ); - verifier.addCliArgument( "verify" ); + verifier = newVerifier(testDir.getAbsolutePath(), "remote"); + verifier.addCliArgument("verify"); verifier.execute(); verifier.verifyErrorFreeLog(); @@ -231,74 +197,59 @@ public class MavenITmng2199ParentVersionRangeTest // log, parent resolution failed. For this test, local parent resolution falls back to remote parent // resolution with a version range in use. If the warning message is in the logs, that remote parent // resolution failed unexpectedly. - final List lines = verifier.loadFile( new File( testDir, "log.txt" ), false ); - assertFalse( "Unexpected error message found.", - indexOf( lines, ".*Failed to build parent project.*" ) >= 0 ); + final List lines = verifier.loadFile(new File(testDir, "log.txt"), false); + assertFalse("Unexpected error message found.", indexOf(lines, ".*Failed to build parent project.*") >= 0); } @Test - public void testValidLocalParentVersionRangeInvalidVersionExpression() - throws Exception - { - failingMavenVersions( "(,3.5.0-alpha-0)" ); + public void testValidLocalParentVersionRangeInvalidVersionExpression() throws Exception { + failingMavenVersions("(,3.5.0-alpha-0)"); Verifier verifier = null; File testDir = ResourceExtractor.simpleExtractResources( - getClass(), "/mng-2199-parent-version-range/expression-local/child" ); + getClass(), "/mng-2199-parent-version-range/expression-local/child"); - try - { - verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.addCliArgument( "verify" ); + try { + verifier = newVerifier(testDir.getAbsolutePath()); + verifier.addCliArgument("verify"); verifier.execute(); - fail( "Expected 'VerificationException' not thrown." ); - } - catch ( final VerificationException e ) - { - assertNotNull( verifier ); - final List lines = verifier.loadFile( new File( testDir, "log.txt" ), false ); - int msg = indexOf( lines, ".*Version must be a constant.*org.apache.maven.its.mng2199:expression.*" ); - assertTrue( "Expected error message not found.", msg >= 0 ); + fail("Expected 'VerificationException' not thrown."); + } catch (final VerificationException e) { + assertNotNull(verifier); + final List lines = verifier.loadFile(new File(testDir, "log.txt"), false); + int msg = indexOf(lines, ".*Version must be a constant.*org.apache.maven.its.mng2199:expression.*"); + assertTrue("Expected error message not found.", msg >= 0); } } @Test - public void testValidLocalParentVersionRangeInvalidVersionInheritance() - throws Exception - { - failingMavenVersions( "(,3.5.0-alpha-0)" ); + public void testValidLocalParentVersionRangeInvalidVersionInheritance() throws Exception { + failingMavenVersions("(,3.5.0-alpha-0)"); Verifier verifier = null; File testDir = ResourceExtractor.simpleExtractResources( - getClass(), "/mng-2199-parent-version-range/inherited-local/child" ); + getClass(), "/mng-2199-parent-version-range/inherited-local/child"); - try - { - verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.addCliArgument( "verify" ); + try { + verifier = newVerifier(testDir.getAbsolutePath()); + verifier.addCliArgument("verify"); verifier.execute(); - fail( "Expected 'VerificationException' not thrown." ); - } - catch ( final VerificationException e ) - { - assertNotNull( verifier ); - final List lines = verifier.loadFile( new File( testDir, "log.txt" ), false ); - int msg = indexOf( lines, ".*Version must be a constant.*org.apache.maven.its.mng2199:inherited.*" ); - assertTrue( "Expected error message not found.", msg >= 0 ); + fail("Expected 'VerificationException' not thrown."); + } catch (final VerificationException e) { + assertNotNull(verifier); + final List lines = verifier.loadFile(new File(testDir, "log.txt"), false); + int msg = indexOf(lines, ".*Version must be a constant.*org.apache.maven.its.mng2199:inherited.*"); + assertTrue("Expected error message not found.", msg >= 0); } } - private static int indexOf( final List logLines, final String regex ) - { - final Pattern pattern = Pattern.compile( regex ); + private static int indexOf(final List logLines, final String regex) { + final Pattern pattern = Pattern.compile(regex); - for ( int i = 0, l0 = logLines.size(); i < l0; i++ ) - { - if ( pattern.matcher( logLines.get( i ) ).matches() ) - { + for (int i = 0, l0 = logLines.size(); i < l0; i++) { + if (pattern.matcher(logLines.get(i)).matches()) { return i; } } return -1; } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2201PluginConfigInterpolationTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2201PluginConfigInterpolationTest.java index bbf1690d0b..a7431714eb 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2201PluginConfigInterpolationTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2201PluginConfigInterpolationTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * */ -public class MavenITmng2201PluginConfigInterpolationTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng2201PluginConfigInterpolationTest extends AbstractMavenIntegrationTestCase { - public MavenITmng2201PluginConfigInterpolationTest() - { - super( "(2.0.8,)" ); + public MavenITmng2201PluginConfigInterpolationTest() { + super("(2.0.8,)"); } /** @@ -47,29 +42,30 @@ public class MavenITmng2201PluginConfigInterpolationTest * @throws Exception in case of failure */ @Test - public void testitMNG2201() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2201" ); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + public void testitMNG2201() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2201"); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/config.properties" ); - assertCanonicalFileEquals( new File( testDir, "target" ), new File( props.getProperty( "stringParam" ) ) ); - assertCanonicalFileEquals( new File( testDir, "target" ), new File( props.getProperty( "propertiesParam.buildDir" ) ) ); - assertCanonicalFileEquals( new File( testDir, "target" ), new File( props.getProperty( "mapParam.buildDir" ) ) ); - assertEquals( "4.0.0", props.getProperty( "domParam.children.modelVersion.0.value" ) ); - assertEquals( "org.apache.maven.its.it0104", props.getProperty( "domParam.children.groupId.0.value" ) ); - assertEquals( "1.0-SNAPSHOT", props.getProperty( "domParam.children.version.0.value" ) ); - assertEquals( "jar", props.getProperty( "domParam.children.packaging.0.value" ) ); - assertEquals( "http://maven.apache.org", props.getProperty( "domParam.children.url.0.value" ) ); - assertEquals( "Apache", props.getProperty( "domParam.children.organization.0.children.name.0.value" ) ); - assertCanonicalFileEquals( new File( testDir, "target" ), new File( props.getProperty( "domParam.children.build.0.children.directory.0.value" ) ) ); - assertCanonicalFileEquals( new File( testDir, "target/classes" ), new File( props.getProperty( "domParam.children.build.0.children.outputDirectory.0.value" ) ) ); + Properties props = verifier.loadProperties("target/config.properties"); + assertCanonicalFileEquals(new File(testDir, "target"), new File(props.getProperty("stringParam"))); + assertCanonicalFileEquals(new File(testDir, "target"), new File(props.getProperty("propertiesParam.buildDir"))); + assertCanonicalFileEquals(new File(testDir, "target"), new File(props.getProperty("mapParam.buildDir"))); + assertEquals("4.0.0", props.getProperty("domParam.children.modelVersion.0.value")); + assertEquals("org.apache.maven.its.it0104", props.getProperty("domParam.children.groupId.0.value")); + assertEquals("1.0-SNAPSHOT", props.getProperty("domParam.children.version.0.value")); + assertEquals("jar", props.getProperty("domParam.children.packaging.0.value")); + assertEquals("http://maven.apache.org", props.getProperty("domParam.children.url.0.value")); + assertEquals("Apache", props.getProperty("domParam.children.organization.0.children.name.0.value")); + assertCanonicalFileEquals( + new File(testDir, "target"), + new File(props.getProperty("domParam.children.build.0.children.directory.0.value"))); + assertCanonicalFileEquals( + new File(testDir, "target/classes"), + new File(props.getProperty("domParam.children.build.0.children.outputDirectory.0.value"))); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2222OutputDirectoryReactorResolutionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2222OutputDirectoryReactorResolutionTest.java index 1e4b541736..2a97e34fe3 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2222OutputDirectoryReactorResolutionTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2222OutputDirectoryReactorResolutionTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng2222OutputDirectoryReactorResolutionTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng2222OutputDirectoryReactorResolutionTest extends AbstractMavenIntegrationTestCase { - public MavenITmng2222OutputDirectoryReactorResolutionTest() - { - super( "[3.0-beta-1,)" ); + public MavenITmng2222OutputDirectoryReactorResolutionTest() { + super("[3.0-beta-1,)"); } /** @@ -49,22 +44,19 @@ public class MavenITmng2222OutputDirectoryReactorResolutionTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2222" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2222"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "mod-a/target" ); - verifier.deleteDirectory( "mod-b/target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng2222" ); - verifier.addCliArgument( "compile" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("mod-a/target"); + verifier.deleteDirectory("mod-b/target"); + verifier.deleteArtifacts("org.apache.maven.its.mng2222"); + verifier.addCliArgument("compile"); verifier.execute(); verifier.verifyErrorFreeLog(); - List classpath = verifier.loadLines( "mod-b/target/compile.txt", "UTF-8" ); - assertTrue( classpath.toString(), classpath.contains( "mod-a/target/classes" ) ); + List classpath = verifier.loadLines("mod-b/target/compile.txt", "UTF-8"); + assertTrue(classpath.toString(), classpath.contains("mod-a/target/classes")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2228ComponentInjectionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2228ComponentInjectionTest.java index 14627f07e6..4e6c91f22c 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2228ComponentInjectionTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2228ComponentInjectionTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng2228ComponentInjectionTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng2228ComponentInjectionTest extends AbstractMavenIntegrationTestCase { - public MavenITmng2228ComponentInjectionTest() - { - super( "(2.0.4,)" ); + public MavenITmng2228ComponentInjectionTest() { + super("(2.0.4,)"); } /** @@ -49,23 +44,20 @@ public class MavenITmng2228ComponentInjectionTest * @throws Exception in case of failure */ @Test - public void testitMNG2228() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2228" ); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng2228" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + public void testitMNG2228() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2228"); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng2228"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties apiProps = verifier.loadProperties( "target/api.properties" ); - assertEquals( "true", apiProps.getProperty( "org.apache.maven.its.mng2228.DefaultComponent" ) ); + Properties apiProps = verifier.loadProperties("target/api.properties"); + assertEquals("true", apiProps.getProperty("org.apache.maven.its.mng2228.DefaultComponent")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2234ActiveProfilesFromSettingsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2234ActiveProfilesFromSettingsTest.java index b6deb1c42f..9dde813e65 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2234ActiveProfilesFromSettingsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2234ActiveProfilesFromSettingsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,24 +16,21 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** * This is a test set for MNG-2234. */ -public class MavenITmng2234ActiveProfilesFromSettingsTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng2234ActiveProfilesFromSettingsTest extends AbstractMavenIntegrationTestCase { - public MavenITmng2234ActiveProfilesFromSettingsTest() - { - super( "(2.0.8,)" ); + public MavenITmng2234ActiveProfilesFromSettingsTest() { + super("(2.0.8,)"); } /** @@ -45,22 +40,19 @@ public class MavenITmng2234ActiveProfilesFromSettingsTest * @throws Exception in case of failure */ @Test - public void testitMNG2234() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2234" ); + public void testitMNG2234() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2234"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/touch.txt" ); + verifier.verifyFilePresent("target/touch.txt"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2254PomEncodingTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2254PomEncodingTest.java index f7377b7223..db82bec8b3 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2254PomEncodingTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2254PomEncodingTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -34,13 +32,10 @@ import org.junit.jupiter.api.Test; * @author Hervé Boutemy * */ -public class MavenITmng2254PomEncodingTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng2254PomEncodingTest extends AbstractMavenIntegrationTestCase { - public MavenITmng2254PomEncodingTest() - { - super( "(2.0.7,)" ); // 2.0.8+ + public MavenITmng2254PomEncodingTest() { + super("(2.0.7,)"); // 2.0.8+ } /** @@ -49,24 +44,22 @@ public class MavenITmng2254PomEncodingTest * @throws Exception in case of failure */ @Test - public void testitMNG2254 () - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2254" ); + public void testitMNG2254() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2254"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "utf-8/target" ); - verifier.deleteDirectory( "latin-1/target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("utf-8/target"); + verifier.deleteDirectory("latin-1/target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties utf8 = verifier.loadProperties( "utf-8/target/pom.properties" ); - assertEquals( "TEST-CHARS: \u00DF\u0131\u03A3\u042F\u05D0\u20AC", utf8.getProperty( "project.description" ) ); + Properties utf8 = verifier.loadProperties("utf-8/target/pom.properties"); + assertEquals("TEST-CHARS: \u00DF\u0131\u03A3\u042F\u05D0\u20AC", utf8.getProperty("project.description")); - Properties latin1 = verifier.loadProperties( "latin-1/target/pom.properties" ); - assertEquals( "TEST-CHARS: \u00C4\u00D6\u00DC\u00E4\u00F6\u00FC\u00DF", latin1.getProperty( "project.description" ) ); + Properties latin1 = verifier.loadProperties("latin-1/target/pom.properties"); + assertEquals( + "TEST-CHARS: \u00C4\u00D6\u00DC\u00E4\u00F6\u00FC\u00DF", latin1.getProperty("project.description")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2276ProfileActivationBySettingsPropertyTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2276ProfileActivationBySettingsPropertyTest.java index c679cbb117..e5a5b522c7 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2276ProfileActivationBySettingsPropertyTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2276ProfileActivationBySettingsPropertyTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng2276ProfileActivationBySettingsPropertyTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng2276ProfileActivationBySettingsPropertyTest extends AbstractMavenIntegrationTestCase { - public MavenITmng2276ProfileActivationBySettingsPropertyTest() - { - super( "[3.0-beta-1,)" ); + public MavenITmng2276ProfileActivationBySettingsPropertyTest() { + super("[3.0-beta-1,)"); } /** @@ -47,24 +42,22 @@ public class MavenITmng2276ProfileActivationBySettingsPropertyTest * @throws Exception in case of failure */ @Test - public void testitActivation() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2276" ); + public void testitActivation() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2276"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.setLogFileName( "log-1.txt" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.setLogFileName("log-1.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/profile.properties" ); - assertEquals( "settings", props.getProperty( "project.properties.settingsProperty" ) ); - assertEquals( "pom", props.getProperty( "project.properties.pomProperty" ) ); + Properties props = verifier.loadProperties("target/profile.properties"); + assertEquals("settings", props.getProperty("project.properties.settingsProperty")); + assertEquals("pom", props.getProperty("project.properties.pomProperty")); } /** @@ -73,25 +66,22 @@ public class MavenITmng2276ProfileActivationBySettingsPropertyTest * @throws Exception in case of failure */ @Test - public void testitCliWins() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2276" ); + public void testitCliWins() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2276"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "-DsettingsProperty=cli" ); - verifier.setLogFileName( "log-2.txt" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("-DsettingsProperty=cli"); + verifier.setLogFileName("log-2.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/profile.properties" ); - assertEquals( "settings", props.getProperty( "project.properties.settingsProperty" ) ); - assertEquals( "", props.getProperty( "project.properties.pomProperty", "" ) ); + Properties props = verifier.loadProperties("target/profile.properties"); + assertEquals("settings", props.getProperty("project.properties.settingsProperty")); + assertEquals("", props.getProperty("project.properties.pomProperty", "")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2277AggregatorAndResolutionPluginsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2277AggregatorAndResolutionPluginsTest.java index fdb2c1628e..cc077be045 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2277AggregatorAndResolutionPluginsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2277AggregatorAndResolutionPluginsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,27 +30,21 @@ import org.junit.jupiter.api.Test; * @author Brian Fox * */ -public class MavenITmng2277AggregatorAndResolutionPluginsTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng2277AggregatorAndResolutionPluginsTest extends AbstractMavenIntegrationTestCase { - public MavenITmng2277AggregatorAndResolutionPluginsTest() - { - super( "(2.0.7,)" ); // 2.0.8+ + public MavenITmng2277AggregatorAndResolutionPluginsTest() { + super("(2.0.7,)"); // 2.0.8+ } @Test - public void testitMNG2277() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2277" ); + public void testitMNG2277() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2277"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng2277" ); - verifier.addCliArgument( "org.apache.maven.its.plugins:maven-it-plugin-all:aggregator-dependencies" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng2277"); + verifier.addCliArgument("org.apache.maven.its.plugins:maven-it-plugin-all:aggregator-dependencies"); verifier.execute(); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2305MultipleProxiesTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2305MultipleProxiesTest.java index 17564e1dfb..3ade494f22 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2305MultipleProxiesTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2305MultipleProxiesTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,9 +16,7 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -31,6 +27,8 @@ import java.io.PrintWriter; import java.util.List; import java.util.Map; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.eclipse.jetty.server.HttpConfiguration; import org.eclipse.jetty.server.HttpConnectionFactory; import org.eclipse.jetty.server.NetworkConnector; @@ -50,13 +48,10 @@ import static org.eclipse.jetty.http.HttpVersion.HTTP_1_1; * * @author Benjamin Bentmann */ -public class MavenITmng2305MultipleProxiesTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng2305MultipleProxiesTest extends AbstractMavenIntegrationTestCase { - public MavenITmng2305MultipleProxiesTest() - { - super( "[3.0-alpha-3,)" ); + public MavenITmng2305MultipleProxiesTest() { + super("[3.0-alpha-3,)"); } /** @@ -66,121 +61,108 @@ public class MavenITmng2305MultipleProxiesTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2305" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2305"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); // NOTE: trust store cannot be reliably configured for the current JVM - verifier.setForkJvm( true ); + verifier.setForkJvm(true); // keytool -genkey -alias https.mngit -keypass key-passwd -keystore keystore -storepass store-passwd \ // -validity 4096 -dname "cn=https.mngit, ou=None, L=Seattle, ST=Washington, o=ExampleOrg, c=US" -keyalg RSA - String storePath = new File( testDir, "keystore" ).getAbsolutePath(); + String storePath = new File(testDir, "keystore").getAbsolutePath(); String storePwd = "store-passwd"; String keyPwd = "key-passwd"; - Server server = new Server( 0 ); - addHttpsConnector( server, storePath, storePwd, keyPwd ); - server.setHandler( new RepoHandler() ); + Server server = new Server(0); + addHttpsConnector(server, storePath, storePwd, keyPwd); + server.setHandler(new RepoHandler()); server.start(); - if ( server.isFailed() ) - { - fail( "Couldn't bind the server socket to a free port!" ); + if (server.isFailed()) { + fail("Couldn't bind the server socket to a free port!"); } - int httpPort = ( (NetworkConnector) server.getConnectors()[0] ).getLocalPort(); - System.out.println( "Bound server socket to HTTP port " + httpPort ); - int httpsPort = ( (NetworkConnector) server.getConnectors()[1] ).getLocalPort(); - System.out.println( "Bound server socket to HTTPS port " + httpsPort ); + int httpPort = ((NetworkConnector) server.getConnectors()[0]).getLocalPort(); + System.out.println("Bound server socket to HTTP port " + httpPort); + int httpsPort = ((NetworkConnector) server.getConnectors()[1]).getLocalPort(); + System.out.println("Bound server socket to HTTPS port " + httpsPort); - TunnelingProxyServer proxy = new TunnelingProxyServer( 0, "localhost", httpsPort, "https.mngit:443" ); + TunnelingProxyServer proxy = new TunnelingProxyServer(0, "localhost", httpsPort, "https.mngit:443"); proxy.start(); int proxyPort = proxy.getPort(); - System.out.println( "Bound server socket to the proxy port " + proxyPort ); + System.out.println("Bound server socket to the proxy port " + proxyPort); - try - { - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng2305" ); + try { + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng2305"); Map filterProps = verifier.newDefaultFilterMap(); - filterProps.put( "@proxy.http@", Integer.toString( httpPort ) ); - filterProps.put( "@proxy.https@", Integer.toString( proxyPort ) ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.setEnvironmentVariable( "MAVEN_OPTS", "-Djavax.net.ssl.trustStore=" + storePath + " -Djavax.net.ssl.trustStorePassword=" + storePwd ); - // disable concurrent downloading as not all wagons (e.g. wagon-lightweight-http) are thread-safe regarding proxy settings - verifier.addCliArgument( "-Dmaven.artifact.threads=1" ); - verifier.addCliArgument( "validate" ); + filterProps.put("@proxy.http@", Integer.toString(httpPort)); + filterProps.put("@proxy.https@", Integer.toString(proxyPort)); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8", filterProps); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.setEnvironmentVariable( + "MAVEN_OPTS", + "-Djavax.net.ssl.trustStore=" + storePath + " -Djavax.net.ssl.trustStorePassword=" + storePwd); + // disable concurrent downloading as not all wagons (e.g. wagon-lightweight-http) are thread-safe regarding + // proxy settings + verifier.addCliArgument("-Dmaven.artifact.threads=1"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - } - finally - { + } finally { proxy.stop(); server.stop(); server.join(); } - List cp = verifier.loadLines( "target/classpath.txt", "UTF-8" ); - assertTrue( cp.toString(), cp.contains( "http-0.1.jar" ) ); - assertTrue( cp.toString(), cp.contains( "https-0.1.jar" ) ); + List cp = verifier.loadLines("target/classpath.txt", "UTF-8"); + assertTrue(cp.toString(), cp.contains("http-0.1.jar")); + assertTrue(cp.toString(), cp.contains("https-0.1.jar")); } - private void addHttpsConnector( Server server, String keyStorePath, String keyStorePassword, String keyPassword ) - { - SslContextFactory sslContextFactory = new SslContextFactory( keyStorePath ); - sslContextFactory.setKeyStorePassword( keyStorePassword ); - sslContextFactory.setKeyManagerPassword( keyPassword ); + private void addHttpsConnector(Server server, String keyStorePath, String keyStorePassword, String keyPassword) { + SslContextFactory sslContextFactory = new SslContextFactory(keyStorePath); + sslContextFactory.setKeyStorePassword(keyStorePassword); + sslContextFactory.setKeyManagerPassword(keyPassword); HttpConfiguration httpConfiguration = new HttpConfiguration(); - httpConfiguration.setSecureScheme( "https" ); - HttpConfiguration httpsConfiguration = new HttpConfiguration( httpConfiguration ); - httpsConfiguration.addCustomizer( new SecureRequestCustomizer() ); - ServerConnector httpsConnector = new ServerConnector( server, - new SslConnectionFactory( sslContextFactory, HTTP_1_1.asString() ), - new HttpConnectionFactory( httpsConfiguration ) ); - server.addConnector( httpsConnector ); + httpConfiguration.setSecureScheme("https"); + HttpConfiguration httpsConfiguration = new HttpConfiguration(httpConfiguration); + httpsConfiguration.addCustomizer(new SecureRequestCustomizer()); + ServerConnector httpsConnector = new ServerConnector( + server, + new SslConnectionFactory(sslContextFactory, HTTP_1_1.asString()), + new HttpConnectionFactory(httpsConfiguration)); + server.addConnector(httpsConnector); } - static class RepoHandler extends AbstractHandler - { - public void handle( String target, Request baseRequest, HttpServletRequest request, - HttpServletResponse response ) - throws IOException - { + static class RepoHandler extends AbstractHandler { + public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) + throws IOException { PrintWriter writer = response.getWriter(); String uri = request.getRequestURI(); - if ( !uri.startsWith( "/repo/org/apache/maven/its/mng2305/" + request.getScheme() + "/" ) ) - { + if (!uri.startsWith("/repo/org/apache/maven/its/mng2305/" + request.getScheme() + "/")) { // HTTP connector serves only http-0.1.jar and HTTPS connector serves only https-0.1.jar - response.setStatus( HttpServletResponse.SC_NOT_FOUND ); - } - else if ( uri.endsWith( ".pom" ) ) - { - writer.println( "" ); - writer.println( " 4.0.0" ); - writer.println( " org.apache.maven.its.mng2305" ); - writer.println( " " + request.getScheme() + "" ); - writer.println( " 0.1" ); - writer.println( "" ); - response.setStatus( HttpServletResponse.SC_OK ); - } - else if ( uri.endsWith( ".jar" ) ) - { - writer.println( "empty" ); - response.setStatus( HttpServletResponse.SC_OK ); - } - else - { - response.setStatus( HttpServletResponse.SC_NOT_FOUND ); + response.setStatus(HttpServletResponse.SC_NOT_FOUND); + } else if (uri.endsWith(".pom")) { + writer.println(""); + writer.println(" 4.0.0"); + writer.println(" org.apache.maven.its.mng2305"); + writer.println(" " + request.getScheme() + ""); + writer.println(" 0.1"); + writer.println(""); + response.setStatus(HttpServletResponse.SC_OK); + } else if (uri.endsWith(".jar")) { + writer.println("empty"); + response.setStatus(HttpServletResponse.SC_OK); + } else { + response.setStatus(HttpServletResponse.SC_NOT_FOUND); } - ( (Request) request ).setHandled( true ); + ((Request) request).setHandled(true); } } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2309ProfileInjectionOrderTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2309ProfileInjectionOrderTest.java index 589c7a92a0..ae5c30b3e1 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2309ProfileInjectionOrderTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2309ProfileInjectionOrderTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng2309ProfileInjectionOrderTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng2309ProfileInjectionOrderTest extends AbstractMavenIntegrationTestCase { - public MavenITmng2309ProfileInjectionOrderTest() - { - super( "[2.0.5,)" ); + public MavenITmng2309ProfileInjectionOrderTest() { + super("[2.0.5,)"); } /** @@ -48,40 +43,32 @@ public class MavenITmng2309ProfileInjectionOrderTest * @throws Exception in case of failure */ @Test - public void testitMNG2309() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2309" ); + public void testitMNG2309() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2309"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - if ( matchesVersionRange( "[4.0.0-alpha-1,)" ) ) - { - verifier.addCliArgument( "-P" - + "pom-a,pom-b,pom-e,pom-c,pom-d" - + ",settings-a,settings-b,settings-e,settings-c,settings-d" ); - } - else - { - verifier.addCliArgument( "-P" + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + if (matchesVersionRange("[4.0.0-alpha-1,)")) { + verifier.addCliArgument( + "-P" + "pom-a,pom-b,pom-e,pom-c,pom-d" + ",settings-a,settings-b,settings-e,settings-c,settings-d"); + } else { + verifier.addCliArgument("-P" + "pom-a,pom-b,pom-e,pom-c,pom-d" + ",profiles-a,profiles-b,profiles-e,profiles-c,profiles-d" - + ",settings-a,settings-b,settings-e,settings-c,settings-d" ); + + ",settings-a,settings-b,settings-e,settings-c,settings-d"); } - verifier.addCliArgument( "validate" ); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/pom.properties" ); - assertEquals( "e", props.getProperty( "project.properties.pomProperty" ) ); - assertEquals( "e", props.getProperty( "project.properties.settingsProperty" ) ); - if ( matchesVersionRange( "(,3.0-alpha-1)" ) ) - { + Properties props = verifier.loadProperties("target/pom.properties"); + assertEquals("e", props.getProperty("project.properties.pomProperty")); + assertEquals("e", props.getProperty("project.properties.settingsProperty")); + if (matchesVersionRange("(,3.0-alpha-1)")) { // MNG-4060, profiles.xml support dropped - assertEquals( "e", props.getProperty( "project.properties.profilesProperty" ) ); + assertEquals("e", props.getProperty("project.properties.profilesProperty")); } } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2318LocalParentResolutionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2318LocalParentResolutionTest.java index 644aedd96c..62bbe96a5f 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2318LocalParentResolutionTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2318LocalParentResolutionTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * * */ -public class MavenITmng2318LocalParentResolutionTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng2318LocalParentResolutionTest extends AbstractMavenIntegrationTestCase { - public MavenITmng2318LocalParentResolutionTest() - { - super( "(2.0.6,)" ); + public MavenITmng2318LocalParentResolutionTest() { + super("(2.0.6,)"); } /** @@ -46,16 +41,13 @@ public class MavenITmng2318LocalParentResolutionTest * @throws Exception in case of failure */ @Test - public void testitMNG2318() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2318" ); + public void testitMNG2318() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2318"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2339BadProjectInterpolationTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2339BadProjectInterpolationTest.java index 1e8285f89d..fd95d1748a 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2339BadProjectInterpolationTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2339BadProjectInterpolationTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,38 +16,33 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** * This is a test set for MNG-2339. */ -public class MavenITmng2339BadProjectInterpolationTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng2339BadProjectInterpolationTest() - { - super( "(2.0.8,)" ); // 2.0.9+ +public class MavenITmng2339BadProjectInterpolationTest extends AbstractMavenIntegrationTestCase { + public MavenITmng2339BadProjectInterpolationTest() { + super("(2.0.8,)"); // 2.0.9+ } @Test - public void testitMNG2339a() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2339/a" ); + public void testitMNG2339a() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2339/a"); Verifier verifier; - verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); + verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); - verifier.addCliArgument( "-Dversion=foo" ); - verifier.addCliArgument( "validate" ); + verifier.addCliArgument("-Dversion=foo"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); @@ -57,40 +50,39 @@ public class MavenITmng2339BadProjectInterpolationTest // test that -Dversion=1.0 is still available for interpolation. @Test - public void testitMNG2339b() - throws Exception - { - requiresMavenVersion( "(2.0.8,4.0.0-alpha-1)" ); - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2339/b" ); + public void testitMNG2339b() throws Exception { + requiresMavenVersion("(2.0.8,4.0.0-alpha-1)"); + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2339/b"); Verifier verifier; - verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); + verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); - verifier.setLogFileName( "log-pom-specified.txt" ); - verifier.addCliArgument( "initialize" ); + verifier.setLogFileName("log-pom-specified.txt"); + verifier.addCliArgument("initialize"); verifier.execute(); - assertTrue( "Touchfile using ${project.version} for ${version} does not exist.", - new File( testDir, "target/touch-1.txt" ).exists() ); + assertTrue( + "Touchfile using ${project.version} for ${version} does not exist.", + new File(testDir, "target/touch-1.txt").exists()); verifier.verifyErrorFreeLog(); - verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); + verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); - verifier.addCliArgument( "-Dversion=2" ); - verifier.setLogFileName( "log-cli-specified.txt" ); - verifier.addCliArgument( "initialize" ); + verifier.addCliArgument("-Dversion=2"); + verifier.setLogFileName("log-cli-specified.txt"); + verifier.addCliArgument("initialize"); verifier.execute(); verifier.verifyErrorFreeLog(); - assertTrue( "Touchfile using CLI-specified ${version} does not exist.", - new File( testDir, "target/touch-2.txt" ).exists() ); + assertTrue( + "Touchfile using CLI-specified ${version} does not exist.", + new File(testDir, "target/touch-2.txt").exists()); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2362DeployedPomEncodingTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2362DeployedPomEncodingTest.java index 3676b52645..cfa240138c 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2362DeployedPomEncodingTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2362DeployedPomEncodingTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import org.apache.maven.shared.utils.io.FileUtils; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng2362DeployedPomEncodingTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng2362DeployedPomEncodingTest extends AbstractMavenIntegrationTestCase { - public MavenITmng2362DeployedPomEncodingTest() - { - super( "[2.0.5,)" ); + public MavenITmng2362DeployedPomEncodingTest() { + super("[2.0.5,)"); } /** @@ -48,58 +43,50 @@ public class MavenITmng2362DeployedPomEncodingTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2362" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2362"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "utf-8/target" ); - verifier.deleteDirectory( "latin-1/target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng2362" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("utf-8/target"); + verifier.deleteDirectory("latin-1/target"); + verifier.deleteArtifacts("org.apache.maven.its.mng2362"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); File pomFile; - pomFile = new File( verifier.getArtifactPath( "org.apache.maven.its.mng2362", "utf-8", "0.1", "pom" ) ); - assertPomUtf8( pomFile ); + pomFile = new File(verifier.getArtifactPath("org.apache.maven.its.mng2362", "utf-8", "0.1", "pom")); + assertPomUtf8(pomFile); - pomFile = new File( testDir, "utf-8/target/repo/org/apache/maven/its/mng2362/utf-8/0.1/utf-8-0.1.pom" ); - assertPomUtf8( pomFile ); + pomFile = new File(testDir, "utf-8/target/repo/org/apache/maven/its/mng2362/utf-8/0.1/utf-8-0.1.pom"); + assertPomUtf8(pomFile); - pomFile = new File( verifier.getArtifactPath( "org.apache.maven.its.mng2362", "latin-1", "0.1", "pom" ) ); - assertPomLatin1( pomFile ); + pomFile = new File(verifier.getArtifactPath("org.apache.maven.its.mng2362", "latin-1", "0.1", "pom")); + assertPomLatin1(pomFile); - pomFile = new File( testDir, "latin-1/target/repo/org/apache/maven/its/mng2362/latin-1/0.1/latin-1-0.1.pom" ); - assertPomLatin1( pomFile ); + pomFile = new File(testDir, "latin-1/target/repo/org/apache/maven/its/mng2362/latin-1/0.1/latin-1-0.1.pom"); + assertPomLatin1(pomFile); } - private void assertPomUtf8( File pomFile ) - throws Exception - { - String pom = FileUtils.fileRead( pomFile, "UTF-8" ); + private void assertPomUtf8(File pomFile) throws Exception { + String pom = FileUtils.fileRead(pomFile, "UTF-8"); String chars = "\u00DF\u0131\u03A3\u042F\u05D0\u20AC"; - assertPom( pomFile, pom, chars ); + assertPom(pomFile, pom, chars); } - private void assertPomLatin1( File pomFile ) - throws Exception - { - String pom = FileUtils.fileRead( pomFile, "ISO-8859-1" ); + private void assertPomLatin1(File pomFile) throws Exception { + String pom = FileUtils.fileRead(pomFile, "ISO-8859-1"); String chars = "\u00C4\u00D6\u00DC\u00E4\u00F6\u00FC\u00DF"; - assertPom( pomFile, pom, chars ); + assertPom(pomFile, pom, chars); } - private void assertPom( File pomFile, String pom, String chars ) - throws Exception - { + private void assertPom(File pomFile, String pom, String chars) throws Exception { String prefix = "TEST-CHARS: "; - int pos = pom.indexOf( prefix ); - assertTrue( "Corrupt data " + pom.substring( pos, pos + prefix.length() + chars.length() ) + " in " + pomFile, - pom.contains( prefix + chars ) ); + int pos = pom.indexOf(prefix); + assertTrue( + "Corrupt data " + pom.substring(pos, pos + prefix.length() + chars.length()) + " in " + pomFile, + pom.contains(prefix + chars)); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2363BasedirAwareFileActivatorTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2363BasedirAwareFileActivatorTest.java index df46063701..5667b2b935 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2363BasedirAwareFileActivatorTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2363BasedirAwareFileActivatorTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng2363BasedirAwareFileActivatorTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng2363BasedirAwareFileActivatorTest extends AbstractMavenIntegrationTestCase { - public MavenITmng2363BasedirAwareFileActivatorTest() - { - super( "[3.0-alpha-3,)" ); + public MavenITmng2363BasedirAwareFileActivatorTest() { + super("[3.0-alpha-3,)"); } /** @@ -47,34 +42,31 @@ public class MavenITmng2363BasedirAwareFileActivatorTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2363" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2363"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteDirectory( "sub-a/target" ); - verifier.deleteDirectory( "sub-b/target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteDirectory("sub-a/target"); + verifier.deleteDirectory("sub-b/target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/parent1.txt" ); - verifier.verifyFilePresent( "target/parent2.txt" ); - verifier.verifyFileNotPresent( "target/file1.txt" ); - verifier.verifyFileNotPresent( "target/file2.txt" ); + verifier.verifyFilePresent("target/parent1.txt"); + verifier.verifyFilePresent("target/parent2.txt"); + verifier.verifyFileNotPresent("target/file1.txt"); + verifier.verifyFileNotPresent("target/file2.txt"); - verifier.verifyFileNotPresent( "sub-a/target/parent1.txt" ); - verifier.verifyFileNotPresent( "sub-a/target/parent2.txt" ); - verifier.verifyFilePresent( "sub-a/target/file1.txt" ); - verifier.verifyFileNotPresent( "sub-a/target/file2.txt" ); + verifier.verifyFileNotPresent("sub-a/target/parent1.txt"); + verifier.verifyFileNotPresent("sub-a/target/parent2.txt"); + verifier.verifyFilePresent("sub-a/target/file1.txt"); + verifier.verifyFileNotPresent("sub-a/target/file2.txt"); - verifier.verifyFileNotPresent( "sub-b/target/parent1.txt" ); - verifier.verifyFileNotPresent( "sub-b/target/parent2.txt" ); - verifier.verifyFileNotPresent( "sub-b/target/file1.txt" ); - verifier.verifyFilePresent( "sub-b/target/file2.txt" ); + verifier.verifyFileNotPresent("sub-b/target/parent1.txt"); + verifier.verifyFileNotPresent("sub-b/target/parent2.txt"); + verifier.verifyFileNotPresent("sub-b/target/file1.txt"); + verifier.verifyFilePresent("sub-b/target/file2.txt"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2387InactiveProxyTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2387InactiveProxyTest.java index 518dc791ab..fb7bc464ba 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2387InactiveProxyTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2387InactiveProxyTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.net.InetAddress; import java.util.Map; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.eclipse.jetty.server.Handler; import org.eclipse.jetty.server.NetworkConnector; import org.eclipse.jetty.server.Server; @@ -42,9 +40,7 @@ import org.junit.jupiter.api.Test; * @author Brett Porter * */ -public class MavenITmng2387InactiveProxyTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng2387InactiveProxyTest extends AbstractMavenIntegrationTestCase { private Server server; private int port; @@ -55,61 +51,52 @@ public class MavenITmng2387InactiveProxyTest private File testDir; - public MavenITmng2387InactiveProxyTest() - { - super( "[2.0.11,2.1.0-M1),[2.1.0,)" ); // 2.0.11+, 2.1.0+ + public MavenITmng2387InactiveProxyTest() { + super("[2.0.11,2.1.0-M1),[2.1.0,)"); // 2.0.11+, 2.1.0+ } @BeforeEach - protected void setUp() - throws Exception - { - testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2387" ); + protected void setUp() throws Exception { + testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2387"); ResourceHandler resourceHandler = new ResourceHandler(); - resourceHandler.setResourceBase( new File( testDir, "repo" ).getAbsolutePath() ); + resourceHandler.setResourceBase(new File(testDir, "repo").getAbsolutePath()); HandlerList handlers = new HandlerList(); - handlers.setHandlers( new Handler[] { resourceHandler, new DefaultHandler() } ); + handlers.setHandlers(new Handler[] {resourceHandler, new DefaultHandler()}); - server = new Server( 0 ); - server.setHandler( handlers ); + server = new Server(0); + server.setHandler(handlers); server.start(); - if ( server.isFailed() ) - { - fail( "Couldn't bind the server socket to a free port!" ); + if (server.isFailed()) { + fail("Couldn't bind the server socket to a free port!"); } - port = ( (NetworkConnector) server.getConnectors()[0] ).getLocalPort(); - System.out.println( "Bound server socket to the HTTP port " + port ); + port = ((NetworkConnector) server.getConnectors()[0]).getLocalPort(); + System.out.println("Bound server socket to the HTTP port " + port); resourceHandler = new ResourceHandler(); - resourceHandler.setResourceBase( new File( testDir, "proxy" ).getAbsolutePath() ); + resourceHandler.setResourceBase(new File(testDir, "proxy").getAbsolutePath()); handlers = new HandlerList(); - handlers.setHandlers( new Handler[] { resourceHandler, new DefaultHandler() } ); + handlers.setHandlers(new Handler[] {resourceHandler, new DefaultHandler()}); - proxyServer = new Server( 0 ); - proxyServer.setHandler( handlers ); + proxyServer = new Server(0); + proxyServer.setHandler(handlers); proxyServer.start(); - if ( proxyServer.isFailed() ) - { - fail( "Couldn't bind the server socket to a free port!" ); + if (proxyServer.isFailed()) { + fail("Couldn't bind the server socket to a free port!"); } - proxyPort = ( (NetworkConnector) proxyServer.getConnectors()[0] ).getLocalPort(); - System.out.println( "Bound server socket to the HTTPS port " + port ); + proxyPort = ((NetworkConnector) proxyServer.getConnectors()[0]).getLocalPort(); + System.out.println("Bound server socket to the HTTPS port " + port); } @AfterEach - protected void tearDown() - throws Exception - { - if ( server != null ) - { + protected void tearDown() throws Exception { + if (server != null) { server.stop(); server.join(); } - if ( proxyServer != null ) - { + if (proxyServer != null) { proxyServer.stop(); proxyServer.join(); } @@ -121,25 +108,23 @@ public class MavenITmng2387InactiveProxyTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); + public void testit() throws Exception { + Verifier verifier = newVerifier(testDir.getAbsolutePath()); Map properties = verifier.newDefaultFilterMap(); - properties.put( "@host@", InetAddress.getLoopbackAddress().getCanonicalHostName() ); - properties.put( "@port@", Integer.toString( port ) ); - properties.put( "@proxyPort@", Integer.toString( proxyPort ) ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", properties ); + properties.put("@host@", InetAddress.getLoopbackAddress().getCanonicalHostName()); + properties.put("@port@", Integer.toString(port)); + properties.put("@proxyPort@", Integer.toString(proxyPort)); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8", properties); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng2387" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng2387"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng2387", "a", "0.1", "jar" ); + verifier.verifyArtifactPresent("org.apache.maven.its.mng2387", "a", "0.1", "jar"); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2432PluginPrefixOrderTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2432PluginPrefixOrderTest.java index 860f0023e6..78594937e0 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2432PluginPrefixOrderTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2432PluginPrefixOrderTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng2432PluginPrefixOrderTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng2432PluginPrefixOrderTest extends AbstractMavenIntegrationTestCase { - public MavenITmng2432PluginPrefixOrderTest() - { - super( "[2.1.0,)" ); + public MavenITmng2432PluginPrefixOrderTest() { + super("[2.1.0,)"); } /** @@ -48,25 +43,22 @@ public class MavenITmng2432PluginPrefixOrderTest * @throws Exception in case of failure */ @Test - public void testitMNG2432() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2432" ); + public void testitMNG2432() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2432"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng2432.pom" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng2432.settings" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "it:touch" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng2432.pom"); + verifier.deleteArtifacts("org.apache.maven.its.mng2432.settings"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("it:touch"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFileNotPresent( "target/touch-settings.txt" ); - verifier.verifyFilePresent( "target/touch-pom.txt" ); + verifier.verifyFileNotPresent("target/touch-settings.txt"); + verifier.verifyFilePresent("target/touch-pom.txt"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2486TimestampedDependencyVersionInterpolationTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2486TimestampedDependencyVersionInterpolationTest.java index 91551afbd0..6fba8a255a 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2486TimestampedDependencyVersionInterpolationTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2486TimestampedDependencyVersionInterpolationTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng2486TimestampedDependencyVersionInterpolationTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng2486TimestampedDependencyVersionInterpolationTest extends AbstractMavenIntegrationTestCase { - public MavenITmng2486TimestampedDependencyVersionInterpolationTest() - { - super( "[2.0.5,)" ); + public MavenITmng2486TimestampedDependencyVersionInterpolationTest() { + super("[2.0.5,)"); } /** @@ -49,49 +44,46 @@ public class MavenITmng2486TimestampedDependencyVersionInterpolationTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2486" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2486"); Verifier verifier; - verifier = newVerifier( new File( testDir, "dep-a" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng2486" ); - verifier.addCliArgument( "validate" ); + verifier = newVerifier(new File(testDir, "dep-a").getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng2486"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier = newVerifier( new File( testDir, "parent" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + verifier = newVerifier(new File(testDir, "parent").getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier = newVerifier( new File( testDir, "dep-b" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + verifier = newVerifier(new File(testDir, "dep-b").getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier = newVerifier( new File( testDir, "test" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); + verifier = newVerifier(new File(testDir, "test").getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); // enforce remote resolution - verifier.deleteArtifacts( "org.apache.maven.its.mng2486" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + verifier.deleteArtifacts("org.apache.maven.its.mng2486"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List files = verifier.loadLines( "target/classpath.txt", "UTF-8" ); - assertTrue( files.toString(), files.contains( "dep-a-0.1-SNAPSHOT.jar" ) ); + List files = verifier.loadLines("target/classpath.txt", "UTF-8"); + assertTrue(files.toString(), files.contains("dep-a-0.1-SNAPSHOT.jar")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2562Timestamp322Test.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2562Timestamp322Test.java index 2e452273ec..9775616b5a 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2562Timestamp322Test.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2562Timestamp322Test.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,108 +16,98 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** * This is a test set for MNG-2562. */ -public class MavenITmng2562Timestamp322Test - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng2562Timestamp322Test extends AbstractMavenIntegrationTestCase { - public MavenITmng2562Timestamp322Test() - { - super( "[3.2.2,)" ); // 3.2.2+ only as we changed the timestamp format + public MavenITmng2562Timestamp322Test() { + super("[3.2.2,)"); // 3.2.2+ only as we changed the timestamp format } @Test - public void testitDefaultFormat() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2562/default" ); + public void testitDefaultFormat() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2562/default"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); Date now = new Date(); - Properties props = verifier.loadProperties( "target/pom.properties" ); + Properties props = verifier.loadProperties("target/pom.properties"); - String timestamp1 = props.getProperty( "project.properties.timestamp1", "" ); - assertTrue( timestamp1, timestamp1.matches( "\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z" ) ); - Date date = new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss'Z'" ).parse( timestamp1 ); - assertTrue( now + " vs " + date, Math.abs( now.getTime() - date.getTime() ) < 24 * 60 * 60 * 1000 ); + String timestamp1 = props.getProperty("project.properties.timestamp1", ""); + assertTrue(timestamp1, timestamp1.matches("\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z")); + Date date = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").parse(timestamp1); + assertTrue(now + " vs " + date, Math.abs(now.getTime() - date.getTime()) < 24 * 60 * 60 * 1000); - String timestamp2 = props.getProperty( "project.properties.timestamp2", "" ); - assertEquals( timestamp1, timestamp2 ); + String timestamp2 = props.getProperty("project.properties.timestamp2", ""); + assertEquals(timestamp1, timestamp2); } @Test - public void testitCustomFormat() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2562/custom" ); + public void testitCustomFormat() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2562/custom"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); Date now = new Date(); - Properties props = verifier.loadProperties( "target/pom.properties" ); + Properties props = verifier.loadProperties("target/pom.properties"); - String timestamp1 = props.getProperty( "project.properties.timestamp", "" ); - Date date = new SimpleDateFormat( "mm:HH dd-MM-yyyy" ).parse( timestamp1 ); - assertTrue( now + " vs " + date, Math.abs( now.getTime() - date.getTime() ) < 24 * 60 * 60 * 1000 ); + String timestamp1 = props.getProperty("project.properties.timestamp", ""); + Date date = new SimpleDateFormat("mm:HH dd-MM-yyyy").parse(timestamp1); + assertTrue(now + " vs " + date, Math.abs(now.getTime() - date.getTime()) < 24 * 60 * 60 * 1000); } @Test - public void testitSameValueAcrossModules() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2562/reactor" ); + public void testitSameValueAcrossModules() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2562/reactor"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteDirectory( "child-1/target" ); - verifier.deleteDirectory( "child-2/target" ); - verifier.deleteDirectory( "child-3/target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteDirectory("child-1/target"); + verifier.deleteDirectory("child-2/target"); + verifier.deleteDirectory("child-3/target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/pom.properties" ); - String timestamp = props.getProperty( "project.properties.timestamp", "" ); + Properties props = verifier.loadProperties("target/pom.properties"); + String timestamp = props.getProperty("project.properties.timestamp", ""); - Properties props1 = verifier.loadProperties( "child-1/target/pom.properties" ); - String timestamp1 = props1.getProperty( "project.properties.timestamp", "" ); + Properties props1 = verifier.loadProperties("child-1/target/pom.properties"); + String timestamp1 = props1.getProperty("project.properties.timestamp", ""); - Properties props2 = verifier.loadProperties( "child-2/target/pom.properties" ); - String timestamp2 = props2.getProperty( "project.properties.timestamp", "" ); + Properties props2 = verifier.loadProperties("child-2/target/pom.properties"); + String timestamp2 = props2.getProperty("project.properties.timestamp", ""); - Properties props3 = verifier.loadProperties( "child-3/target/pom.properties" ); - String timestamp3 = props3.getProperty( "project.properties.timestamp", "" ); + Properties props3 = verifier.loadProperties("child-3/target/pom.properties"); + String timestamp3 = props3.getProperty("project.properties.timestamp", ""); - assertEquals( timestamp, timestamp1 ); - assertEquals( timestamp, timestamp2 ); - assertEquals( timestamp, timestamp3 ); + assertEquals(timestamp, timestamp1); + assertEquals(timestamp, timestamp2); + assertEquals(timestamp, timestamp3); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2576MakeLikeReactorTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2576MakeLikeReactorTest.java index 583259c44f..4b04269966 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2576MakeLikeReactorTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2576MakeLikeReactorTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,23 +29,18 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng2576MakeLikeReactorTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng2576MakeLikeReactorTest extends AbstractMavenIntegrationTestCase { - public MavenITmng2576MakeLikeReactorTest() - { - super( "[2.1.0,)" ); + public MavenITmng2576MakeLikeReactorTest() { + super("[2.1.0,)"); } - private void clean( Verifier verifier ) - throws Exception - { - verifier.deleteDirectory( "target" ); - verifier.deleteDirectory( "sub-a/target" ); - verifier.deleteDirectory( "sub-b/target" ); - verifier.deleteDirectory( "sub-c/target" ); - verifier.deleteDirectory( "sub-d/target" ); + private void clean(Verifier verifier) throws Exception { + verifier.deleteDirectory("target"); + verifier.deleteDirectory("sub-a/target"); + verifier.deleteDirectory("sub-b/target"); + verifier.deleteDirectory("sub-c/target"); + verifier.deleteDirectory("sub-d/target"); } /** @@ -56,26 +49,24 @@ public class MavenITmng2576MakeLikeReactorTest * @throws Exception in case of failure */ @Test - public void testitMakeOnlyList() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2576" ); + public void testitMakeOnlyList() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2576"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - clean( verifier ); - verifier.addCliArgument( "-pl" ); - verifier.addCliArgument( "sub-b" ); - verifier.setLogFileName( "log-only.txt" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + clean(verifier); + verifier.addCliArgument("-pl"); + verifier.addCliArgument("sub-b"); + verifier.setLogFileName("log-only.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFileNotPresent( "target/touch.txt" ); - verifier.verifyFileNotPresent( "sub-a/target/touch.txt" ); - verifier.verifyFilePresent( "sub-b/target/touch.txt" ); - verifier.verifyFileNotPresent( "sub-c/target/touch.txt" ); - verifier.verifyFileNotPresent( "sub-d/target/touch.txt" ); + verifier.verifyFileNotPresent("target/touch.txt"); + verifier.verifyFileNotPresent("sub-a/target/touch.txt"); + verifier.verifyFilePresent("sub-b/target/touch.txt"); + verifier.verifyFileNotPresent("sub-c/target/touch.txt"); + verifier.verifyFileNotPresent("sub-d/target/touch.txt"); } /** @@ -84,27 +75,25 @@ public class MavenITmng2576MakeLikeReactorTest * @throws Exception in case of failure */ @Test - public void testitMakeUpstream() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2576" ); + public void testitMakeUpstream() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2576"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - clean( verifier ); - verifier.addCliArgument( "-pl" ); - verifier.addCliArgument( "sub-b" ); - verifier.addCliArgument( "-am" ); - verifier.setLogFileName( "log-upstream.txt" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + clean(verifier); + verifier.addCliArgument("-pl"); + verifier.addCliArgument("sub-b"); + verifier.addCliArgument("-am"); + verifier.setLogFileName("log-upstream.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/touch.txt" ); - verifier.verifyFilePresent( "sub-a/target/touch.txt" ); - verifier.verifyFilePresent( "sub-b/target/touch.txt" ); - verifier.verifyFileNotPresent( "sub-c/target/touch.txt" ); - verifier.verifyFileNotPresent( "sub-d/target/touch.txt" ); + verifier.verifyFilePresent("target/touch.txt"); + verifier.verifyFilePresent("sub-a/target/touch.txt"); + verifier.verifyFilePresent("sub-b/target/touch.txt"); + verifier.verifyFileNotPresent("sub-c/target/touch.txt"); + verifier.verifyFileNotPresent("sub-d/target/touch.txt"); } /** @@ -113,27 +102,25 @@ public class MavenITmng2576MakeLikeReactorTest * @throws Exception in case of failure */ @Test - public void testitMakeDownstream() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2576" ); + public void testitMakeDownstream() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2576"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - clean( verifier ); - verifier.addCliArgument( "-pl" ); - verifier.addCliArgument( "sub-b" ); - verifier.addCliArgument( "-amd" ); - verifier.setLogFileName( "log-downstream.txt" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + clean(verifier); + verifier.addCliArgument("-pl"); + verifier.addCliArgument("sub-b"); + verifier.addCliArgument("-amd"); + verifier.setLogFileName("log-downstream.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFileNotPresent( "target/touch.txt" ); - verifier.verifyFileNotPresent( "sub-a/target/touch.txt" ); - verifier.verifyFilePresent( "sub-b/target/touch.txt" ); - verifier.verifyFilePresent( "sub-c/target/touch.txt" ); - verifier.verifyFileNotPresent( "sub-d/target/touch.txt" ); + verifier.verifyFileNotPresent("target/touch.txt"); + verifier.verifyFileNotPresent("sub-a/target/touch.txt"); + verifier.verifyFilePresent("sub-b/target/touch.txt"); + verifier.verifyFilePresent("sub-c/target/touch.txt"); + verifier.verifyFileNotPresent("sub-d/target/touch.txt"); } /** @@ -142,28 +129,26 @@ public class MavenITmng2576MakeLikeReactorTest * @throws Exception in case of failure */ @Test - public void testitMakeBoth() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2576" ); + public void testitMakeBoth() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2576"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - clean( verifier ); - verifier.addCliArgument( "-pl" ); - verifier.addCliArgument( "sub-b" ); - verifier.addCliArgument( "-am" ); - verifier.addCliArgument( "-amd" ); - verifier.setLogFileName( "log-both.txt" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + clean(verifier); + verifier.addCliArgument("-pl"); + verifier.addCliArgument("sub-b"); + verifier.addCliArgument("-am"); + verifier.addCliArgument("-amd"); + verifier.setLogFileName("log-both.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/touch.txt" ); - verifier.verifyFilePresent( "sub-a/target/touch.txt" ); - verifier.verifyFilePresent( "sub-b/target/touch.txt" ); - verifier.verifyFilePresent( "sub-c/target/touch.txt" ); - verifier.verifyFileNotPresent( "sub-d/target/touch.txt" ); + verifier.verifyFilePresent("target/touch.txt"); + verifier.verifyFilePresent("sub-a/target/touch.txt"); + verifier.verifyFilePresent("sub-b/target/touch.txt"); + verifier.verifyFilePresent("sub-c/target/touch.txt"); + verifier.verifyFileNotPresent("sub-d/target/touch.txt"); } /** @@ -172,27 +157,25 @@ public class MavenITmng2576MakeLikeReactorTest * @throws Exception in case of failure */ @Test - public void testitMatchesByBasedir() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2576" ); + public void testitMatchesByBasedir() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2576"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - clean( verifier ); - verifier.verifyFileNotPresent( "sub-d/pom.xml" ); - verifier.addCliArgument( "-pl" ); - verifier.addCliArgument( "sub-d" ); - verifier.setLogFileName( "log-basedir.txt" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + clean(verifier); + verifier.verifyFileNotPresent("sub-d/pom.xml"); + verifier.addCliArgument("-pl"); + verifier.addCliArgument("sub-d"); + verifier.setLogFileName("log-basedir.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFileNotPresent( "target/touch.txt" ); - verifier.verifyFileNotPresent( "sub-a/target/touch.txt" ); - verifier.verifyFileNotPresent( "sub-b/target/touch.txt" ); - verifier.verifyFileNotPresent( "sub-c/target/touch.txt" ); - verifier.verifyFilePresent( "sub-d/target/touch.txt" ); + verifier.verifyFileNotPresent("target/touch.txt"); + verifier.verifyFileNotPresent("sub-a/target/touch.txt"); + verifier.verifyFileNotPresent("sub-b/target/touch.txt"); + verifier.verifyFileNotPresent("sub-c/target/touch.txt"); + verifier.verifyFilePresent("sub-d/target/touch.txt"); } /** @@ -201,30 +184,28 @@ public class MavenITmng2576MakeLikeReactorTest * @throws Exception in case of failure */ @Test - public void testitMatchesByBasedirPlus() - throws Exception - { + public void testitMatchesByBasedirPlus() throws Exception { // as per MNG-5230 - requiresMavenVersion( "[3.2,)" ); + requiresMavenVersion("[3.2,)"); - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2576" ); + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2576"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - clean( verifier ); - verifier.verifyFileNotPresent( "sub-d/pom.xml" ); - verifier.addCliArgument( "-pl" ); - verifier.addCliArgument( "+sub-d" ); - verifier.setLogFileName( "log-basedir-plus.txt" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + clean(verifier); + verifier.verifyFileNotPresent("sub-d/pom.xml"); + verifier.addCliArgument("-pl"); + verifier.addCliArgument("+sub-d"); + verifier.setLogFileName("log-basedir-plus.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFileNotPresent( "target/touch.txt" ); - verifier.verifyFileNotPresent( "sub-a/target/touch.txt" ); - verifier.verifyFileNotPresent( "sub-b/target/touch.txt" ); - verifier.verifyFileNotPresent( "sub-c/target/touch.txt" ); - verifier.verifyFilePresent( "sub-d/target/touch.txt" ); + verifier.verifyFileNotPresent("target/touch.txt"); + verifier.verifyFileNotPresent("sub-a/target/touch.txt"); + verifier.verifyFileNotPresent("sub-b/target/touch.txt"); + verifier.verifyFileNotPresent("sub-c/target/touch.txt"); + verifier.verifyFilePresent("sub-d/target/touch.txt"); } /** * Verify that the project list can also specify project ids. @@ -232,26 +213,24 @@ public class MavenITmng2576MakeLikeReactorTest * @throws Exception in case of failure */ @Test - public void testitMatchesById() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2576" ); + public void testitMatchesById() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2576"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - clean( verifier ); - verifier.addCliArgument( "-pl" ); - verifier.addCliArgument( "org.apache.maven.its.mng2576:sub-b" ); - verifier.setLogFileName( "log-id.txt" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + clean(verifier); + verifier.addCliArgument("-pl"); + verifier.addCliArgument("org.apache.maven.its.mng2576:sub-b"); + verifier.setLogFileName("log-id.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFileNotPresent( "target/touch.txt" ); - verifier.verifyFileNotPresent( "sub-a/target/touch.txt" ); - verifier.verifyFilePresent( "sub-b/target/touch.txt" ); - verifier.verifyFileNotPresent( "sub-c/target/touch.txt" ); - verifier.verifyFileNotPresent( "sub-d/target/touch.txt" ); + verifier.verifyFileNotPresent("target/touch.txt"); + verifier.verifyFileNotPresent("sub-a/target/touch.txt"); + verifier.verifyFilePresent("sub-b/target/touch.txt"); + verifier.verifyFileNotPresent("sub-c/target/touch.txt"); + verifier.verifyFileNotPresent("sub-d/target/touch.txt"); } /** @@ -260,29 +239,27 @@ public class MavenITmng2576MakeLikeReactorTest * @throws Exception in case of failure */ @Test - public void testitMatchesByArtifactId() - throws Exception - { + public void testitMatchesByArtifactId() throws Exception { // as per MNG-4244 - requiresMavenVersion( "[3.0-alpha-3,)" ); + requiresMavenVersion("[3.0-alpha-3,)"); - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2576" ); + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2576"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - clean( verifier ); - verifier.addCliArgument( "-pl" ); - verifier.addCliArgument( ":sub-b" ); - verifier.setLogFileName( "log-artifact-id.txt" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + clean(verifier); + verifier.addCliArgument("-pl"); + verifier.addCliArgument(":sub-b"); + verifier.setLogFileName("log-artifact-id.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFileNotPresent( "target/touch.txt" ); - verifier.verifyFileNotPresent( "sub-a/target/touch.txt" ); - verifier.verifyFilePresent( "sub-b/target/touch.txt" ); - verifier.verifyFileNotPresent( "sub-c/target/touch.txt" ); - verifier.verifyFileNotPresent( "sub-d/target/touch.txt" ); + verifier.verifyFileNotPresent("target/touch.txt"); + verifier.verifyFileNotPresent("sub-a/target/touch.txt"); + verifier.verifyFilePresent("sub-b/target/touch.txt"); + verifier.verifyFileNotPresent("sub-c/target/touch.txt"); + verifier.verifyFileNotPresent("sub-d/target/touch.txt"); } /** @@ -291,25 +268,22 @@ public class MavenITmng2576MakeLikeReactorTest * @throws Exception in case of failure */ @Test - public void testitResumeFrom() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2576" ); + public void testitResumeFrom() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2576"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - clean( verifier ); - verifier.addCliArgument( "-rf" ); - verifier.addCliArgument( "sub-b" ); - verifier.setLogFileName( "log-resume.txt" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + clean(verifier); + verifier.addCliArgument("-rf"); + verifier.addCliArgument("sub-b"); + verifier.setLogFileName("log-resume.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFileNotPresent( "target/touch.txt" ); - verifier.verifyFileNotPresent( "sub-a/target/touch.txt" ); - verifier.verifyFilePresent( "sub-b/target/touch.txt" ); - verifier.verifyFilePresent( "sub-c/target/touch.txt" ); + verifier.verifyFileNotPresent("target/touch.txt"); + verifier.verifyFileNotPresent("sub-a/target/touch.txt"); + verifier.verifyFilePresent("sub-b/target/touch.txt"); + verifier.verifyFilePresent("sub-c/target/touch.txt"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2577SettingsXmlInterpolationTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2577SettingsXmlInterpolationTest.java index 655623c038..1fddb9fb71 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2577SettingsXmlInterpolationTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2577SettingsXmlInterpolationTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng2577SettingsXmlInterpolationTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng2577SettingsXmlInterpolationTest extends AbstractMavenIntegrationTestCase { - public MavenITmng2577SettingsXmlInterpolationTest() - { - super( "[2.0.3,)" ); + public MavenITmng2577SettingsXmlInterpolationTest() { + super("[2.0.3,)"); } /** @@ -47,24 +42,22 @@ public class MavenITmng2577SettingsXmlInterpolationTest * @throws Exception in case of failure */ @Test - public void testitEnvVars() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2577" ); + public void testitEnvVars() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2577"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings-env.xml" ); - verifier.setEnvironmentVariable( "MNGIT", "env-var-test" ); - verifier.setLogFileName( "log-env.txt" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings-env.xml"); + verifier.setEnvironmentVariable("MNGIT", "env-var-test"); + verifier.setLogFileName("log-env.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/settings.properties" ); - assertEquals( "env-var-test", props.getProperty( "settings.servers.0.username" ) ); + Properties props = verifier.loadProperties("target/settings.properties"); + assertEquals("env-var-test", props.getProperty("settings.servers.0.username")); } /** @@ -73,27 +66,24 @@ public class MavenITmng2577SettingsXmlInterpolationTest * @throws Exception in case of failure */ @Test - public void testitSystemProps() - throws Exception - { - requiresMavenVersion( "[3.0-alpha-1,)" ); + public void testitSystemProps() throws Exception { + requiresMavenVersion("[3.0-alpha-1,)"); - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2577" ); + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2577"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings-sys.xml" ); - verifier.addCliArgument( "-Dusr.MNGIT=usr-prop-test" ); - verifier.setLogFileName( "log-sys.txt" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings-sys.xml"); + verifier.addCliArgument("-Dusr.MNGIT=usr-prop-test"); + verifier.setLogFileName("log-sys.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/settings.properties" ); - assertEquals( "usr-prop-test", props.getProperty( "settings.servers.0.username" ) ); - assertEquals( File.separator, props.getProperty( "settings.servers.0.password" ) ); + Properties props = verifier.loadProperties("target/settings.properties"); + assertEquals("usr-prop-test", props.getProperty("settings.servers.0.username")); + assertEquals(File.separator, props.getProperty("settings.servers.0.password")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2591MergeInheritedPluginConfigTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2591MergeInheritedPluginConfigTest.java index 83f7d53c58..1e6966f7a5 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2591MergeInheritedPluginConfigTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2591MergeInheritedPluginConfigTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng2591MergeInheritedPluginConfigTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng2591MergeInheritedPluginConfigTest extends AbstractMavenIntegrationTestCase { - public MavenITmng2591MergeInheritedPluginConfigTest() - { - super( "(2.0.7,)" ); + public MavenITmng2591MergeInheritedPluginConfigTest() { + super("(2.0.7,)"); } /** @@ -49,10 +44,8 @@ public class MavenITmng2591MergeInheritedPluginConfigTest * @throws Exception in case of failure */ @Test - public void testitNoProfile() - throws Exception - { - testit( "no-profile" ); + public void testitNoProfile() throws Exception { + testit("no-profile"); } /** @@ -62,44 +55,39 @@ public class MavenITmng2591MergeInheritedPluginConfigTest * @throws Exception in case of failure */ @Test - public void testitWithProfile() - throws Exception - { - testit( "with-profile" ); + public void testitWithProfile() throws Exception { + testit("with-profile"); } - private void testit( String project ) - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2591/" + project ); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "subproject/target" ); - verifier.addCliArgument( "validate" ); + private void testit(String project) throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2591/" + project); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("subproject/target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "subproject/target/config.properties" ); + Properties props = verifier.loadProperties("subproject/target/config.properties"); - assertEquals( "8", props.getProperty( "stringParams" ) ); - assertEquals( "PARENT-1", props.getProperty( "stringParams.0" ) ); - assertEquals( "PARENT-3", props.getProperty( "stringParams.1" ) ); - assertEquals( "PARENT-2", props.getProperty( "stringParams.2" ) ); - assertEquals( "PARENT-4", props.getProperty( "stringParams.3" ) ); - assertEquals( "CHILD-1", props.getProperty( "stringParams.4" ) ); - assertEquals( "CHILD-3", props.getProperty( "stringParams.5" ) ); - assertEquals( "CHILD-2", props.getProperty( "stringParams.6" ) ); - assertEquals( "CHILD-4", props.getProperty( "stringParams.7" ) ); + assertEquals("8", props.getProperty("stringParams")); + assertEquals("PARENT-1", props.getProperty("stringParams.0")); + assertEquals("PARENT-3", props.getProperty("stringParams.1")); + assertEquals("PARENT-2", props.getProperty("stringParams.2")); + assertEquals("PARENT-4", props.getProperty("stringParams.3")); + assertEquals("CHILD-1", props.getProperty("stringParams.4")); + assertEquals("CHILD-3", props.getProperty("stringParams.5")); + assertEquals("CHILD-2", props.getProperty("stringParams.6")); + assertEquals("CHILD-4", props.getProperty("stringParams.7")); - assertEquals( "8", props.getProperty( "listParam" ) ); - assertEquals( "PARENT-1", props.getProperty( "listParam.0" ) ); - assertEquals( "PARENT-3", props.getProperty( "listParam.1" ) ); - assertEquals( "PARENT-2", props.getProperty( "listParam.2" ) ); - assertEquals( "PARENT-4", props.getProperty( "listParam.3" ) ); - assertEquals( "CHILD-1", props.getProperty( "listParam.4" ) ); - assertEquals( "CHILD-3", props.getProperty( "listParam.5" ) ); - assertEquals( "CHILD-2", props.getProperty( "listParam.6" ) ); - assertEquals( "CHILD-4", props.getProperty( "listParam.7" ) ); + assertEquals("8", props.getProperty("listParam")); + assertEquals("PARENT-1", props.getProperty("listParam.0")); + assertEquals("PARENT-3", props.getProperty("listParam.1")); + assertEquals("PARENT-2", props.getProperty("listParam.2")); + assertEquals("PARENT-4", props.getProperty("listParam.3")); + assertEquals("CHILD-1", props.getProperty("listParam.4")); + assertEquals("CHILD-3", props.getProperty("listParam.5")); + assertEquals("CHILD-2", props.getProperty("listParam.6")); + assertEquals("CHILD-4", props.getProperty("listParam.7")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2605BogusProfileActivationTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2605BogusProfileActivationTest.java index d47427cfe4..c9a4104512 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2605BogusProfileActivationTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2605BogusProfileActivationTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng2605BogusProfileActivationTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng2605BogusProfileActivationTest extends AbstractMavenIntegrationTestCase { - public MavenITmng2605BogusProfileActivationTest() - { - super( "(2.0.10,2.1.0-M1),(2.1.0-M1,3.0-alpha-1),(3.0-alpha-1,)" ); + public MavenITmng2605BogusProfileActivationTest() { + super("(2.0.10,2.1.0-M1),(2.1.0-M1,3.0-alpha-1),(3.0-alpha-1,)"); } /** @@ -49,24 +44,21 @@ public class MavenITmng2605BogusProfileActivationTest * @throws Exception in case of failure */ @Test - public void testitMNG2605() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2605" ); + public void testitMNG2605() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2605"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/profile.properties" ); - assertNull( props.getProperty( "project.properties.pomProperty" ) ); - assertNull( props.getProperty( "project.properties.settingsProperty" ) ); - assertNull( props.getProperty( "project.properties.profilesProperty" ) ); + Properties props = verifier.loadProperties("target/profile.properties"); + assertNull(props.getProperty("project.properties.pomProperty")); + assertNull(props.getProperty("project.properties.settingsProperty")); + assertNull(props.getProperty("project.properties.profilesProperty")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2668UsePluginDependenciesForSortingTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2668UsePluginDependenciesForSortingTest.java index c9fc5a3157..55ecd507ac 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2668UsePluginDependenciesForSortingTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2668UsePluginDependenciesForSortingTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,30 +29,24 @@ import org.junit.jupiter.api.Test; * * */ -public class MavenITmng2668UsePluginDependenciesForSortingTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng2668UsePluginDependenciesForSortingTest extends AbstractMavenIntegrationTestCase { - public MavenITmng2668UsePluginDependenciesForSortingTest() - { - super( "(2.1.0-M1,3.0-alpha-1),[3.0-alpha-3,)" ); // 2.1.0-M2+ + public MavenITmng2668UsePluginDependenciesForSortingTest() { + super("(2.1.0-M1,3.0-alpha-1),[3.0-alpha-3,)"); // 2.1.0-M2+ } @Test - public void testitMNG2668() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2668" ); + public void testitMNG2668() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2668"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng2668" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng2668"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng2668", "project", "1.0-SNAPSHOT", "jar" ); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng2668", "tools", "1.0-SNAPSHOT", "jar" ); + verifier.verifyArtifactPresent("org.apache.maven.its.mng2668", "project", "1.0-SNAPSHOT", "jar"); + verifier.verifyArtifactPresent("org.apache.maven.its.mng2668", "tools", "1.0-SNAPSHOT", "jar"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2690MojoLoadingErrorsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2690MojoLoadingErrorsTest.java index 47058ac16f..b95c951fa0 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2690MojoLoadingErrorsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2690MojoLoadingErrorsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,16 +16,16 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; import java.io.IOException; import java.util.List; import java.util.regex.Pattern; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -39,150 +37,121 @@ import org.junit.jupiter.api.Test; * * @author jdcasey */ -public class MavenITmng2690MojoLoadingErrorsTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng2690MojoLoadingErrorsTest extends AbstractMavenIntegrationTestCase { - public MavenITmng2690MojoLoadingErrorsTest() - { - super( "(2.1.0-M1,)" ); + public MavenITmng2690MojoLoadingErrorsTest() { + super("(2.1.0-M1,)"); } @Test - public void testNoClassDefFromMojoLoad() - throws IOException, VerificationException - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2690/noclassdef-mojo" ); + public void testNoClassDefFromMojoLoad() throws IOException, VerificationException { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2690/noclassdef-mojo"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); - try - { - verifier.addCliArgument( "validate" ); + try { + verifier.addCliArgument("validate"); verifier.execute(); - fail( "should throw an error during execution." ); - } - catch ( VerificationException e ) - { + fail("should throw an error during execution."); + } catch (VerificationException e) { // expected...it'd be nice if we could get the specifics of the exception right here... } - List lines = verifier.loadFile( new File( testDir, "log.txt" ), false ); + List lines = verifier.loadFile(new File(testDir, "log.txt"), false); - int msg = indexOf( lines, "(?i).*required class is missing.*" ); - assertTrue( "User-friendly message was not found in output.", msg >= 0 ); + int msg = indexOf(lines, "(?i).*required class is missing.*"); + assertTrue("User-friendly message was not found in output.", msg >= 0); - int cls = lines.get( msg ).toString().replace( '/', '.' ).indexOf( "junit.framework.TestCase" ); - assertTrue( "Missing class name was not found in output.", cls >= 0 ); + int cls = lines.get(msg).toString().replace('/', '.').indexOf("junit.framework.TestCase"); + assertTrue("Missing class name was not found in output.", cls >= 0); } @Test - public void testNoClassDefFromMojoConfiguration() - throws IOException, VerificationException - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2690/noclassdef-param" ); + public void testNoClassDefFromMojoConfiguration() throws IOException, VerificationException { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2690/noclassdef-param"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); - try - { - verifier.addCliArgument( "validate" ); + try { + verifier.addCliArgument("validate"); verifier.execute(); - fail( "should throw an error during execution." ); - } - catch ( VerificationException e ) - { + fail("should throw an error during execution."); + } catch (VerificationException e) { // expected...it'd be nice if we could get the specifics of the exception right here... } - List lines = verifier.loadFile( new File( testDir, "log.txt" ), false ); + List lines = verifier.loadFile(new File(testDir, "log.txt"), false); - int msg = indexOf( lines, "(?i).*required class (i|wa)s missing( during (mojo )?configuration)?.*" ); - assertTrue( "User-friendly message was not found in output.", msg >= 0 ); + int msg = indexOf(lines, "(?i).*required class (i|wa)s missing( during (mojo )?configuration)?.*"); + assertTrue("User-friendly message was not found in output.", msg >= 0); - int cls = lines.get( msg ).toString().replace( '/', '.' ).indexOf( "junit.framework.TestCase" ); - assertTrue( "Missing class name was not found in output.", cls >= 0 ); + int cls = lines.get(msg).toString().replace('/', '.').indexOf("junit.framework.TestCase"); + assertTrue("Missing class name was not found in output.", cls >= 0); } @Test - public void testMojoComponentLookupException() - throws IOException, VerificationException - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2690/mojo-complookup" ); + public void testMojoComponentLookupException() throws IOException, VerificationException { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2690/mojo-complookup"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); - try - { - verifier.addCliArgument( "validate" ); + try { + verifier.addCliArgument("validate"); verifier.execute(); - fail( "should throw an error during execution." ); - } - catch ( VerificationException e ) - { + fail("should throw an error during execution."); + } catch (VerificationException e) { // expected...it'd be nice if we could get the specifics of the exception right here... } - List lines = verifier.loadFile( new File( testDir, "log.txt" ), false ); + List lines = verifier.loadFile(new File(testDir, "log.txt"), false); - String compLookupMsg = - "(?i).*unable to .* mojo 'mojo-component-lookup-exception' .* plugin " + String compLookupMsg = "(?i).*unable to .* mojo 'mojo-component-lookup-exception' .* plugin " + "'org\\.apache\\.maven\\.its\\.plugins:maven-it-plugin-error.*"; - assertTrue( "User-friendly message was not found in output.", indexOf( lines, compLookupMsg ) > 0 ); + assertTrue("User-friendly message was not found in output.", indexOf(lines, compLookupMsg) > 0); } @Test - public void testMojoRequirementComponentLookupException() - throws IOException, VerificationException - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2690/requirement-complookup" ); + public void testMojoRequirementComponentLookupException() throws IOException, VerificationException { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2690/requirement-complookup"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); - try - { - verifier.addCliArgument( "validate" ); + try { + verifier.addCliArgument("validate"); verifier.execute(); - fail( "should throw an error during execution." ); - } - catch ( VerificationException e ) - { + fail("should throw an error during execution."); + } catch (VerificationException e) { // expected...it'd be nice if we could get the specifics of the exception right here... } - List lines = verifier.loadFile( new File( testDir, "log.txt" ), false ); + List lines = verifier.loadFile(new File(testDir, "log.txt"), false); - String compLookupMsg = - "(?i).*unable to .* mojo 'requirement-component-lookup-exception' .* plugin " + String compLookupMsg = "(?i).*unable to .* mojo 'requirement-component-lookup-exception' .* plugin " + "'org\\.apache\\.maven\\.its\\.plugins:maven-it-plugin-error.*"; - assertTrue( "User-friendly message was not found in output.", indexOf( lines, compLookupMsg ) > 0 ); + assertTrue("User-friendly message was not found in output.", indexOf(lines, compLookupMsg) > 0); } - private int indexOf( List logLines, String regex ) - { - Pattern pattern = Pattern.compile( regex ); + private int indexOf(List logLines, String regex) { + Pattern pattern = Pattern.compile(regex); - for ( int i = 0; i < logLines.size(); i++ ) - { - String logLine = logLines.get( i ); + for (int i = 0; i < logLines.size(); i++) { + String logLine = logLines.get(i); - if ( pattern.matcher( logLine ).matches() ) - { + if (pattern.matcher(logLine).matches()) { return i; } } return -1; } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2693SitePluginRealmTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2693SitePluginRealmTest.java index ee5004bfa3..4835a865ce 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2693SitePluginRealmTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2693SitePluginRealmTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng2693SitePluginRealmTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng2693SitePluginRealmTest extends AbstractMavenIntegrationTestCase { - public MavenITmng2693SitePluginRealmTest() - { - super( "(2.0.2,)" ); + public MavenITmng2693SitePluginRealmTest() { + super("(2.0.2,)"); } /** @@ -47,30 +42,27 @@ public class MavenITmng2693SitePluginRealmTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2693" ); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "pre-site" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2693"); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("pre-site"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties pclProps = verifier.loadProperties( "target/pcl.properties" ); - assertNotNull( pclProps.getProperty( "org.apache.maven.plugin.coreit.ClassA" ) ); - assertNotNull( pclProps.getProperty( "org.apache.maven.plugin.coreit.ClassB" ) ); - assertNotNull( pclProps.getProperty( "org.apache.maven.plugin.coreit.SomeClass" ) ); - assertNotNull( pclProps.getProperty( "org/apache/maven/plugin/coreit/a.properties" ) ); - assertEquals( "1", pclProps.getProperty( "org/apache/maven/plugin/coreit/a.properties.count" ) ); - assertNotNull( pclProps.getProperty( "org/apache/maven/plugin/coreit/b.properties" ) ); - assertEquals( "1", pclProps.getProperty( "org/apache/maven/plugin/coreit/b.properties.count" ) ); - assertNotNull( pclProps.getProperty( "org/apache/maven/plugin/coreit/it.properties" ) ); - assertEquals( "2", pclProps.getProperty( "org/apache/maven/plugin/coreit/it.properties.count" ) ); + Properties pclProps = verifier.loadProperties("target/pcl.properties"); + assertNotNull(pclProps.getProperty("org.apache.maven.plugin.coreit.ClassA")); + assertNotNull(pclProps.getProperty("org.apache.maven.plugin.coreit.ClassB")); + assertNotNull(pclProps.getProperty("org.apache.maven.plugin.coreit.SomeClass")); + assertNotNull(pclProps.getProperty("org/apache/maven/plugin/coreit/a.properties")); + assertEquals("1", pclProps.getProperty("org/apache/maven/plugin/coreit/a.properties.count")); + assertNotNull(pclProps.getProperty("org/apache/maven/plugin/coreit/b.properties")); + assertEquals("1", pclProps.getProperty("org/apache/maven/plugin/coreit/b.properties.count")); + assertNotNull(pclProps.getProperty("org/apache/maven/plugin/coreit/it.properties")); + assertEquals("2", pclProps.getProperty("org/apache/maven/plugin/coreit/it.properties.count")); - Properties tcclProps = verifier.loadProperties( "target/tccl.properties" ); - assertEquals( pclProps, tcclProps ); + Properties tcclProps = verifier.loadProperties("target/tccl.properties"); + assertEquals(pclProps, tcclProps); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2695OfflinePluginSnapshotsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2695OfflinePluginSnapshotsTest.java index 62569d0be3..cf863cf73f 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2695OfflinePluginSnapshotsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2695OfflinePluginSnapshotsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -34,13 +32,10 @@ import org.junit.jupiter.api.Test; * @author Brian Fox * @author jdcasey */ -public class MavenITmng2695OfflinePluginSnapshotsTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng2695OfflinePluginSnapshotsTest extends AbstractMavenIntegrationTestCase { - public MavenITmng2695OfflinePluginSnapshotsTest() - { - super( "(2.0.9,2.1.0-M1),(2.1.0-M1,)" ); // only test in 2.0.10+, and not in 2.1.0-M1 + public MavenITmng2695OfflinePluginSnapshotsTest() { + super("(2.0.9,2.1.0-M1),(2.1.0-M1,)"); // only test in 2.0.10+, and not in 2.1.0-M1 } /** @@ -49,43 +44,40 @@ public class MavenITmng2695OfflinePluginSnapshotsTest * @throws Exception in case of failure */ @Test - public void testitMNG2695() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2695" ); + public void testitMNG2695() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2695"); { // phase 1: run build in online mode to fill local repo - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng2695" ); - verifier.setAutoclean( false ); - verifier.setLogFileName( "log1.txt" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng2695"); + verifier.setAutoclean(false); + verifier.setLogFileName("log1.txt"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); - verifier.verifyFilePresent( "target/a.txt" ); - verifier.verifyFilePresent( "target/b.txt" ); + verifier.verifyFilePresent("target/a.txt"); + verifier.verifyFilePresent("target/b.txt"); verifier.verifyErrorFreeLog(); } { // phase 2: run build in offline mode to check it still passes - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.deleteDirectory( "target" ); - verifier.setAutoclean( false ); - verifier.setLogFileName( "log2.txt" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "--offline" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.deleteDirectory("target"); + verifier.setAutoclean(false); + verifier.setLogFileName("log2.txt"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("--offline"); + verifier.addCliArgument("validate"); verifier.execute(); - verifier.verifyFilePresent( "target/a.txt" ); - verifier.verifyFilePresent( "target/b.txt" ); + verifier.verifyFilePresent("target/a.txt"); + verifier.verifyFilePresent("target/b.txt"); verifier.verifyErrorFreeLog(); } } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2720SiblingClasspathArtifactsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2720SiblingClasspathArtifactsTest.java index 76c3d604d9..8d85adfec4 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2720SiblingClasspathArtifactsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2720SiblingClasspathArtifactsTest.java @@ -7,7 +7,7 @@ * "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 + * 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 @@ -16,15 +16,13 @@ * specific language governing permissions and limitations * under the License. */ - package org.apache.maven.it; -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; - import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -40,65 +38,57 @@ import org.junit.jupiter.api.Test; * @author jdcasey * */ -public class MavenITmng2720SiblingClasspathArtifactsTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng2720SiblingClasspathArtifactsTest extends AbstractMavenIntegrationTestCase { - public MavenITmng2720SiblingClasspathArtifactsTest() - { - super( "[2.1.0,)" ); + public MavenITmng2720SiblingClasspathArtifactsTest() { + super("[2.1.0,)"); } @Test - public void testIT() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2720" ); + public void testIT() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2720"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteDirectory( "child2/target" ); - verifier.deleteDirectory( "child3/target" ); - verifier.addCliArgument( "initialize" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteDirectory("child2/target"); + verifier.deleteDirectory("child3/target"); + verifier.addCliArgument("initialize"); verifier.execute(); verifier.verifyErrorFreeLog(); List classPath; - classPath = verifier.loadLines( "child2/target/compile.txt", "UTF-8" ); - assertMainJar( classPath ); + classPath = verifier.loadLines("child2/target/compile.txt", "UTF-8"); + assertMainJar(classPath); - classPath = verifier.loadLines( "child2/target/runtime.txt", "UTF-8" ); - assertMainJar( classPath ); + classPath = verifier.loadLines("child2/target/runtime.txt", "UTF-8"); + assertMainJar(classPath); - classPath = verifier.loadLines( "child2/target/test.txt", "UTF-8" ); - assertMainJar( classPath ); + classPath = verifier.loadLines("child2/target/test.txt", "UTF-8"); + assertMainJar(classPath); - classPath = verifier.loadLines( "child3/target/compile.txt", "UTF-8" ); - assertTestJar( classPath ); + classPath = verifier.loadLines("child3/target/compile.txt", "UTF-8"); + assertTestJar(classPath); - classPath = verifier.loadLines( "child3/target/runtime.txt", "UTF-8" ); - assertTestJar( classPath ); + classPath = verifier.loadLines("child3/target/runtime.txt", "UTF-8"); + assertTestJar(classPath); - classPath = verifier.loadLines( "child3/target/test.txt", "UTF-8" ); - assertTestJar( classPath ); + classPath = verifier.loadLines("child3/target/test.txt", "UTF-8"); + assertTestJar(classPath); } - private void assertMainJar( List classPath ) - { - assertTrue( classPath.toString(), classPath.contains( "main.jar" ) ); - assertFalse( classPath.toString(), classPath.contains( "main" ) ); - assertFalse( classPath.toString(), classPath.contains( "test.jar" ) ); - assertFalse( classPath.toString(), classPath.contains( "test" ) ); + private void assertMainJar(List classPath) { + assertTrue(classPath.toString(), classPath.contains("main.jar")); + assertFalse(classPath.toString(), classPath.contains("main")); + assertFalse(classPath.toString(), classPath.contains("test.jar")); + assertFalse(classPath.toString(), classPath.contains("test")); } - private void assertTestJar( List classPath ) - { - assertFalse( classPath.toString(), classPath.contains( "main.jar" ) ); - assertFalse( classPath.toString(), classPath.contains( "main" ) ); - assertTrue( classPath.toString(), classPath.contains( "test.jar" ) ); - assertFalse( classPath.toString(), classPath.contains( "test" ) ); + private void assertTestJar(List classPath) { + assertFalse(classPath.toString(), classPath.contains("main.jar")); + assertFalse(classPath.toString(), classPath.contains("main")); + assertTrue(classPath.toString(), classPath.contains("test.jar")); + assertFalse(classPath.toString(), classPath.contains("test")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2738ProfileIdCollidesWithCliOptionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2738ProfileIdCollidesWithCliOptionTest.java index fc0bf46595..9eb1af17eb 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2738ProfileIdCollidesWithCliOptionTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2738ProfileIdCollidesWithCliOptionTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng2738ProfileIdCollidesWithCliOptionTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng2738ProfileIdCollidesWithCliOptionTest extends AbstractMavenIntegrationTestCase { - public MavenITmng2738ProfileIdCollidesWithCliOptionTest() - { - super( "[2.2.0,3.0-alpha-1),[3.0,)" ); + public MavenITmng2738ProfileIdCollidesWithCliOptionTest() { + super("[2.2.0,3.0-alpha-1),[3.0,)"); } /** @@ -47,20 +42,17 @@ public class MavenITmng2738ProfileIdCollidesWithCliOptionTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2738" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2738"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "-Pe" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("-Pe"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/touch.txt" ); + verifier.verifyFilePresent("target/touch.txt"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2739RequiredRepositoryElementsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2739RequiredRepositoryElementsTest.java index d532a07c2d..efc0379490 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2739RequiredRepositoryElementsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2739RequiredRepositoryElementsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -35,91 +33,70 @@ import org.junit.jupiter.api.Test; * @author Brian Fox * @author jdcasey */ -public class MavenITmng2739RequiredRepositoryElementsTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng2739RequiredRepositoryElementsTest() - { - super( "(2.0.9,)" ); // only test in 2.0.9+ +public class MavenITmng2739RequiredRepositoryElementsTest extends AbstractMavenIntegrationTestCase { + public MavenITmng2739RequiredRepositoryElementsTest() { + super("(2.0.9,)"); // only test in 2.0.9+ } @Test - public void testitMNG2739_RepositoryId() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2739/repo-id" ); + public void testitMNG2739_RepositoryId() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2739/repo-id"); Verifier verifier; - verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); + verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); - try - { - verifier.addCliArgument( "validate" ); + try { + verifier.addCliArgument("validate"); verifier.execute(); - fail( - "POM should NOT validate: repository element is missing in: " + new File( testDir, "pom.xml" ) ); - } - catch ( VerificationException e ) - { + fail("POM should NOT validate: repository element is missing in: " + new File(testDir, "pom.xml")); + } catch (VerificationException e) { // expected } - - List listing = verifier.loadFile( new File( testDir, "log.txt" ), false ); + List listing = verifier.loadFile(new File(testDir, "log.txt"), false); boolean foundNpe = false; - for ( String line : listing ) - { - if ( line.contains( "NullPointerException" ) ) - { + for (String line : listing) { + if (line.contains("NullPointerException")) { foundNpe = true; break; } } - assertFalse( "Missing repository-id should not result in a NullPointerException.", foundNpe ); + assertFalse("Missing repository-id should not result in a NullPointerException.", foundNpe); } @Test - public void testitMNG2739_RepositoryUrl() - throws Exception - { + public void testitMNG2739_RepositoryUrl() throws Exception { // The testdir is computed from the location of this // file. - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2739/repo-url" ); + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2739/repo-url"); Verifier verifier; - verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); + verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); - try - { - verifier.addCliArgument( "validate" ); + try { + verifier.addCliArgument("validate"); verifier.execute(); - fail( - "POM should NOT validate: repository element is missing in: " + new File( testDir, "pom.xml" ) ); - } - catch ( VerificationException e ) - { + fail("POM should NOT validate: repository element is missing in: " + new File(testDir, "pom.xml")); + } catch (VerificationException e) { // expected } - - List listing = verifier.loadFile( new File( testDir, "log.txt" ), false ); + List listing = verifier.loadFile(new File(testDir, "log.txt"), false); boolean foundNpe = false; - for ( String line : listing ) - { - if ( line.contains( "NullPointerException" ) ) - { + for (String line : listing) { + if (line.contains("NullPointerException")) { foundNpe = true; break; } } - assertFalse( "Missing repository-url should not result in a NullPointerException.", foundNpe ); + assertFalse("Missing repository-url should not result in a NullPointerException.", foundNpe); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2741PluginMetadataResolutionErrorMessageTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2741PluginMetadataResolutionErrorMessageTest.java index 8b78c44bc8..a82bbe0314 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2741PluginMetadataResolutionErrorMessageTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2741PluginMetadataResolutionErrorMessageTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * * */ -public class MavenITmng2741PluginMetadataResolutionErrorMessageTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng2741PluginMetadataResolutionErrorMessageTest extends AbstractMavenIntegrationTestCase { - public MavenITmng2741PluginMetadataResolutionErrorMessageTest() - { - super( "[2.1.0,3.0-alpha-1),[3.0-beta-1,)" ); + public MavenITmng2741PluginMetadataResolutionErrorMessageTest() { + super("[2.1.0,3.0-alpha-1),[3.0-beta-1,)"); } /** @@ -48,10 +43,8 @@ public class MavenITmng2741PluginMetadataResolutionErrorMessageTest * @throws Exception in case of failure */ @Test - public void testitPrefix() - throws Exception - { - testit( "prefix", "foo:bar" ); + public void testitPrefix() throws Exception { + testit("prefix", "foo:bar"); } /** @@ -60,54 +53,42 @@ public class MavenITmng2741PluginMetadataResolutionErrorMessageTest * @throws Exception in case of failure */ @Test - public void testitVersion() - throws Exception - { - testit( "version", "org.apache.maven.its.mng2741:maven-it-plugin:foo" ); + public void testitVersion() throws Exception { + testit("version", "org.apache.maven.its.mng2741:maven-it-plugin:foo"); } - private void testit( String test, String goal ) - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2741" ); + private void testit(String test, String goal) throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2741"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.setLogFileName( "log-" + test + ".txt" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - try - { - verifier.addCliArgument( goal ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.setLogFileName("log-" + test + ".txt"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + try { + verifier.addCliArgument(goal); verifier.execute(); - fail( "Build should have failed to resolve plugin prefix" ); - } - catch ( VerificationException e ) - { + fail("Build should have failed to resolve plugin prefix"); + } catch (VerificationException e) { boolean foundCause = false; - StringBuilder sb = new StringBuilder( ); - List lines = verifier.loadLines( verifier.getLogFileName(), "UTF-8" ); - for ( String line : lines ) - { - sb.append( line ).append( System.lineSeparator() ); - if ( line.matches( ".*Connection refused.*" ) ) - { + StringBuilder sb = new StringBuilder(); + List lines = verifier.loadLines(verifier.getLogFileName(), "UTF-8"); + for (String line : lines) { + sb.append(line).append(System.lineSeparator()); + if (line.matches(".*Connection refused.*")) { foundCause = true; break; } - if ( line.matches( ".*Connection to http://localhost:54312 refused.*" ) ) - { + if (line.matches(".*Connection to http://localhost:54312 refused.*")) { foundCause = true; break; } - if ( line.matches( ".*[Tt]ransfer failed for http://localhost:54312/repo/.*/maven-metadata.xml.*" ) ) - { + if (line.matches(".*[Tt]ransfer failed for http://localhost:54312/repo/.*/maven-metadata.xml.*")) { foundCause = true; break; } } - assertTrue( "Transfer error cause was not found: " + sb, foundCause ); + assertTrue("Transfer error cause was not found: " + sb, foundCause); } } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2744checksumVerificationTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2744checksumVerificationTest.java index 6ad14584c3..c5b752f707 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2744checksumVerificationTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2744checksumVerificationTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng2744checksumVerificationTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng2744checksumVerificationTest extends AbstractMavenIntegrationTestCase { - public MavenITmng2744checksumVerificationTest() - { - super( "(2.0.8,)" ); // only test in 2.0.9+ + public MavenITmng2744checksumVerificationTest() { + super("(2.0.8,)"); // only test in 2.0.9+ } /** @@ -47,25 +42,22 @@ public class MavenITmng2744checksumVerificationTest * @throws Exception in case of failure */ @Test - public void testitMNG2744() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2744" ); + public void testitMNG2744() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2744"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng2744" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng2744"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng2744", "a", "1", "jar" ); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng2744", "a", "1", "pom" ); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng2744", "b", "1", "jar" ); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng2744", "b", "1", "pom" ); + verifier.verifyArtifactPresent("org.apache.maven.its.mng2744", "a", "1", "jar"); + verifier.verifyArtifactPresent("org.apache.maven.its.mng2744", "a", "1", "pom"); + verifier.verifyArtifactPresent("org.apache.maven.its.mng2744", "b", "1", "jar"); + verifier.verifyArtifactPresent("org.apache.maven.its.mng2744", "b", "1", "pom"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2749ExtensionAvailableToPluginTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2749ExtensionAvailableToPluginTest.java index c680546740..6daf9fa87e 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2749ExtensionAvailableToPluginTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2749ExtensionAvailableToPluginTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng2749ExtensionAvailableToPluginTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng2749ExtensionAvailableToPluginTest extends AbstractMavenIntegrationTestCase { - public MavenITmng2749ExtensionAvailableToPluginTest() - { - super( "(2.0.2,)" ); + public MavenITmng2749ExtensionAvailableToPluginTest() { + super("(2.0.2,)"); } /** @@ -48,27 +43,24 @@ public class MavenITmng2749ExtensionAvailableToPluginTest * @throws Exception in case of failure */ @Test - public void testitMNG2749() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2749" ); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng2749" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + public void testitMNG2749() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2749"); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng2749"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties pclProps = verifier.loadProperties( "target/pcl.properties" ); - assertNotNull( pclProps.getProperty( "org.apache.maven.its.mng2749.ExtensionClass" ) ); - assertNotNull( pclProps.getProperty( "org/apache/maven/its/mng2749/extension.properties" ) ); + Properties pclProps = verifier.loadProperties("target/pcl.properties"); + assertNotNull(pclProps.getProperty("org.apache.maven.its.mng2749.ExtensionClass")); + assertNotNull(pclProps.getProperty("org/apache/maven/its/mng2749/extension.properties")); - Properties tcclProps = verifier.loadProperties( "target/tccl.properties" ); - assertEquals( pclProps, tcclProps ); + Properties tcclProps = verifier.loadProperties("target/tccl.properties"); + assertEquals(pclProps, tcclProps); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2771PomExtensionComponentOverrideTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2771PomExtensionComponentOverrideTest.java index 76f446a1bb..e55cec9e35 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2771PomExtensionComponentOverrideTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2771PomExtensionComponentOverrideTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; @@ -34,12 +32,9 @@ import org.junit.jupiter.api.Test; * */ @Disabled -public class MavenITmng2771PomExtensionComponentOverrideTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng2771PomExtensionComponentOverrideTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenITmng2771PomExtensionComponentOverrideTest extends AbstractMavenIntegrationTestCase { + public MavenITmng2771PomExtensionComponentOverrideTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -48,24 +43,22 @@ public class MavenITmng2771PomExtensionComponentOverrideTest * @throws Exception in case of failure */ @Test - public void testitMNG2771() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2771/extension" ); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.addCliArgument( "install" ); + public void testitMNG2771() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2771/extension"); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); - testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2771/plugin" ); - verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.addCliArgument( "install" ); + testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2771/plugin"); + verifier = newVerifier(testDir.getAbsolutePath()); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); - testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2771/project" ); - verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.addCliArgument( "verify" ); + testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2771/project"); + verifier = newVerifier(testDir.getAbsolutePath()); + verifier.addCliArgument("verify"); verifier.execute(); verifier.verifyErrorFreeLog(); } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2790LastUpdatedMetadataTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2790LastUpdatedMetadataTest.java index b9eb5297ea..48b389518d 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2790LastUpdatedMetadataTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2790LastUpdatedMetadataTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,9 +16,7 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.text.SimpleDateFormat; @@ -28,6 +24,8 @@ import java.util.Date; import java.util.TimeZone; import org.apache.maven.shared.utils.io.FileUtils; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -36,13 +34,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng2790LastUpdatedMetadataTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng2790LastUpdatedMetadataTest extends AbstractMavenIntegrationTestCase { - public MavenITmng2790LastUpdatedMetadataTest() - { - super( "(2.0.4,)" ); + public MavenITmng2790LastUpdatedMetadataTest() { + super("(2.0.4,)"); } /** @@ -51,67 +46,65 @@ public class MavenITmng2790LastUpdatedMetadataTest * @throws Exception in case of failure */ @Test - public void testitMNG2790() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2790" ); + public void testitMNG2790() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2790"); Date now = new Date(); /* * Phase 1: Install initial snapshot into local repo. */ - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.deleteArtifacts( "org.apache.maven.its.mng2790" ); - verifier.setAutoclean( false ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.deleteArtifacts("org.apache.maven.its.mng2790"); + verifier.setAutoclean(false); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); File metadataArtifactVersionFile = - new File( verifier.getArtifactMetadataPath( "org.apache.maven.its.mng2790", "project", "1.0-SNAPSHOT" ) ); + new File(verifier.getArtifactMetadataPath("org.apache.maven.its.mng2790", "project", "1.0-SNAPSHOT")); File metadataArtifactFile = - new File( verifier.getArtifactMetadataPath( "org.apache.maven.its.mng2790", "project" ) ); + new File(verifier.getArtifactMetadataPath("org.apache.maven.its.mng2790", "project")); - Date artifactVersionLastUpdated1 = getLastUpdated( metadataArtifactVersionFile ); - Date artifactLastUpdated1 = getLastUpdated( metadataArtifactFile ); + Date artifactVersionLastUpdated1 = getLastUpdated(metadataArtifactVersionFile); + Date artifactLastUpdated1 = getLastUpdated(metadataArtifactFile); // sanity check: timestamps shouldn't differ by more than 10 min from now (i.e. timezone is UTC) - assertTrue( artifactVersionLastUpdated1 + " ~ " + now, - Math.abs( artifactVersionLastUpdated1.getTime() - now.getTime() ) < 10 * 60 * 1000 ); - assertTrue( artifactLastUpdated1 + " ~ " + now, - Math.abs( artifactLastUpdated1.getTime() - now.getTime() ) < 10 * 60 * 1000 ); + assertTrue( + artifactVersionLastUpdated1 + " ~ " + now, + Math.abs(artifactVersionLastUpdated1.getTime() - now.getTime()) < 10 * 60 * 1000); + assertTrue( + artifactLastUpdated1 + " ~ " + now, + Math.abs(artifactLastUpdated1.getTime() - now.getTime()) < 10 * 60 * 1000); // enforce some advance of time - Thread.sleep( 1000 ); + Thread.sleep(1000); /* * Phase 2: Re-install snapshot and check for proper timestamp update in local metadata. */ - verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.addCliArgument( "validate" ); + verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Date artifactVersionLastUpdated2 = getLastUpdated( metadataArtifactVersionFile ); - Date artifactLastUpdated2 = getLastUpdated( metadataArtifactFile ); + Date artifactVersionLastUpdated2 = getLastUpdated(metadataArtifactVersionFile); + Date artifactLastUpdated2 = getLastUpdated(metadataArtifactFile); // check that new timestamps are strictly later than from original install - assertTrue( artifactVersionLastUpdated1 + " < " + artifactVersionLastUpdated2, - artifactVersionLastUpdated2.after( artifactVersionLastUpdated1 ) ); - assertTrue( artifactLastUpdated1 + " < " + artifactLastUpdated2, - artifactLastUpdated2.after( artifactLastUpdated1 ) ); + assertTrue( + artifactVersionLastUpdated1 + " < " + artifactVersionLastUpdated2, + artifactVersionLastUpdated2.after(artifactVersionLastUpdated1)); + assertTrue( + artifactLastUpdated1 + " < " + artifactLastUpdated2, artifactLastUpdated2.after(artifactLastUpdated1)); } - private Date getLastUpdated( File metadataFile ) - throws Exception - { - String xml = FileUtils.fileRead( metadataFile, "UTF-8" ); - String timestamp = xml.replaceAll( "(?s)\\A.*\\s*([0-9]++)\\s*.*\\z", "$1" ); - SimpleDateFormat format = new SimpleDateFormat( "yyyyMMddHHmmss" ); - format.setTimeZone( TimeZone.getTimeZone( "UTC" ) ); - return format.parse( timestamp ); + private Date getLastUpdated(File metadataFile) throws Exception { + String xml = FileUtils.fileRead(metadataFile, "UTF-8"); + String timestamp = xml.replaceAll("(?s)\\A.*\\s*([0-9]++)\\s*.*\\z", "$1"); + SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss"); + format.setTimeZone(TimeZone.getTimeZone("UTC")); + return format.parse(timestamp); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2820PomCommentsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2820PomCommentsTest.java index 10364df58d..6475affe9c 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2820PomCommentsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2820PomCommentsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import org.apache.maven.shared.utils.io.FileUtils; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng2820PomCommentsTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng2820PomCommentsTest extends AbstractMavenIntegrationTestCase { - public MavenITmng2820PomCommentsTest() - { - super( "[2.0.5,)" ); + public MavenITmng2820PomCommentsTest() { + super("[2.0.5,)"); } /** @@ -47,44 +42,37 @@ public class MavenITmng2820PomCommentsTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2820" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2820"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng2820" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng2820"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - File installed = new File( verifier.getArtifactPath( "org.apache.maven.its.mng2820", "test", "0.1", "pom" ) ); - assertPomComments( installed ); + File installed = new File(verifier.getArtifactPath("org.apache.maven.its.mng2820", "test", "0.1", "pom")); + assertPomComments(installed); - File deployed = new File( testDir, "target/repo/org/apache/maven/its/mng2820/test/0.1/test-0.1.pom" ); - assertPomComments( deployed ); + File deployed = new File(testDir, "target/repo/org/apache/maven/its/mng2820/test/0.1/test-0.1.pom"); + assertPomComments(deployed); } - private void assertPomComments( File pomFile ) - throws Exception - { - String pom = FileUtils.fileRead( pomFile, "UTF-8" ); - assertPomComment( pom, "DOCUMENT-COMMENT-PRE-1" ); - assertPomComment( pom, "DOCUMENT-COMMENT-PRE-2" ); - assertPomComment( pom, "DOCUMENT-COMMENT-POST-1" ); - assertPomComment( pom, "DOCUMENT-COMMENT-POST-2" ); - assertPomComment( pom, "MODEL-COMMENT" ); - assertPomComment( pom, "INLINE-COMMENT-1" ); - assertPomComment( pom, "INLINE-COMMENT-2" ); - assertPomComment( pom, "INLINE-COMMENT-3" ); + private void assertPomComments(File pomFile) throws Exception { + String pom = FileUtils.fileRead(pomFile, "UTF-8"); + assertPomComment(pom, "DOCUMENT-COMMENT-PRE-1"); + assertPomComment(pom, "DOCUMENT-COMMENT-PRE-2"); + assertPomComment(pom, "DOCUMENT-COMMENT-POST-1"); + assertPomComment(pom, "DOCUMENT-COMMENT-POST-2"); + assertPomComment(pom, "MODEL-COMMENT"); + assertPomComment(pom, "INLINE-COMMENT-1"); + assertPomComment(pom, "INLINE-COMMENT-2"); + assertPomComment(pom, "INLINE-COMMENT-3"); } - private void assertPomComment( String pom, String comment ) - throws Exception - { - assertTrue( "Missing comment: " + comment, pom.contains( comment ) ); + private void assertPomComment(String pom, String comment) throws Exception { + assertTrue("Missing comment: " + comment, pom.contains(comment)); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2831CustomArtifactHandlerAndCustomLifecycleTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2831CustomArtifactHandlerAndCustomLifecycleTest.java index b11ad6ebe4..241dada723 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2831CustomArtifactHandlerAndCustomLifecycleTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2831CustomArtifactHandlerAndCustomLifecycleTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * * */ -public class MavenITmng2831CustomArtifactHandlerAndCustomLifecycleTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng2831CustomArtifactHandlerAndCustomLifecycleTest extends AbstractMavenIntegrationTestCase { - public MavenITmng2831CustomArtifactHandlerAndCustomLifecycleTest() - { - super( "(2.0.1,2.0.5),(2.0.6,3.0-alpha-1),[3.0-alpha-3,)" ); + public MavenITmng2831CustomArtifactHandlerAndCustomLifecycleTest() { + super("(2.0.1,2.0.5),(2.0.6,3.0-alpha-1),[3.0-alpha-3,)"); } /** @@ -46,19 +41,16 @@ public class MavenITmng2831CustomArtifactHandlerAndCustomLifecycleTest * @throws Exception in case of failure */ @Test - public void testitMNG2831() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2831" ); + public void testitMNG2831() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2831"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "package" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("package"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/test-1.0-it.jar" ); + verifier.verifyFilePresent("target/test-1.0-it.jar"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2843PluginConfigPropertiesInjectionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2843PluginConfigPropertiesInjectionTest.java index 1c4bc1295d..b2b00a4391 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2843PluginConfigPropertiesInjectionTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2843PluginConfigPropertiesInjectionTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng2843PluginConfigPropertiesInjectionTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng2843PluginConfigPropertiesInjectionTest extends AbstractMavenIntegrationTestCase { - public MavenITmng2843PluginConfigPropertiesInjectionTest() - { - super( "(2.0.5,)" ); + public MavenITmng2843PluginConfigPropertiesInjectionTest() { + super("(2.0.5,)"); } /** @@ -48,20 +43,17 @@ public class MavenITmng2843PluginConfigPropertiesInjectionTest * @throws Exception in case of failure */ @Test - public void testitMNG2843() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2843" ); + public void testitMNG2843() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2843"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/project.properties" ); - assertEquals( "PASSED", props.getProperty( "key" ) ); + Properties props = verifier.loadProperties("target/project.properties"); + assertEquals("PASSED", props.getProperty("key")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2848ProfileActivationByEnvironmentVariableTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2848ProfileActivationByEnvironmentVariableTest.java index f90923a5e5..55d71e6804 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2848ProfileActivationByEnvironmentVariableTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2848ProfileActivationByEnvironmentVariableTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng2848ProfileActivationByEnvironmentVariableTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng2848ProfileActivationByEnvironmentVariableTest extends AbstractMavenIntegrationTestCase { - public MavenITmng2848ProfileActivationByEnvironmentVariableTest() - { - super( "[2.0.9,)" ); + public MavenITmng2848ProfileActivationByEnvironmentVariableTest() { + super("[2.0.9,)"); } /** @@ -47,21 +42,18 @@ public class MavenITmng2848ProfileActivationByEnvironmentVariableTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2848" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2848"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.setEnvironmentVariable( "MNG2848", "GO" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.setEnvironmentVariable("MNG2848", "GO"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/profile.properties" ); - assertEquals( "PASSED", props.getProperty( "project.properties.testProp" ) ); + Properties props = verifier.loadProperties("target/profile.properties"); + assertEquals("PASSED", props.getProperty("project.properties.testProp")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2861RelocationsAndRangesTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2861RelocationsAndRangesTest.java index 0bc31e772e..11c0a1abb8 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2861RelocationsAndRangesTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2861RelocationsAndRangesTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,36 +30,30 @@ import org.junit.jupiter.api.Test; * * */ -public class MavenITmng2861RelocationsAndRangesTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng2861RelocationsAndRangesTest extends AbstractMavenIntegrationTestCase { - public MavenITmng2861RelocationsAndRangesTest() - { - super( "(2.0.8,)" ); + public MavenITmng2861RelocationsAndRangesTest() { + super("(2.0.8,)"); } @Test - public void testitMNG2861() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2861" ); + public void testitMNG2861() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2861"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "A/target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng2861" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("A/target"); + verifier.deleteArtifacts("org.apache.maven.its.mng2861"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List artifacts = verifier.loadLines( "A/target/artifacts.txt", "UTF-8" ); - assertTrue( artifacts.toString(), artifacts.contains( "org.apache.maven.its.mng2861:B:jar:1.0-SNAPSHOT" ) ); - assertTrue( artifacts.toString(), artifacts.contains( "org.apache.maven.its.mng2861.new:project:jar:2.0" ) ); - assertTrue( artifacts.toString(), artifacts.contains( "org.apache.maven.its.mng2861:C:jar:1.0-SNAPSHOT" ) ); + List artifacts = verifier.loadLines("A/target/artifacts.txt", "UTF-8"); + assertTrue(artifacts.toString(), artifacts.contains("org.apache.maven.its.mng2861:B:jar:1.0-SNAPSHOT")); + assertTrue(artifacts.toString(), artifacts.contains("org.apache.maven.its.mng2861.new:project:jar:2.0")); + assertTrue(artifacts.toString(), artifacts.contains("org.apache.maven.its.mng2861:C:jar:1.0-SNAPSHOT")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2865MirrorWildcardTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2865MirrorWildcardTest.java index 98f93770c1..32fe41788b 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2865MirrorWildcardTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2865MirrorWildcardTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng2865MirrorWildcardTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng2865MirrorWildcardTest extends AbstractMavenIntegrationTestCase { - public MavenITmng2865MirrorWildcardTest() - { - super( "(2.0.4,)" ); + public MavenITmng2865MirrorWildcardTest() { + super("(2.0.4,)"); } /** @@ -47,10 +42,8 @@ public class MavenITmng2865MirrorWildcardTest * @throws Exception in case of failure */ @Test - public void testitFileRepo() - throws Exception - { - testit( "file" ); + public void testitFileRepo() throws Exception { + testit("file"); } /** @@ -59,10 +52,8 @@ public class MavenITmng2865MirrorWildcardTest * @throws Exception in case of failure */ @Test - public void testitLocalhostRepo() - throws Exception - { - testit( "localhost" ); + public void testitLocalhostRepo() throws Exception { + testit("localhost"); } /** @@ -71,10 +62,8 @@ public class MavenITmng2865MirrorWildcardTest * @throws Exception in case of failure */ @Test - public void testitExternalRepo() - throws Exception - { - testit( "external" ); + public void testitExternalRepo() throws Exception { + testit("external"); } /** @@ -83,28 +72,23 @@ public class MavenITmng2865MirrorWildcardTest * @throws Exception in case of failure */ @Test - public void testitCentralRepo() - throws Exception - { - testit( "central" ); + public void testitCentralRepo() throws Exception { + testit("central"); } - private void testit( String project ) - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2865" ); + private void testit(String project) throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2865"); - Verifier verifier = newVerifier( new File( testDir, project ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng2865" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(new File(testDir, project).getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng2865"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng2865", "a", "0.1", "jar" ); + verifier.verifyArtifactPresent("org.apache.maven.its.mng2865", "a", "0.1", "jar"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2871PrePackageSubartifactResolutionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2871PrePackageSubartifactResolutionTest.java index 00e8490b4b..23104d49c3 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2871PrePackageSubartifactResolutionTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2871PrePackageSubartifactResolutionTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng2871PrePackageSubartifactResolutionTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng2871PrePackageSubartifactResolutionTest extends AbstractMavenIntegrationTestCase { - public MavenITmng2871PrePackageSubartifactResolutionTest() - { - super( "[3.0-alpha-1,)" ); + public MavenITmng2871PrePackageSubartifactResolutionTest() { + super("[3.0-alpha-1,)"); } /** @@ -49,21 +44,19 @@ public class MavenITmng2871PrePackageSubartifactResolutionTest * @throws Exception in case of failure */ @Test - public void testitMNG2871() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2871" ); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "consumer/target" ); - verifier.addCliArgument( "compile" ); + public void testitMNG2871() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2871"); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("consumer/target"); + verifier.addCliArgument("compile"); verifier.execute(); verifier.verifyErrorFreeLog(); - List compileClassPath = verifier.loadLines( "consumer/target/compile.txt", "UTF-8" ); - assertEquals( 2, compileClassPath.size() ); - assertEquals( new File( testDir, "ejbs/target/classes" ).getCanonicalFile(), - new File( compileClassPath.get( 1 ).toString() ).getCanonicalFile() ); + List compileClassPath = verifier.loadLines("consumer/target/compile.txt", "UTF-8"); + assertEquals(2, compileClassPath.size()); + assertEquals( + new File(testDir, "ejbs/target/classes").getCanonicalFile(), + new File(compileClassPath.get(1).toString()).getCanonicalFile()); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2892HideCorePlexusUtilsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2892HideCorePlexusUtilsTest.java index 27dd5848cb..fcfae013e7 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2892HideCorePlexusUtilsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2892HideCorePlexusUtilsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng2892HideCorePlexusUtilsTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng2892HideCorePlexusUtilsTest extends AbstractMavenIntegrationTestCase { - public MavenITmng2892HideCorePlexusUtilsTest() - { - super( "(2.0.8,)" ); + public MavenITmng2892HideCorePlexusUtilsTest() { + super("(2.0.8,)"); } /** @@ -49,27 +44,24 @@ public class MavenITmng2892HideCorePlexusUtilsTest * @throws Exception in case of failure */ @Test - public void testitMNG2892() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2892" ); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifact( "org.codehaus.plexus", "plexus-utils", "0.1-mng2892", "jar" ); - verifier.deleteArtifact( "org.codehaus.plexus", "plexus-utils", "0.1-mng2892", "pom" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + public void testitMNG2892() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2892"); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifact("org.codehaus.plexus", "plexus-utils", "0.1-mng2892", "jar"); + verifier.deleteArtifact("org.codehaus.plexus", "plexus-utils", "0.1-mng2892", "pom"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties pclProps = verifier.loadProperties( "target/pcl.properties" ); - assertEquals( "methodStub", pclProps.getProperty( "org.codehaus.plexus.util.StringUtils.methods" ) ); + Properties pclProps = verifier.loadProperties("target/pcl.properties"); + assertEquals("methodStub", pclProps.getProperty("org.codehaus.plexus.util.StringUtils.methods")); - Properties tcclProps = verifier.loadProperties( "target/tccl.properties" ); - assertEquals( pclProps, tcclProps ); + Properties tcclProps = verifier.loadProperties("target/tccl.properties"); + assertEquals(pclProps, tcclProps); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2921ActiveAttachedArtifactsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2921ActiveAttachedArtifactsTest.java index b02044a437..5b84e46992 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2921ActiveAttachedArtifactsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2921ActiveAttachedArtifactsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Collection; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -35,13 +33,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng2921ActiveAttachedArtifactsTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng2921ActiveAttachedArtifactsTest extends AbstractMavenIntegrationTestCase { - public MavenITmng2921ActiveAttachedArtifactsTest() - { - super( "(2.0.6,)" ); + public MavenITmng2921ActiveAttachedArtifactsTest() { + super("(2.0.6,)"); } /** @@ -55,42 +50,47 @@ public class MavenITmng2921ActiveAttachedArtifactsTest * @throws Exception in case of failure */ @Test - public void testitMNG2921() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2921" ); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "consumer/target" ); - verifier.addCliArgument( "validate" ); + public void testitMNG2921() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2921"); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("consumer/target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Collection compileArtifacts = verifier.loadLines( "consumer/target/compile.txt", "UTF-8" ); - assertTrue( compileArtifacts.toString(), - compileArtifacts.contains( "org.apache.maven.its.mng2921:ejbs:ejb-client:client:1.0-SNAPSHOT" ) ); - assertTrue( compileArtifacts.toString(), - compileArtifacts.contains( "org.apache.maven.its.mng2921:producer:ejb-client:client:1.0-SNAPSHOT" ) ); - assertFalse( compileArtifacts.toString(), - compileArtifacts.contains( "org.apache.maven.its.mng2921:tests:test-jar:tests:1.0-SNAPSHOT" ) ); - assertFalse( compileArtifacts.toString(), - compileArtifacts.contains( "org.apache.maven.its.mng2921:producer:test-jar:tests:1.0-SNAPSHOT" ) ); + Collection compileArtifacts = verifier.loadLines("consumer/target/compile.txt", "UTF-8"); + assertTrue( + compileArtifacts.toString(), + compileArtifacts.contains("org.apache.maven.its.mng2921:ejbs:ejb-client:client:1.0-SNAPSHOT")); + assertTrue( + compileArtifacts.toString(), + compileArtifacts.contains("org.apache.maven.its.mng2921:producer:ejb-client:client:1.0-SNAPSHOT")); + assertFalse( + compileArtifacts.toString(), + compileArtifacts.contains("org.apache.maven.its.mng2921:tests:test-jar:tests:1.0-SNAPSHOT")); + assertFalse( + compileArtifacts.toString(), + compileArtifacts.contains("org.apache.maven.its.mng2921:producer:test-jar:tests:1.0-SNAPSHOT")); - Collection testArtifacts = verifier.loadLines( "consumer/target/test.txt", "UTF-8" ); - assertTrue( testArtifacts.toString(), - testArtifacts.contains( "org.apache.maven.its.mng2921:ejbs:ejb-client:client:1.0-SNAPSHOT" ) ); - assertTrue( testArtifacts.toString(), - testArtifacts.contains( "org.apache.maven.its.mng2921:producer:ejb-client:client:1.0-SNAPSHOT" ) ); - assertTrue( testArtifacts.toString(), - testArtifacts.contains( "org.apache.maven.its.mng2921:tests:test-jar:tests:1.0-SNAPSHOT" ) ); - assertTrue( testArtifacts.toString(), - testArtifacts.contains( "org.apache.maven.its.mng2921:producer:test-jar:tests:1.0-SNAPSHOT" ) ); + Collection testArtifacts = verifier.loadLines("consumer/target/test.txt", "UTF-8"); + assertTrue( + testArtifacts.toString(), + testArtifacts.contains("org.apache.maven.its.mng2921:ejbs:ejb-client:client:1.0-SNAPSHOT")); + assertTrue( + testArtifacts.toString(), + testArtifacts.contains("org.apache.maven.its.mng2921:producer:ejb-client:client:1.0-SNAPSHOT")); + assertTrue( + testArtifacts.toString(), + testArtifacts.contains("org.apache.maven.its.mng2921:tests:test-jar:tests:1.0-SNAPSHOT")); + assertTrue( + testArtifacts.toString(), + testArtifacts.contains("org.apache.maven.its.mng2921:producer:test-jar:tests:1.0-SNAPSHOT")); - Collection testClassPath = verifier.loadLines( "consumer/target/test-classpath.txt", "UTF-8" ); - assertTrue( testClassPath.toString(), testClassPath.contains( "ejbs/attached.jar" ) ); - assertTrue( testClassPath.toString(), testClassPath.contains( "tests/attached.jar" ) ); - assertTrue( testClassPath.toString(), testClassPath.contains( "producer/client.jar" ) ); - assertTrue( testClassPath.toString(), testClassPath.contains( "producer/tests.jar" ) ); + Collection testClassPath = verifier.loadLines("consumer/target/test-classpath.txt", "UTF-8"); + assertTrue(testClassPath.toString(), testClassPath.contains("ejbs/attached.jar")); + assertTrue(testClassPath.toString(), testClassPath.contains("tests/attached.jar")); + assertTrue(testClassPath.toString(), testClassPath.contains("producer/client.jar")); + assertTrue(testClassPath.toString(), testClassPath.contains("producer/tests.jar")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2926PluginPrefixOrderTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2926PluginPrefixOrderTest.java index 151c84885b..95f7f8f7fd 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2926PluginPrefixOrderTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2926PluginPrefixOrderTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * @author Brian Fox * */ -public class MavenITmng2926PluginPrefixOrderTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng2926PluginPrefixOrderTest extends AbstractMavenIntegrationTestCase { - public MavenITmng2926PluginPrefixOrderTest() - { - super( "(2.0.6,)" ); + public MavenITmng2926PluginPrefixOrderTest() { + super("(2.0.6,)"); } /** @@ -48,43 +43,45 @@ public class MavenITmng2926PluginPrefixOrderTest * @throws Exception in case of failure */ @Test - public void testitMNG2926() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2926" ); + public void testitMNG2926() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2926"); Verifier verifier; - verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.deleteArtifacts( "org.apache.maven.its.mng2926" ); - verifier.deleteArtifacts( "org.apache.maven.plugins", "mng-2926", "0.1" ); - verifier.deleteArtifacts( "org.apache.maven.plugins", "mng-2926", "0.1" ); - new File( verifier.getArtifactMetadataPath( "org.apache.maven.plugins", null, null, "maven-metadata-maven-core-it.xml" ) ).delete(); - new File( verifier.getArtifactMetadataPath( "org.apache.maven.plugins", null, null, "resolver-status.properties" ) ).delete(); - verifier.deleteArtifacts( "org.codehaus.mojo", "mng-2926", "0.1" ); - verifier.deleteArtifacts( "org.codehaus.mojo", "mng-2926", "0.1" ); - new File( verifier.getArtifactMetadataPath( "org.codehaus.mojo", null, null, "maven-metadata-maven-core-it.xml" ) ).delete(); - new File( verifier.getArtifactMetadataPath( "org.codehaus.mojo", null, null, "resolver-status.properties" ) ).delete(); + verifier = newVerifier(testDir.getAbsolutePath()); + verifier.deleteArtifacts("org.apache.maven.its.mng2926"); + verifier.deleteArtifacts("org.apache.maven.plugins", "mng-2926", "0.1"); + verifier.deleteArtifacts("org.apache.maven.plugins", "mng-2926", "0.1"); + new File(verifier.getArtifactMetadataPath( + "org.apache.maven.plugins", null, null, "maven-metadata-maven-core-it.xml")) + .delete(); + new File(verifier.getArtifactMetadataPath("org.apache.maven.plugins", null, null, "resolver-status.properties")) + .delete(); + verifier.deleteArtifacts("org.codehaus.mojo", "mng-2926", "0.1"); + verifier.deleteArtifacts("org.codehaus.mojo", "mng-2926", "0.1"); + new File(verifier.getArtifactMetadataPath("org.codehaus.mojo", null, null, "maven-metadata-maven-core-it.xml")) + .delete(); + new File(verifier.getArtifactMetadataPath("org.codehaus.mojo", null, null, "resolver-status.properties")) + .delete(); - verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.setLogFileName( "log-default.txt" ); - verifier.filterFile( "settings-default-template.xml", "settings-default.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings-default.xml" ); - verifier.addCliArgument( "mng-2926:apache" ); + verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.setLogFileName("log-default.txt"); + verifier.filterFile("settings-default-template.xml", "settings-default.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings-default.xml"); + verifier.addCliArgument("mng-2926:apache"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.setLogFileName( "log-custom.txt" ); - verifier.filterFile( "settings-custom-template.xml", "settings-custom.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings-custom.xml" ); - verifier.addCliArgument( "mng-2926:custom" ); + verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.setLogFileName("log-custom.txt"); + verifier.filterFile("settings-custom-template.xml", "settings-custom.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings-custom.xml"); + verifier.addCliArgument("mng-2926:custom"); verifier.execute(); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2972OverridePluginDependencyTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2972OverridePluginDependencyTest.java index 978bbc548f..48eacb0f18 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2972OverridePluginDependencyTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2972OverridePluginDependencyTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng2972OverridePluginDependencyTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng2972OverridePluginDependencyTest extends AbstractMavenIntegrationTestCase { - public MavenITmng2972OverridePluginDependencyTest() - { - super( "(2.0.8,)" ); + public MavenITmng2972OverridePluginDependencyTest() { + super("(2.0.8,)"); } /** @@ -48,23 +43,21 @@ public class MavenITmng2972OverridePluginDependencyTest * @throws Exception in case of failure */ @Test - public void testitLifecycleInvocation() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2972/test1" ); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifact( "org.apache.maven.its.plugins.class-loader", "dep-b", "0.2-mng-2972", "jar" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + public void testitLifecycleInvocation() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2972/test1"); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifact("org.apache.maven.its.plugins.class-loader", "dep-b", "0.2-mng-2972", "jar"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties pclProps = verifier.loadProperties( "target/pcl.properties" ); - verify( pclProps ); + Properties pclProps = verifier.loadProperties("target/pcl.properties"); + verify(pclProps); } /** @@ -80,34 +73,29 @@ public class MavenITmng2972OverridePluginDependencyTest * @throws Exception in case of failure */ @Test - public void testitCommandLineInvocation() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2972/test2" ); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifact( "org.apache.maven.its.plugins.class-loader", "dep-b", "9.9-MNG-2972", "jar" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "org.apache.maven.its.plugins:maven-it-plugin-class-loader:2.1-SNAPSHOT:load" ); + public void testitCommandLineInvocation() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2972/test2"); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifact("org.apache.maven.its.plugins.class-loader", "dep-b", "9.9-MNG-2972", "jar"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("org.apache.maven.its.plugins:maven-it-plugin-class-loader:2.1-SNAPSHOT:load"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties pclProps = verifier.loadProperties( "target/pcl.properties" ); - verify( pclProps ); + Properties pclProps = verifier.loadProperties("target/pcl.properties"); + verify(pclProps); } - private void verify( Properties pclProps ) - throws Exception - { - assertNotNull( pclProps.getProperty( "org.apache.maven.its.mng2972.MNG2972" ) ); - assertNull( pclProps.getProperty( "org.apache.maven.plugin.coreit.ClassA" ) ); - assertNull( pclProps.getProperty( "org.apache.maven.plugin.coreit.ClassB" ) ); - assertEquals( "1", pclProps.getProperty( "org/apache/maven/its/mng2972/mng-2972.properties.count" ) ); - assertEquals( "0", pclProps.getProperty( "org/apache/maven/plugin/coreit/a.properties.count" ) ); - assertEquals( "0", pclProps.getProperty( "org/apache/maven/plugin/coreit/b.properties.count" ) ); + private void verify(Properties pclProps) throws Exception { + assertNotNull(pclProps.getProperty("org.apache.maven.its.mng2972.MNG2972")); + assertNull(pclProps.getProperty("org.apache.maven.plugin.coreit.ClassA")); + assertNull(pclProps.getProperty("org.apache.maven.plugin.coreit.ClassB")); + assertEquals("1", pclProps.getProperty("org/apache/maven/its/mng2972/mng-2972.properties.count")); + assertEquals("0", pclProps.getProperty("org/apache/maven/plugin/coreit/a.properties.count")); + assertEquals("0", pclProps.getProperty("org/apache/maven/plugin/coreit/b.properties.count")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2994SnapshotRangeRepositoryTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2994SnapshotRangeRepositoryTest.java index 6591ffcd1c..9ee5c8f3f7 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2994SnapshotRangeRepositoryTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2994SnapshotRangeRepositoryTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * @author Mark Hobson * */ -public class MavenITmng2994SnapshotRangeRepositoryTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng2994SnapshotRangeRepositoryTest extends AbstractMavenIntegrationTestCase { - public MavenITmng2994SnapshotRangeRepositoryTest() - { - super( "[3.0-beta-1,)" ); + public MavenITmng2994SnapshotRangeRepositoryTest() { + super("[3.0-beta-1,)"); } /** @@ -47,18 +42,15 @@ public class MavenITmng2994SnapshotRangeRepositoryTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2994" ); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.deleteArtifacts( "org.apache.maven.its.mng2994" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2994"); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.deleteArtifacts("org.apache.maven.its.mng2994"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3004ReactorFailureBehaviorMultithreadedTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3004ReactorFailureBehaviorMultithreadedTest.java index a464d99b58..f5822f5796 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3004ReactorFailureBehaviorMultithreadedTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3004ReactorFailureBehaviorMultithreadedTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,12 +31,9 @@ import org.junit.jupiter.api.Test; * @author Dan Fabulich * */ -public class MavenITmng3004ReactorFailureBehaviorMultithreadedTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng3004ReactorFailureBehaviorMultithreadedTest() - { - super( "(3.0-alpha-3,)" ); +public class MavenITmng3004ReactorFailureBehaviorMultithreadedTest extends AbstractMavenIntegrationTestCase { + public MavenITmng3004ReactorFailureBehaviorMultithreadedTest() { + super("(3.0-alpha-3,)"); } /** @@ -48,36 +43,31 @@ public class MavenITmng3004ReactorFailureBehaviorMultithreadedTest * @throws Exception in case of failure */ @Test - public void testitFailFastSingleThread() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-0095" ); + public void testitFailFastSingleThread() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-0095"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteDirectory( "subproject1/target" ); - verifier.deleteDirectory( "subproject2/target" ); - verifier.deleteDirectory( "subproject3/target" ); - verifier.addCliArgument( "--fail-fast" ); - verifier.setLogFileName( "log-ff-mt1.txt" ); - verifier.addCliArgument( "-Dmaven.threads.experimental=1" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteDirectory("subproject1/target"); + verifier.deleteDirectory("subproject2/target"); + verifier.deleteDirectory("subproject3/target"); + verifier.addCliArgument("--fail-fast"); + verifier.setLogFileName("log-ff-mt1.txt"); + verifier.addCliArgument("-Dmaven.threads.experimental=1"); - try - { - verifier.addCliArgument( "org.apache.maven.its.plugins:maven-it-plugin-touch:touch" ); + try { + verifier.addCliArgument("org.apache.maven.its.plugins:maven-it-plugin-touch:touch"); verifier.execute(); verifier.verifyErrorFreeLog(); - } - catch ( VerificationException e ) - { + } catch (VerificationException e) { // expected } - verifier.verifyFilePresent( "target/touch.txt" ); - verifier.verifyFileNotPresent( "subproject1/target/touch.txt" ); - verifier.verifyFileNotPresent( "subproject2/target/touch.txt" ); - verifier.verifyFileNotPresent( "subproject3/target/touch.txt" ); + verifier.verifyFilePresent("target/touch.txt"); + verifier.verifyFileNotPresent("subproject1/target/touch.txt"); + verifier.verifyFileNotPresent("subproject2/target/touch.txt"); + verifier.verifyFileNotPresent("subproject3/target/touch.txt"); } /** @@ -87,27 +77,25 @@ public class MavenITmng3004ReactorFailureBehaviorMultithreadedTest * @throws Exception in case of failure */ @Test - public void testitFailNeverSingleThread() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-0095" ); + public void testitFailNeverSingleThread() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-0095"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteDirectory( "subproject1/target" ); - verifier.deleteDirectory( "subproject2/target" ); - verifier.deleteDirectory( "subproject3/target" ); - verifier.addCliArgument( "--fail-never" ); - verifier.setLogFileName( "log-fn-mt1.txt" ); - verifier.addCliArgument( "-Dmaven.threads.experimental=1" ); - verifier.addCliArgument( "org.apache.maven.its.plugins:maven-it-plugin-touch:touch" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteDirectory("subproject1/target"); + verifier.deleteDirectory("subproject2/target"); + verifier.deleteDirectory("subproject3/target"); + verifier.addCliArgument("--fail-never"); + verifier.setLogFileName("log-fn-mt1.txt"); + verifier.addCliArgument("-Dmaven.threads.experimental=1"); + verifier.addCliArgument("org.apache.maven.its.plugins:maven-it-plugin-touch:touch"); verifier.execute(); - verifier.verifyFilePresent( "target/touch.txt" ); - verifier.verifyFileNotPresent( "subproject1/target/touch.txt" ); - verifier.verifyFilePresent( "subproject2/target/touch.txt" ); - verifier.verifyFilePresent( "subproject3/target/touch.txt" ); + verifier.verifyFilePresent("target/touch.txt"); + verifier.verifyFileNotPresent("subproject1/target/touch.txt"); + verifier.verifyFilePresent("subproject2/target/touch.txt"); + verifier.verifyFilePresent("subproject3/target/touch.txt"); } /** @@ -118,35 +106,30 @@ public class MavenITmng3004ReactorFailureBehaviorMultithreadedTest * @throws Exception in case of failure */ @Test - public void testitFailAtEndSingleThread() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-0095" ); + public void testitFailAtEndSingleThread() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-0095"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteDirectory( "subproject1/target" ); - verifier.deleteDirectory( "subproject2/target" ); - verifier.deleteDirectory( "subproject3/target" ); - verifier.addCliArgument( "--fail-at-end" ); - verifier.setLogFileName( "log-fae-mt1.txt" ); - verifier.addCliArgument( "-Dmaven.threads.experimental=1" ); - try - { - verifier.addCliArgument( "org.apache.maven.its.plugins:maven-it-plugin-touch:touch" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteDirectory("subproject1/target"); + verifier.deleteDirectory("subproject2/target"); + verifier.deleteDirectory("subproject3/target"); + verifier.addCliArgument("--fail-at-end"); + verifier.setLogFileName("log-fae-mt1.txt"); + verifier.addCliArgument("-Dmaven.threads.experimental=1"); + try { + verifier.addCliArgument("org.apache.maven.its.plugins:maven-it-plugin-touch:touch"); verifier.execute(); verifier.verifyErrorFreeLog(); - } - catch ( VerificationException e ) - { + } catch (VerificationException e) { // expected } - verifier.verifyFilePresent( "target/touch.txt" ); - verifier.verifyFileNotPresent( "subproject1/target/touch.txt" ); - verifier.verifyFilePresent( "subproject2/target/touch.txt" ); - verifier.verifyFileNotPresent( "subproject3/target/touch.txt" ); + verifier.verifyFilePresent("target/touch.txt"); + verifier.verifyFileNotPresent("subproject1/target/touch.txt"); + verifier.verifyFilePresent("subproject2/target/touch.txt"); + verifier.verifyFileNotPresent("subproject3/target/touch.txt"); } /** @@ -156,27 +139,25 @@ public class MavenITmng3004ReactorFailureBehaviorMultithreadedTest * @throws Exception in case of failure */ @Test - public void testitFailNeverTwoThreads() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-0095" ); + public void testitFailNeverTwoThreads() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-0095"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteDirectory( "subproject1/target" ); - verifier.deleteDirectory( "subproject2/target" ); - verifier.deleteDirectory( "subproject3/target" ); - verifier.addCliArgument( "--fail-never" ); - verifier.setLogFileName( "log-fn-mt2.txt" ); - verifier.addCliArgument( "-Dmaven.threads.experimental=2" ); - verifier.addCliArgument( "org.apache.maven.its.plugins:maven-it-plugin-touch:touch" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteDirectory("subproject1/target"); + verifier.deleteDirectory("subproject2/target"); + verifier.deleteDirectory("subproject3/target"); + verifier.addCliArgument("--fail-never"); + verifier.setLogFileName("log-fn-mt2.txt"); + verifier.addCliArgument("-Dmaven.threads.experimental=2"); + verifier.addCliArgument("org.apache.maven.its.plugins:maven-it-plugin-touch:touch"); verifier.execute(); - verifier.verifyFilePresent( "target/touch.txt" ); - verifier.verifyFileNotPresent( "subproject1/target/touch.txt" ); - verifier.verifyFilePresent( "subproject2/target/touch.txt" ); - verifier.verifyFilePresent( "subproject3/target/touch.txt" ); + verifier.verifyFilePresent("target/touch.txt"); + verifier.verifyFileNotPresent("subproject1/target/touch.txt"); + verifier.verifyFilePresent("subproject2/target/touch.txt"); + verifier.verifyFilePresent("subproject3/target/touch.txt"); } /** @@ -187,35 +168,30 @@ public class MavenITmng3004ReactorFailureBehaviorMultithreadedTest * @throws Exception in case of failure */ @Test - public void testitFailAtEndTwoThreads() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-0095" ); + public void testitFailAtEndTwoThreads() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-0095"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteDirectory( "subproject1/target" ); - verifier.deleteDirectory( "subproject2/target" ); - verifier.deleteDirectory( "subproject3/target" ); - verifier.addCliArgument( "--fail-at-end" ); - verifier.setLogFileName( "log-fae-mt2.txt" ); - verifier.addCliArgument( "-Dmaven.threads.experimental=2" ); - try - { - verifier.addCliArgument( "org.apache.maven.its.plugins:maven-it-plugin-touch:touch" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteDirectory("subproject1/target"); + verifier.deleteDirectory("subproject2/target"); + verifier.deleteDirectory("subproject3/target"); + verifier.addCliArgument("--fail-at-end"); + verifier.setLogFileName("log-fae-mt2.txt"); + verifier.addCliArgument("-Dmaven.threads.experimental=2"); + try { + verifier.addCliArgument("org.apache.maven.its.plugins:maven-it-plugin-touch:touch"); verifier.execute(); verifier.verifyErrorFreeLog(); - } - catch ( VerificationException e ) - { + } catch (VerificationException e) { // expected } - verifier.verifyFilePresent( "target/touch.txt" ); - verifier.verifyFileNotPresent( "subproject1/target/touch.txt" ); - verifier.verifyFilePresent( "subproject2/target/touch.txt" ); - verifier.verifyFileNotPresent( "subproject3/target/touch.txt" ); + verifier.verifyFilePresent("target/touch.txt"); + verifier.verifyFileNotPresent("subproject1/target/touch.txt"); + verifier.verifyFilePresent("subproject2/target/touch.txt"); + verifier.verifyFileNotPresent("subproject3/target/touch.txt"); } // DGF not testing fail fast with multiple real threads since that's a "best effort" attempt to halt the build diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3012CoreClassImportTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3012CoreClassImportTest.java index c3be001a3d..2f806e048d 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3012CoreClassImportTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3012CoreClassImportTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,12 +31,9 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3012CoreClassImportTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng3012CoreClassImportTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenITmng3012CoreClassImportTest extends AbstractMavenIntegrationTestCase { + public MavenITmng3012CoreClassImportTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -48,24 +43,21 @@ public class MavenITmng3012CoreClassImportTest * @throws Exception in case of failure */ @Test - public void testitMNG3012() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3012" ); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifact( "org.codehaus.plexus", "plexus-utils", "0.1-mng3012", "jar" ); - verifier.deleteArtifact( "org.codehaus.plexus", "plexus-utils", "0.1-mng3012", "pom" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + public void testitMNG3012() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3012"); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifact("org.codehaus.plexus", "plexus-utils", "0.1-mng3012", "jar"); + verifier.deleteArtifact("org.codehaus.plexus", "plexus-utils", "0.1-mng3012", "pom"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties xpp3domProps = verifier.loadProperties( "target/xpp3dom.properties" ); - assertEquals( "true", xpp3domProps.getProperty( "project.reporting.plugins.0.configuration" ) ); + Properties xpp3domProps = verifier.loadProperties("target/xpp3dom.properties"); + assertEquals("true", xpp3domProps.getProperty("project.reporting.plugins.0.configuration")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3023ReactorDependencyResolutionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3023ReactorDependencyResolutionTest.java index fba68b4f68..7f3cc4488a 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3023ReactorDependencyResolutionTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3023ReactorDependencyResolutionTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -35,13 +33,10 @@ import org.junit.jupiter.api.Test; * @author jdcasey * */ -public class MavenITmng3023ReactorDependencyResolutionTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3023ReactorDependencyResolutionTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3023ReactorDependencyResolutionTest() - { - super( "(2.1.0-M1,)" ); + public MavenITmng3023ReactorDependencyResolutionTest() { + super("(2.1.0-M1,)"); } /** @@ -55,26 +50,22 @@ public class MavenITmng3023ReactorDependencyResolutionTest * @throws Exception in case of failure */ @Test - public void testitMNG3023A() throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3023" ); + public void testitMNG3023A() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3023"); // First pass. Make sure the dependency cannot be resolved. - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.setLogFileName( "log-a.txt" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.setLogFileName("log-a.txt"); - verifier.deleteDirectory( "dependency/dependency-classes" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng3023" ); + verifier.deleteDirectory("dependency/dependency-classes"); + verifier.deleteArtifacts("org.apache.maven.its.mng3023"); - try - { - verifier.addCliArgument( "validate" ); + try { + verifier.addCliArgument("validate"); verifier.execute(); - fail( "Expected failure to resolve dependency artifact without at least calling 'compile' phase." ); - } - catch ( VerificationException e ) - { + fail("Expected failure to resolve dependency artifact without at least calling 'compile' phase."); + } catch (VerificationException e) { // expected. } } @@ -90,26 +81,24 @@ public class MavenITmng3023ReactorDependencyResolutionTest * @throws Exception in case of failure */ @Test - public void testitMNG3023B() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3023" ); + public void testitMNG3023B() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3023"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.setLogFileName( "log-b.txt" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.setLogFileName("log-b.txt"); // The IT doesn't actually run the compiler but merely mimics its effect, i.e. the creation of the output dir - new File( testDir, "dependency/dependency-classes" ).mkdirs(); - verifier.deleteDirectory( "consumer/target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng3023" ); + new File(testDir, "dependency/dependency-classes").mkdirs(); + verifier.deleteDirectory("consumer/target"); + verifier.deleteArtifacts("org.apache.maven.its.mng3023"); - verifier.addCliArgument( "initialize" ); + verifier.addCliArgument("initialize"); verifier.execute(); verifier.verifyErrorFreeLog(); - List compileClassPath = verifier.loadLines( "consumer/target/compile.classpath", "UTF-8" ); - assertTrue( compileClassPath.toString(), compileClassPath.contains( "dependency-classes" ) ); - assertFalse( compileClassPath.toString(), compileClassPath.contains( "dependency-1.jar" ) ); + List compileClassPath = verifier.loadLines("consumer/target/compile.classpath", "UTF-8"); + assertTrue(compileClassPath.toString(), compileClassPath.contains("dependency-classes")); + assertFalse(compileClassPath.toString(), compileClassPath.contains("dependency-1.jar")); } /** @@ -127,36 +116,33 @@ public class MavenITmng3023ReactorDependencyResolutionTest * @throws Exception in case of failure */ @Test - public void testitMNG3023C() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3023" ); + public void testitMNG3023C() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3023"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); - verifier.deleteArtifacts( "org.apache.maven.its.mng3023" ); + verifier.deleteArtifacts("org.apache.maven.its.mng3023"); - verifier.deleteDirectory( "consumer/target" ); - verifier.setLogFileName( "log-c-1.txt" ); - verifier.addCliArgument( "generate-sources" ); + verifier.deleteDirectory("consumer/target"); + verifier.setLogFileName("log-c-1.txt"); + verifier.addCliArgument("generate-sources"); verifier.execute(); verifier.verifyErrorFreeLog(); - List compileClassPath = verifier.loadLines( "consumer/target/compile.classpath", "UTF-8" ); - assertTrue( compileClassPath.toString(), compileClassPath.contains( "dependency-1.jar" ) ); - assertFalse( compileClassPath.toString(), compileClassPath.contains( "dependency-classes" ) ); + List compileClassPath = verifier.loadLines("consumer/target/compile.classpath", "UTF-8"); + assertTrue(compileClassPath.toString(), compileClassPath.contains("dependency-1.jar")); + assertFalse(compileClassPath.toString(), compileClassPath.contains("dependency-classes")); - verifier.deleteDirectory( "dependency/dependency-classes" ); - verifier.deleteDirectory( "consumer/target" ); - verifier.setLogFileName( "log-c-2.txt" ); - verifier.addCliArgument( "validate" ); + verifier.deleteDirectory("dependency/dependency-classes"); + verifier.deleteDirectory("consumer/target"); + verifier.setLogFileName("log-c-2.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - compileClassPath = verifier.loadLines( "consumer/target/compile.classpath", "UTF-8" ); - assertTrue( compileClassPath.toString(), compileClassPath.contains( "dependency-1.jar" ) ); - assertFalse( compileClassPath.toString(), compileClassPath.contains( "dependency-classes" ) ); + compileClassPath = verifier.loadLines("consumer/target/compile.classpath", "UTF-8"); + assertTrue(compileClassPath.toString(), compileClassPath.contains("dependency-1.jar")); + assertFalse(compileClassPath.toString(), compileClassPath.contains("dependency-classes")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3038TransitiveDepManVersionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3038TransitiveDepManVersionTest.java index d5d07c5250..ea2cf9fc2c 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3038TransitiveDepManVersionTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3038TransitiveDepManVersionTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; import java.io.IOException; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; @@ -35,46 +33,40 @@ import org.junit.jupiter.api.Test; * @author Joakim Erdfelt * */ -@Disabled( "cannot reproduce" ) -public class MavenITmng3038TransitiveDepManVersionTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng3038TransitiveDepManVersionTest() - { - super( ALL_MAVEN_VERSIONS ); +@Disabled("cannot reproduce") +public class MavenITmng3038TransitiveDepManVersionTest extends AbstractMavenIntegrationTestCase { + public MavenITmng3038TransitiveDepManVersionTest() { + super(ALL_MAVEN_VERSIONS); } @Test - public void testitMNG3038() - throws Exception - { - File testDirBase = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3038" ); + public void testitMNG3038() throws Exception { + File testDirBase = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3038"); - compileDDep( testDirBase, "D1", "1.0" ); - compileDDep( testDirBase, "D2", "2.0" ); + compileDDep(testDirBase, "D1", "1.0"); + compileDDep(testDirBase, "D2", "2.0"); - File testProjectDir = new File( testDirBase, "test-project" ); + File testProjectDir = new File(testDirBase, "test-project"); - Verifier verifier = newVerifier( testProjectDir.getAbsolutePath() ); - verifier.deleteArtifact( "org.apache.maven.its.it0121", "A", "1.0", "pom" ); - verifier.deleteArtifact( "org.apache.maven.its.it0121", "A", "1.0", "jar" ); - verifier.deleteArtifact( "org.apache.maven.its.it0121", "B", "1.0", "pom" ); - verifier.deleteArtifact( "org.apache.maven.its.it0121", "B", "1.0", "jar" ); - verifier.deleteArtifact( "org.apache.maven.its.it0121", "C", "1.0", "pom" ); - verifier.deleteArtifact( "org.apache.maven.its.it0121", "D", "1.0", "jar" ); - verifier.addCliArgument( "install" ); + Verifier verifier = newVerifier(testProjectDir.getAbsolutePath()); + verifier.deleteArtifact("org.apache.maven.its.it0121", "A", "1.0", "pom"); + verifier.deleteArtifact("org.apache.maven.its.it0121", "A", "1.0", "jar"); + verifier.deleteArtifact("org.apache.maven.its.it0121", "B", "1.0", "pom"); + verifier.deleteArtifact("org.apache.maven.its.it0121", "B", "1.0", "jar"); + verifier.deleteArtifact("org.apache.maven.its.it0121", "C", "1.0", "pom"); + verifier.deleteArtifact("org.apache.maven.its.it0121", "D", "1.0", "jar"); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); } - private void compileDDep( File testDirBase, String projectDDepDir, String version ) - throws VerificationException, IOException - { - File testOtherDepDir = new File( testDirBase, "test-other-deps/" + projectDDepDir ); - Verifier verifierOtherDep = newVerifier( testOtherDepDir.getAbsolutePath() ); - verifierOtherDep.deleteArtifact( "org.apache.maven.its.it0121", "D", version, "jar" ); - verifierOtherDep.deleteArtifact( "org.apache.maven.its.it0121", "D", version, "pom" ); - verifierOtherDep.addCliArgument( "install" ); + private void compileDDep(File testDirBase, String projectDDepDir, String version) + throws VerificationException, IOException { + File testOtherDepDir = new File(testDirBase, "test-other-deps/" + projectDDepDir); + Verifier verifierOtherDep = newVerifier(testOtherDepDir.getAbsolutePath()); + verifierOtherDep.deleteArtifact("org.apache.maven.its.it0121", "D", version, "jar"); + verifierOtherDep.deleteArtifact("org.apache.maven.its.it0121", "D", version, "pom"); + verifierOtherDep.addCliArgument("install"); verifierOtherDep.execute(); verifierOtherDep.verifyErrorFreeLog(); } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3043BestEffortReactorResolutionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3043BestEffortReactorResolutionTest.java index 1985b86054..d3a0987981 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3043BestEffortReactorResolutionTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3043BestEffortReactorResolutionTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng3043BestEffortReactorResolutionTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3043BestEffortReactorResolutionTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3043BestEffortReactorResolutionTest() - { - super( "[3.0-alpha-3,)" ); + public MavenITmng3043BestEffortReactorResolutionTest() { + super("[3.0-alpha-3,)"); } /** @@ -49,54 +44,52 @@ public class MavenITmng3043BestEffortReactorResolutionTest * @throws Exception in case of failure */ @Test - public void testitTestPhase() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3043" ); + public void testitTestPhase() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3043"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteDirectory( "consumer-a/target" ); - verifier.deleteDirectory( "consumer-b/target" ); - verifier.deleteDirectory( "consumer-c/target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng3043" ); - verifier.setLogFileName( "log-test.txt" ); - verifier.addCliArgument( "test" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteDirectory("consumer-a/target"); + verifier.deleteDirectory("consumer-b/target"); + verifier.deleteDirectory("consumer-c/target"); + verifier.deleteArtifacts("org.apache.maven.its.mng3043"); + verifier.setLogFileName("log-test.txt"); + verifier.addCliArgument("test"); verifier.execute(); verifier.verifyErrorFreeLog(); List classpath; - classpath = verifier.loadLines( "consumer-a/target/compile.txt", "UTF-8" ); - assertContains( classpath, new String[] { "classes-test" } ); - assertNotContains( classpath, new String[] { "classes-main" } ); - classpath = verifier.loadLines( "consumer-a/target/runtime.txt", "UTF-8" ); - assertContains( classpath, new String[] { "classes-test" } ); - assertNotContains( classpath, new String[] { "classes-main" } ); - classpath = verifier.loadLines( "consumer-a/target/test.txt", "UTF-8" ); - assertContains( classpath, new String[] { "classes-test" } ); - assertNotContains( classpath, new String[] { "classes-main" } ); + classpath = verifier.loadLines("consumer-a/target/compile.txt", "UTF-8"); + assertContains(classpath, new String[] {"classes-test"}); + assertNotContains(classpath, new String[] {"classes-main"}); + classpath = verifier.loadLines("consumer-a/target/runtime.txt", "UTF-8"); + assertContains(classpath, new String[] {"classes-test"}); + assertNotContains(classpath, new String[] {"classes-main"}); + classpath = verifier.loadLines("consumer-a/target/test.txt", "UTF-8"); + assertContains(classpath, new String[] {"classes-test"}); + assertNotContains(classpath, new String[] {"classes-main"}); - classpath = verifier.loadLines( "consumer-b/target/compile.txt", "UTF-8" ); - assertContains( classpath, new String[] { "classes-main" } ); - assertNotContains( classpath, new String[] { "classes-test" } ); - classpath = verifier.loadLines( "consumer-b/target/runtime.txt", "UTF-8" ); - assertContains( classpath, new String[] { "classes-main" } ); - assertNotContains( classpath, new String[] { "classes-test" } ); - classpath = verifier.loadLines( "consumer-b/target/test.txt", "UTF-8" ); - assertContains( classpath, new String[] { "classes-main" } ); - assertNotContains( classpath, new String[] { "classes-test" } ); + classpath = verifier.loadLines("consumer-b/target/compile.txt", "UTF-8"); + assertContains(classpath, new String[] {"classes-main"}); + assertNotContains(classpath, new String[] {"classes-test"}); + classpath = verifier.loadLines("consumer-b/target/runtime.txt", "UTF-8"); + assertContains(classpath, new String[] {"classes-main"}); + assertNotContains(classpath, new String[] {"classes-test"}); + classpath = verifier.loadLines("consumer-b/target/test.txt", "UTF-8"); + assertContains(classpath, new String[] {"classes-main"}); + assertNotContains(classpath, new String[] {"classes-test"}); - classpath = verifier.loadLines( "consumer-c/target/compile.txt", "UTF-8" ); - assertContains( classpath, new String[] { "classes-main" } ); - assertContains( classpath, new String[] { "classes-test" } ); - classpath = verifier.loadLines( "consumer-c/target/runtime.txt", "UTF-8" ); - assertContains( classpath, new String[] { "classes-main" } ); - assertContains( classpath, new String[] { "classes-test" } ); - classpath = verifier.loadLines( "consumer-c/target/test.txt", "UTF-8" ); - assertContains( classpath, new String[] { "classes-main" } ); - assertContains( classpath, new String[] { "classes-test" } ); + classpath = verifier.loadLines("consumer-c/target/compile.txt", "UTF-8"); + assertContains(classpath, new String[] {"classes-main"}); + assertContains(classpath, new String[] {"classes-test"}); + classpath = verifier.loadLines("consumer-c/target/runtime.txt", "UTF-8"); + assertContains(classpath, new String[] {"classes-main"}); + assertContains(classpath, new String[] {"classes-test"}); + classpath = verifier.loadLines("consumer-c/target/test.txt", "UTF-8"); + assertContains(classpath, new String[] {"classes-main"}); + assertContains(classpath, new String[] {"classes-test"}); } /** @@ -107,20 +100,18 @@ public class MavenITmng3043BestEffortReactorResolutionTest * @throws Exception in case of failure */ @Test - public void testitPackagePhase() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3043" ); + public void testitPackagePhase() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3043"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteDirectory( "consumer-a/target" ); - verifier.deleteDirectory( "consumer-b/target" ); - verifier.deleteDirectory( "consumer-c/target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng3043" ); - verifier.setLogFileName( "log-package.txt" ); - verifier.addCliArgument( "package" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteDirectory("consumer-a/target"); + verifier.deleteDirectory("consumer-b/target"); + verifier.deleteDirectory("consumer-c/target"); + verifier.deleteArtifacts("org.apache.maven.its.mng3043"); + verifier.setLogFileName("log-package.txt"); + verifier.addCliArgument("package"); verifier.execute(); verifier.verifyErrorFreeLog(); @@ -128,61 +119,54 @@ public class MavenITmng3043BestEffortReactorResolutionTest List classpath; - classpath = verifier.loadLines( "consumer-a/target/compile.txt", "UTF-8" ); - assertContains( classpath, new String[] { prefix + "tests.jar" } ); - assertNotContains( classpath, new String[] { prefix + "client.jar" } ); - classpath = verifier.loadLines( "consumer-a/target/runtime.txt", "UTF-8" ); - assertContains( classpath, new String[] { prefix + "tests.jar" } ); - assertNotContains( classpath, new String[] { prefix + "client.jar" } ); - classpath = verifier.loadLines( "consumer-a/target/test.txt", "UTF-8" ); - assertContains( classpath, new String[] { prefix + "tests.jar" } ); - assertNotContains( classpath, new String[] { prefix + "client.jar" } ); + classpath = verifier.loadLines("consumer-a/target/compile.txt", "UTF-8"); + assertContains(classpath, new String[] {prefix + "tests.jar"}); + assertNotContains(classpath, new String[] {prefix + "client.jar"}); + classpath = verifier.loadLines("consumer-a/target/runtime.txt", "UTF-8"); + assertContains(classpath, new String[] {prefix + "tests.jar"}); + assertNotContains(classpath, new String[] {prefix + "client.jar"}); + classpath = verifier.loadLines("consumer-a/target/test.txt", "UTF-8"); + assertContains(classpath, new String[] {prefix + "tests.jar"}); + assertNotContains(classpath, new String[] {prefix + "client.jar"}); - classpath = verifier.loadLines( "consumer-b/target/compile.txt", "UTF-8" ); - assertContains( classpath, new String[] { prefix + "client.jar" } ); - assertNotContains( classpath, new String[] { prefix + "tests.jar" } ); - classpath = verifier.loadLines( "consumer-b/target/runtime.txt", "UTF-8" ); - assertContains( classpath, new String[] { prefix + "client.jar" } ); - assertNotContains( classpath, new String[] { prefix + "tests.jar" } ); - classpath = verifier.loadLines( "consumer-b/target/test.txt", "UTF-8" ); - assertContains( classpath, new String[] { prefix + "client.jar" } ); - assertNotContains( classpath, new String[] { prefix + "tests.jar" } ); + classpath = verifier.loadLines("consumer-b/target/compile.txt", "UTF-8"); + assertContains(classpath, new String[] {prefix + "client.jar"}); + assertNotContains(classpath, new String[] {prefix + "tests.jar"}); + classpath = verifier.loadLines("consumer-b/target/runtime.txt", "UTF-8"); + assertContains(classpath, new String[] {prefix + "client.jar"}); + assertNotContains(classpath, new String[] {prefix + "tests.jar"}); + classpath = verifier.loadLines("consumer-b/target/test.txt", "UTF-8"); + assertContains(classpath, new String[] {prefix + "client.jar"}); + assertNotContains(classpath, new String[] {prefix + "tests.jar"}); - classpath = verifier.loadLines( "consumer-c/target/compile.txt", "UTF-8" ); - assertContains( classpath, new String[] { prefix + "client.jar" } ); - assertContains( classpath, new String[] { prefix + "tests.jar" } ); - classpath = verifier.loadLines( "consumer-c/target/runtime.txt", "UTF-8" ); - assertContains( classpath, new String[] { prefix + "client.jar" } ); - assertContains( classpath, new String[] { prefix + "tests.jar" } ); - classpath = verifier.loadLines( "consumer-c/target/test.txt", "UTF-8" ); - assertContains( classpath, new String[] { prefix + "client.jar" } ); - assertContains( classpath, new String[] { prefix + "tests.jar" } ); + classpath = verifier.loadLines("consumer-c/target/compile.txt", "UTF-8"); + assertContains(classpath, new String[] {prefix + "client.jar"}); + assertContains(classpath, new String[] {prefix + "tests.jar"}); + classpath = verifier.loadLines("consumer-c/target/runtime.txt", "UTF-8"); + assertContains(classpath, new String[] {prefix + "client.jar"}); + assertContains(classpath, new String[] {prefix + "tests.jar"}); + classpath = verifier.loadLines("consumer-c/target/test.txt", "UTF-8"); + assertContains(classpath, new String[] {prefix + "client.jar"}); + assertContains(classpath, new String[] {prefix + "tests.jar"}); } - private void assertContains( List collection, String[] items ) - { - for ( String item : items ) - { - assertContains( collection, item ); + private void assertContains(List collection, String[] items) { + for (String item : items) { + assertContains(collection, item); } } - private void assertContains( List collection, String item ) - { - assertTrue( item + " missing in " + collection, collection.contains( item ) ); + private void assertContains(List collection, String item) { + assertTrue(item + " missing in " + collection, collection.contains(item)); } - private void assertNotContains( List collection, String[] items ) - { - for ( String item : items ) - { - assertNotContains( collection, item ); + private void assertNotContains(List collection, String[] items) { + for (String item : items) { + assertNotContains(collection, item); } } - private void assertNotContains( List collection, String item ) - { - assertFalse( item + " present in " + collection, collection.contains( item ) ); + private void assertNotContains(List collection, String item) { + assertFalse(item + " present in " + collection, collection.contains(item)); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3052DepRepoAggregationTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3052DepRepoAggregationTest.java index dd6b8aa0ca..6290568489 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3052DepRepoAggregationTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3052DepRepoAggregationTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -40,36 +38,33 @@ import org.junit.jupiter.api.Test; * * @author jdcasey */ -public class MavenITmng3052DepRepoAggregationTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3052DepRepoAggregationTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3052DepRepoAggregationTest() - { - super( "(2.0.9,)" ); // only test in 2.0.10+ + public MavenITmng3052DepRepoAggregationTest() { + super("(2.0.9,)"); // only test in 2.0.10+ } @Test - public void testitMNG3052 () - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3052" ).getCanonicalFile(); + public void testitMNG3052() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3052") + .getCanonicalFile(); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng3052" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.filterFile( "repo-d/org/apache/maven/its/mng3052/direct/0.1-SNAPSHOT/template.pom", - "repo-d/org/apache/maven/its/mng3052/direct/0.1-SNAPSHOT/direct-0.1-20090517.133956-1.pom", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng3052"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.filterFile( + "repo-d/org/apache/maven/its/mng3052/direct/0.1-SNAPSHOT/template.pom", + "repo-d/org/apache/maven/its/mng3052/direct/0.1-SNAPSHOT/direct-0.1-20090517.133956-1.pom", + "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng3052", "direct", "0.1-SNAPSHOT", "jar" ); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng3052", "trans", "0.1-SNAPSHOT", "jar" ); + verifier.verifyArtifactPresent("org.apache.maven.its.mng3052", "direct", "0.1-SNAPSHOT", "jar"); + verifier.verifyArtifactPresent("org.apache.maven.its.mng3052", "trans", "0.1-SNAPSHOT", "jar"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3092SnapshotsExcludedFromVersionRangeTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3092SnapshotsExcludedFromVersionRangeTest.java index 11735cb38e..ebbf0d5c46 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3092SnapshotsExcludedFromVersionRangeTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3092SnapshotsExcludedFromVersionRangeTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; @@ -33,14 +31,11 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -@Disabled( "not fixed yet" ) -public class MavenITmng3092SnapshotsExcludedFromVersionRangeTest - extends AbstractMavenIntegrationTestCase -{ +@Disabled("not fixed yet") +public class MavenITmng3092SnapshotsExcludedFromVersionRangeTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3092SnapshotsExcludedFromVersionRangeTest() - { - super( "[3.0-beta-1,)" ); + public MavenITmng3092SnapshotsExcludedFromVersionRangeTest() { + super("[3.0-beta-1,)"); } /** @@ -50,26 +45,23 @@ public class MavenITmng3092SnapshotsExcludedFromVersionRangeTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3092" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3092"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng3092" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng3092"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List classpath = verifier.loadLines( "target/classpath.txt", "UTF-8" ); - assertTrue( classpath.toString(), classpath.contains( "a-1.1.jar" ) ); - assertTrue( classpath.toString(), classpath.contains( "b-1.0-SNAPSHOT.jar" ) ); - assertTrue( classpath.toString(), classpath.contains( "c-1.1-SNAPSHOT.jar" ) ); + List classpath = verifier.loadLines("target/classpath.txt", "UTF-8"); + assertTrue(classpath.toString(), classpath.contains("a-1.1.jar")); + assertTrue(classpath.toString(), classpath.contains("b-1.0-SNAPSHOT.jar")); + assertTrue(classpath.toString(), classpath.contains("c-1.1-SNAPSHOT.jar")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3099SettingsProfilesWithNoPomTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3099SettingsProfilesWithNoPomTest.java index 3150695531..2bc2676464 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3099SettingsProfilesWithNoPomTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3099SettingsProfilesWithNoPomTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * * @author Brian Fox */ -public class MavenITmng3099SettingsProfilesWithNoPomTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3099SettingsProfilesWithNoPomTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3099SettingsProfilesWithNoPomTest() - { - super( "(2.0.8,)" ); // 2.0.9+ + public MavenITmng3099SettingsProfilesWithNoPomTest() { + super("(2.0.8,)"); // 2.0.9+ } /** @@ -48,24 +43,21 @@ public class MavenITmng3099SettingsProfilesWithNoPomTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3099" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3099"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng3099" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "org.apache.maven.its.mng3099:maven-mng3099-plugin:0.1:touch" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng3099"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("org.apache.maven.its.mng3099:maven-mng3099-plugin:0.1:touch"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/PASSED.txt" ); - verifier.verifyFileNotPresent( "target/touch.txt" ); + verifier.verifyFilePresent("target/PASSED.txt"); + verifier.verifyFileNotPresent("target/touch.txt"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3118TestClassPathOrderTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3118TestClassPathOrderTest.java index db1f36f8dd..af2bce344a 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3118TestClassPathOrderTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3118TestClassPathOrderTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Arrays; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng3118TestClassPathOrderTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3118TestClassPathOrderTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3118TestClassPathOrderTest() - { - super( "[2.0.8,)" ); + public MavenITmng3118TestClassPathOrderTest() { + super("[2.0.8,)"); } /** @@ -48,20 +43,17 @@ public class MavenITmng3118TestClassPathOrderTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3118" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3118"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List testClassPath = verifier.loadLines( "target/test-classpath.txt", "UTF-8" ); - assertEquals( Arrays.asList( new String[] { "test-classes", "classes" } ), testClassPath ); + List testClassPath = verifier.loadLines("target/test-classpath.txt", "UTF-8"); + assertEquals(Arrays.asList(new String[] {"test-classes", "classes"}), testClassPath); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3122ActiveProfilesNoDuplicatesTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3122ActiveProfilesNoDuplicatesTest.java index 218a617482..095c4e736c 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3122ActiveProfilesNoDuplicatesTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3122ActiveProfilesNoDuplicatesTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3122ActiveProfilesNoDuplicatesTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3122ActiveProfilesNoDuplicatesTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3122ActiveProfilesNoDuplicatesTest() - { - super( "[3.0-alpha-3,)" ); + public MavenITmng3122ActiveProfilesNoDuplicatesTest() { + super("[3.0-alpha-3,)"); } /** @@ -49,31 +44,26 @@ public class MavenITmng3122ActiveProfilesNoDuplicatesTest * @throws Exception in case of failure */ @Test - public void testitMNG3122() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3122" ); + public void testitMNG3122() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3122"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/profile.properties" ); + Properties props = verifier.loadProperties("target/profile.properties"); int count = 0; - int n = Integer.parseInt( props.getProperty( "project.activeProfiles", "0" ) ); - for ( int i = 0; i < n; i++ ) - { - if ( "mng3122".equals( props.getProperty( "project.activeProfiles." + i + ".id" ) ) ) - { + int n = Integer.parseInt(props.getProperty("project.activeProfiles", "0")); + for (int i = 0; i < n; i++) { + if ("mng3122".equals(props.getProperty("project.activeProfiles." + i + ".id"))) { count++; } } - assertEquals( 1, count ); + assertEquals(1, count); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3133UrlNormalizationNotBeforeInterpolationTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3133UrlNormalizationNotBeforeInterpolationTest.java index 9f23475a9c..6db3570358 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3133UrlNormalizationNotBeforeInterpolationTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3133UrlNormalizationNotBeforeInterpolationTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng3133UrlNormalizationNotBeforeInterpolationTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3133UrlNormalizationNotBeforeInterpolationTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3133UrlNormalizationNotBeforeInterpolationTest() - { - super( "[3.0-beta-1,)" ); + public MavenITmng3133UrlNormalizationNotBeforeInterpolationTest() { + super("[3.0-beta-1,)"); } /** @@ -49,41 +44,38 @@ public class MavenITmng3133UrlNormalizationNotBeforeInterpolationTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3133" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3133"); - Verifier verifier = newVerifier( new File( testDir, "child" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(new File(testDir, "child").getAbsolutePath()); + verifier.setAutoclean(false); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/url.properties" ); + Properties props = verifier.loadProperties("target/url.properties"); String url; - url = props.getProperty( "project.url" ); - assertEquals( "http://server.org/child", url ); - url = props.getProperty( "project.scm.url" ); - assertEquals( "scm:svn:https://svn.org/child", url ); - url = props.getProperty( "project.scm.connection" ); - assertEquals( "scm:svn:https://svn.org/child", url ); - url = props.getProperty( "project.scm.developerConnection" ); - assertEquals( "scm:svn:https://svn.org/child", url ); - url = props.getProperty( "project.distributionManagement.site.url" ); - assertEquals( "dav://server.org/child", url ); + url = props.getProperty("project.url"); + assertEquals("http://server.org/child", url); + url = props.getProperty("project.scm.url"); + assertEquals("scm:svn:https://svn.org/child", url); + url = props.getProperty("project.scm.connection"); + assertEquals("scm:svn:https://svn.org/child", url); + url = props.getProperty("project.scm.developerConnection"); + assertEquals("scm:svn:https://svn.org/child", url); + url = props.getProperty("project.distributionManagement.site.url"); + assertEquals("dav://server.org/child", url); - url = props.getProperty( "project.properties.projectUrl" ); - assertEquals( "http://server.org/child/it", url ); - url = props.getProperty( "project.properties.projectScmUrl" ); - assertEquals( "scm:svn:https://svn.org/child/it", url ); - url = props.getProperty( "project.properties.projectScmConn" ); - assertEquals( "scm:svn:https://svn.org/child/it", url ); - url = props.getProperty( "project.properties.projectScmDevConn" ); - assertEquals( "scm:svn:https://svn.org/child/it", url ); - url = props.getProperty( "project.properties.projectDistSiteUrl" ); - assertEquals( "dav://server.org/child/it", url ); + url = props.getProperty("project.properties.projectUrl"); + assertEquals("http://server.org/child/it", url); + url = props.getProperty("project.properties.projectScmUrl"); + assertEquals("scm:svn:https://svn.org/child/it", url); + url = props.getProperty("project.properties.projectScmConn"); + assertEquals("scm:svn:https://svn.org/child/it", url); + url = props.getProperty("project.properties.projectScmDevConn"); + assertEquals("scm:svn:https://svn.org/child/it", url); + url = props.getProperty("project.properties.projectDistSiteUrl"); + assertEquals("dav://server.org/child/it", url); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3139UseCachedMetadataOfBlacklistedRepoTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3139UseCachedMetadataOfBlacklistedRepoTest.java index 07ec51f66b..79230298bf 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3139UseCachedMetadataOfBlacklistedRepoTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3139UseCachedMetadataOfBlacklistedRepoTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Collections; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3139UseCachedMetadataOfBlacklistedRepoTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3139UseCachedMetadataOfBlacklistedRepoTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3139UseCachedMetadataOfBlacklistedRepoTest() - { - super( "[2.0.11,2.1.0-M1),[2.1.0,)" ); + public MavenITmng3139UseCachedMetadataOfBlacklistedRepoTest() { + super("[2.0.11,2.1.0-M1),[2.1.0,)"); } /** @@ -48,38 +43,38 @@ public class MavenITmng3139UseCachedMetadataOfBlacklistedRepoTest * @throws Exception in case of failure */ @Test - public void testitMNG3139() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3139" ); + public void testitMNG3139() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3139"); // phase 1: get the metadata into the local repo - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng3139" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng3139"); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.setLogFileName( "log1.txt" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.setLogFileName("log1.txt"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); // phase 2: trigger blacklisting of repo (by invalid URL) and check previously downloaded metadata is still used - verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); + verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", - Collections.singletonMap( "@baseurl@", "http://localhost:63412" ) ); - verifier.setLogFileName( "log2.txt" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + verifier.filterFile( + "settings-template.xml", + "settings.xml", + "UTF-8", + Collections.singletonMap("@baseurl@", "http://localhost:63412")); + verifier.setLogFileName("log2.txt"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3183LoggingToFileTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3183LoggingToFileTest.java index c2c8f278a8..d905981a74 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3183LoggingToFileTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3183LoggingToFileTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,15 +16,15 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Collections; import java.util.Iterator; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -34,13 +32,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng3183LoggingToFileTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3183LoggingToFileTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3183LoggingToFileTest() - { - super( "[3.0-alpha-1,)" ); + public MavenITmng3183LoggingToFileTest() { + super("[3.0-alpha-1,)"); } /** @@ -49,46 +44,40 @@ public class MavenITmng3183LoggingToFileTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3183" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3183"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.addCliArgument( "-l" ); - verifier.addCliArgument( "maven.log" ); - verifier.setLogFileName( "stdout.txt" ); - new File( testDir, "stdout.txt" ).delete(); - new File( testDir, "maven.log" ).delete(); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.addCliArgument("-l"); + verifier.addCliArgument("maven.log"); + verifier.setLogFileName("stdout.txt"); + new File(testDir, "stdout.txt").delete(); + new File(testDir, "maven.log").delete(); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List stdout = verifier.loadLines( "stdout.txt", "UTF-8" ); + List stdout = verifier.loadLines("stdout.txt", "UTF-8"); - for ( Iterator it = stdout.iterator(); it.hasNext(); ) - { + for (Iterator it = stdout.iterator(); it.hasNext(); ) { String line = it.next(); - if ( line.startsWith( "+" ) || line.startsWith( "EMMA" ) ) - { + if (line.startsWith("+") || line.startsWith("EMMA")) { it.remove(); } } - if ( getMavenVersion().getMajorVersion() < 4 ) - { + if (getMavenVersion().getMajorVersion() < 4) { assertEquals(Collections.EMPTY_LIST, stdout); - } - else - { - assertEquals( 1, stdout.size() ); - assertEquals( "Unable to find the root directory. Create a .mvn directory in the root directory or add the root=\"true\" attribute on the root project's model to identify it.", stdout.iterator().next() ); + } else { + assertEquals(1, stdout.size()); + assertEquals( + "Unable to find the root directory. Create a .mvn directory in the root directory or add the root=\"true\" attribute on the root project's model to identify it.", + stdout.iterator().next()); } - List log = verifier.loadLines( "maven.log", "UTF-8" ); + List log = verifier.loadLines("maven.log", "UTF-8"); - assertFalse( log.isEmpty() ); + assertFalse(log.isEmpty()); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3203DefaultLifecycleExecIdTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3203DefaultLifecycleExecIdTest.java index 9324275d3a..0d72c69064 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3203DefaultLifecycleExecIdTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3203DefaultLifecycleExecIdTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.it; * "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 + * 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 @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -35,26 +33,21 @@ import org.junit.jupiter.api.Test; * @author jdcasey * */ -public class MavenITmng3203DefaultLifecycleExecIdTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3203DefaultLifecycleExecIdTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3203DefaultLifecycleExecIdTest() - { - super( "[2.2.0,)" ); + public MavenITmng3203DefaultLifecycleExecIdTest() { + super("[2.2.0,)"); } @Test - public void testitMNG3203 () - throws Exception - { + public void testitMNG3203() throws Exception { // The testdir is computed from the location of this // file. - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3203" ); + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3203"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); - verifier.addCliArgument( "compile" ); + verifier.addCliArgument("compile"); verifier.execute(); verifier.verifyErrorFreeLog(); } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3208ProfileAwareReactorSortingTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3208ProfileAwareReactorSortingTest.java index ad7540b964..82854602e5 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3208ProfileAwareReactorSortingTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3208ProfileAwareReactorSortingTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Arrays; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng3208ProfileAwareReactorSortingTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3208ProfileAwareReactorSortingTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3208ProfileAwareReactorSortingTest() - { - super( "[2.0.3,)" ); + public MavenITmng3208ProfileAwareReactorSortingTest() { + super("[2.0.3,)"); } /** @@ -48,21 +43,18 @@ public class MavenITmng3208ProfileAwareReactorSortingTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3208" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3208"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "-Pmng3208" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("-Pmng3208"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List order = verifier.loadLines( "target/order.txt", "UTF-8" ); - assertEquals( Arrays.asList( new String[] { "mod-b", "mod-a" } ), order ); + List order = verifier.loadLines("target/order.txt", "UTF-8"); + assertEquals(Arrays.asList(new String[] {"mod-b", "mod-a"}), order); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3217InterPluginDependencyTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3217InterPluginDependencyTest.java index 49e9408116..ea78766501 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3217InterPluginDependencyTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3217InterPluginDependencyTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3217InterPluginDependencyTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3217InterPluginDependencyTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3217InterPluginDependencyTest() - { - super( "[2.1.0-M2,)" ); + public MavenITmng3217InterPluginDependencyTest() { + super("[2.1.0-M2,)"); } /** @@ -48,25 +43,22 @@ public class MavenITmng3217InterPluginDependencyTest * @throws Exception in case of failure */ @Test - public void testitMNG3217() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3217" ); + public void testitMNG3217() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3217"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "sub-1/target" ); - verifier.deleteDirectory( "sub-2/target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng3217" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("sub-1/target"); + verifier.deleteDirectory("sub-2/target"); + verifier.deleteArtifacts("org.apache.maven.its.mng3217"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "sub-1/target/touch-1.txt" ); - verifier.verifyFilePresent( "sub-2/target/touch-2.txt" ); + verifier.verifyFilePresent("sub-1/target/touch-1.txt"); + verifier.verifyFilePresent("sub-2/target/touch-2.txt"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3220ImportScopeTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3220ImportScopeTest.java index 6a78f782ac..b465e406dc 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3220ImportScopeTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3220ImportScopeTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,77 +31,63 @@ import org.junit.jupiter.api.Test; * * */ -public class MavenITmng3220ImportScopeTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng3220ImportScopeTest() - { - super( "(2.0.8,3.0-alpha-1),[3.0-alpha-3,)" ); +public class MavenITmng3220ImportScopeTest extends AbstractMavenIntegrationTestCase { + public MavenITmng3220ImportScopeTest() { + super("(2.0.8,3.0-alpha-1),[3.0-alpha-3,)"); } @Test - public void testitMNG3220a() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3220" ); + public void testitMNG3220a() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3220"); - testDir = new File( testDir, "imported-pom-depMgmt" ); + testDir = new File(testDir, "imported-pom-depMgmt"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng3220" ); - verifier.filterFile( "../settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng3220"); + verifier.filterFile("../settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); } @Test - public void testitMNG3220b() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3220" ); + public void testitMNG3220b() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3220"); - testDir = new File( testDir, "depMgmt-pom-module-notImported" ); + testDir = new File(testDir, "depMgmt-pom-module-notImported"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng3220" ); - verifier.filterFile( "../settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng3220"); + verifier.filterFile("../settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); - try - { - verifier.addCliArgument( "validate" ); + try { + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - fail( "Should fail to build with missing junit version." ); - } - catch ( VerificationException e ) - { + fail("Should fail to build with missing junit version."); + } catch (VerificationException e) { // expected } - - List lines = verifier.loadFile( new File( testDir, "log.txt" ), false ); + List lines = verifier.loadFile(new File(testDir, "log.txt"), false); boolean found = false; - for ( String line : lines ) - { - if ( line.contains( "\'dependencies.dependency.version\' is missing for junit:junit" ) || line.contains( - "\'dependencies.dependency.version\' for junit:junit:jar is missing" ) ) - { + for (String line : lines) { + if (line.contains("\'dependencies.dependency.version\' is missing for junit:junit") + || line.contains("\'dependencies.dependency.version\' for junit:junit:jar is missing")) { found = true; break; } } - assertTrue( "Should have found validation error line in output.", found ); + assertTrue("Should have found validation error line in output.", found); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3259DepsDroppedInMultiModuleBuildTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3259DepsDroppedInMultiModuleBuildTest.java index c9dbbb4369..0367992fd8 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3259DepsDroppedInMultiModuleBuildTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3259DepsDroppedInMultiModuleBuildTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,38 +29,32 @@ import org.junit.jupiter.api.Test; * * */ -public class MavenITmng3259DepsDroppedInMultiModuleBuildTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3259DepsDroppedInMultiModuleBuildTest extends AbstractMavenIntegrationTestCase { /* * TODO: All combinations from the cross product {jdk-1.4.2_16, jdk-1.5.0_14, jdk-1.6.0_07} x {mvn-2.0.7, mvn-2.0.8} * passed this test for me (bentmann on WinXP). This makes the test appear very weak. */ - public MavenITmng3259DepsDroppedInMultiModuleBuildTest() - { - super( "(2.0.8,)" ); + public MavenITmng3259DepsDroppedInMultiModuleBuildTest() { + super("(2.0.8,)"); } @Test - public void testitMNG3259 () - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3259" ); + public void testitMNG3259() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3259"); Verifier verifier; - verifier = newVerifier( new File( testDir, "parent" ).getAbsolutePath(), "remote" ); + verifier = newVerifier(new File(testDir, "parent").getAbsolutePath(), "remote"); - verifier.addCliArgument( "install" ); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); + verifier = newVerifier(testDir.getAbsolutePath(), "remote"); - verifier = newVerifier( testDir.getAbsolutePath(), "remote" ); - - verifier.addCliArgument( "install" ); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3268MultipleHyphenPCommandLineTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3268MultipleHyphenPCommandLineTest.java index 6b18f7934f..d3c9d6be88 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3268MultipleHyphenPCommandLineTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3268MultipleHyphenPCommandLineTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,37 +29,31 @@ import org.junit.jupiter.api.Test; * * */ -public class MavenITmng3268MultipleHyphenPCommandLineTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3268MultipleHyphenPCommandLineTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3268MultipleHyphenPCommandLineTest() - { - super( "(2.0.9,)" ); + public MavenITmng3268MultipleHyphenPCommandLineTest() { + super("(2.0.9,)"); } @Test - public void testMultipleProfileParams() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3268" ); + public void testMultipleProfileParams() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3268"); Verifier verifier; - verifier = newVerifier( testDir.getAbsolutePath(), "remote" ); + verifier = newVerifier(testDir.getAbsolutePath(), "remote"); - verifier.addCliArgument( "-Pprofile1,profile2" ); - verifier.addCliArgument( "-Pprofile3" ); - verifier.addCliArgument( "-P" ); - verifier.addCliArgument( "profile4" ); - verifier.addCliArgument( "package" ); + verifier.addCliArgument("-Pprofile1,profile2"); + verifier.addCliArgument("-Pprofile3"); + verifier.addCliArgument("-P"); + verifier.addCliArgument("profile4"); + verifier.addCliArgument("package"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/profile1/touch.txt" ); - verifier.verifyFilePresent( "target/profile2/touch.txt" ); - verifier.verifyFilePresent( "target/profile3/touch.txt" ); - verifier.verifyFilePresent( "target/profile4/touch.txt" ); + verifier.verifyFilePresent("target/profile1/touch.txt"); + verifier.verifyFilePresent("target/profile2/touch.txt"); + verifier.verifyFilePresent("target/profile3/touch.txt"); + verifier.verifyFilePresent("target/profile4/touch.txt"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3284UsingCachedPluginsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3284UsingCachedPluginsTest.java index 6d8a00e623..8c3baa1bd3 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3284UsingCachedPluginsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3284UsingCachedPluginsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,25 +16,22 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** * This is a test set for MNG-3284: * that explicitly defined plugins are used, not the one that is cached. */ -public class MavenITmng3284UsingCachedPluginsTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3284UsingCachedPluginsTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3284UsingCachedPluginsTest() - { - super( "[2.1.0-M2,)" ); + public MavenITmng3284UsingCachedPluginsTest() { + super("[2.1.0-M2,)"); } /** @@ -46,10 +41,8 @@ public class MavenITmng3284UsingCachedPluginsTest * @throws Exception in case of failure */ @Test - public void testitMNG3284() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3284" ); + public void testitMNG3284() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3284"); /* * Phase 1: Ensure both plugin versions are already in the local repo. This is a crucial prerequisite for the @@ -57,33 +50,32 @@ public class MavenITmng3284UsingCachedPluginsTest * reloading of the plugin container by the DefaultPluginManager in Maven 2.x, thereby hiding the bug we want * to expose here. */ - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng3284" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng3284"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); /* * Phase 2: Now that the plugin versions have been downloaded to the local repo, run the actual test. */ - verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "mod-a/target" ); - verifier.deleteDirectory( "mod-b/target" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("mod-a/target"); + verifier.deleteDirectory("mod-b/target"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "mod-a/target/version-0.1.txt" ); - verifier.verifyFileNotPresent( "mod-a/target/version-0.2.txt" ); - verifier.verifyFilePresent( "mod-b/target/version-0.2.txt" ); - verifier.verifyFileNotPresent( "mod-b/target/version-0.1.txt" ); + verifier.verifyFilePresent("mod-a/target/version-0.1.txt"); + verifier.verifyFileNotPresent("mod-a/target/version-0.2.txt"); + verifier.verifyFilePresent("mod-b/target/version-0.2.txt"); + verifier.verifyFileNotPresent("mod-b/target/version-0.1.txt"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3288SystemScopeDirTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3288SystemScopeDirTest.java index 28900d5cca..d44c979d76 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3288SystemScopeDirTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3288SystemScopeDirTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,12 +30,9 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng3288SystemScopeDirTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng3288SystemScopeDirTest() - { - super( "[2.0.9,)" ); +public class MavenITmng3288SystemScopeDirTest extends AbstractMavenIntegrationTestCase { + public MavenITmng3288SystemScopeDirTest() { + super("[2.0.9,)"); } /** @@ -46,23 +41,17 @@ public class MavenITmng3288SystemScopeDirTest * @throws Exception in case of failure */ @Test - public void testitMNG3288() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3288" ); + public void testitMNG3288() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3288"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - try - { - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + try { + verifier.addCliArgument("validate"); verifier.execute(); - fail( "Usage of directory instead of file for system-scoped dependency did not fail dependency resolution" ); - } - catch ( VerificationException e ) - { + fail("Usage of directory instead of file for system-scoped dependency did not fail dependency resolution"); + } catch (VerificationException e) { // expected, of a system-scoped dependency should be a file, not a directory } } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3297DependenciesNotLeakedToMojoTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3297DependenciesNotLeakedToMojoTest.java index ede4367b57..e56473463f 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3297DependenciesNotLeakedToMojoTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3297DependenciesNotLeakedToMojoTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng3297DependenciesNotLeakedToMojoTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3297DependenciesNotLeakedToMojoTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3297DependenciesNotLeakedToMojoTest() - { - super( "[3.0-alpha-7,)" ); + public MavenITmng3297DependenciesNotLeakedToMojoTest() { + super("[3.0-alpha-7,)"); } /** @@ -49,23 +44,20 @@ public class MavenITmng3297DependenciesNotLeakedToMojoTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3297" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3297"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "initialize" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("initialize"); verifier.execute(); verifier.verifyErrorFreeLog(); - List artifacts = verifier.loadLines( "target/artifacts.txt", "UTF-8" ); - assertEquals( artifacts.toString(), 1, artifacts.size() ); + List artifacts = verifier.loadLines("target/artifacts.txt", "UTF-8"); + assertEquals(artifacts.toString(), 1, artifacts.size()); - Properties props = verifier.loadProperties( "target/artifact.properties" ); - assertEquals( "0", props.getProperty( "project.artifacts" ) ); + Properties props = verifier.loadProperties("target/artifact.properties"); + assertEquals("0", props.getProperty("project.artifacts")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3314OfflineSnapshotsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3314OfflineSnapshotsTest.java index bde113a6e0..753b736a3a 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3314OfflineSnapshotsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3314OfflineSnapshotsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -34,13 +32,10 @@ import org.junit.jupiter.api.Test; * @author Brian Fox * @author jdcasey */ -public class MavenITmng3314OfflineSnapshotsTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3314OfflineSnapshotsTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3314OfflineSnapshotsTest() - { - super( "(2.0.9,2.1.0-M1),(2.1.0-M1,)" ); // only test in 2.0.10+, and not in 2.1.0-M1 + public MavenITmng3314OfflineSnapshotsTest() { + super("(2.0.9,2.1.0-M1),(2.1.0-M1,)"); // only test in 2.0.10+, and not in 2.1.0-M1 } /** @@ -49,37 +44,34 @@ public class MavenITmng3314OfflineSnapshotsTest * @throws Exception in case of failure */ @Test - public void testitMNG3314 () - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3314" ); + public void testitMNG3314() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3314"); { // phase 1: run build in online mode to fill local repo - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.deleteArtifacts( "org.apache.maven.its.mng3314" ); - verifier.setLogFileName( "log1.txt" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.deleteArtifacts("org.apache.maven.its.mng3314"); + verifier.setLogFileName("log1.txt"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); - verifier.verifyFilePresent( "target/compile.txt" ); + verifier.verifyFilePresent("target/compile.txt"); verifier.verifyErrorFreeLog(); } { // phase 2: run build in offline mode to check it still passes - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setLogFileName( "log2.txt" ); - verifier.addCliArgument( "-o" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setLogFileName("log2.txt"); + verifier.addCliArgument("-o"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); - verifier.verifyFilePresent( "target/compile.txt" ); + verifier.verifyFilePresent("target/compile.txt"); verifier.verifyErrorFreeLog(); } } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3331ModulePathNormalizationTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3331ModulePathNormalizationTest.java index 46d557b402..2c56bad480 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3331ModulePathNormalizationTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3331ModulePathNormalizationTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,26 +30,21 @@ import org.junit.jupiter.api.Test; * @author Brian Fox * */ -public class MavenITmng3331ModulePathNormalizationTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng3331ModulePathNormalizationTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenITmng3331ModulePathNormalizationTest extends AbstractMavenIntegrationTestCase { + public MavenITmng3331ModulePathNormalizationTest() { + super(ALL_MAVEN_VERSIONS); } @Test - public void testitMNG3331a () - throws Exception - { - //testMNG3331ModuleWithSpaces - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3331/with-spaces" ); + public void testitMNG3331a() throws Exception { + // testMNG3331ModuleWithSpaces + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3331/with-spaces"); Verifier verifier; - verifier = newVerifier( testDir.getAbsolutePath() ); + verifier = newVerifier(testDir.getAbsolutePath()); - verifier.addCliArgument( "initialize" ); + verifier.addCliArgument("initialize"); verifier.execute(); /* @@ -67,17 +60,15 @@ public class MavenITmng3331ModulePathNormalizationTest } @Test - public void testitMNG3331b () - throws Exception - { - //testMNG3331ModuleWithRelativeParentDirRef - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3331/with-relative-parentDir-ref" ); + public void testitMNG3331b() throws Exception { + // testMNG3331ModuleWithRelativeParentDirRef + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3331/with-relative-parentDir-ref"); Verifier verifier; - verifier = newVerifier( new File( testDir, "parent" ).getAbsolutePath() ); + verifier = newVerifier(new File(testDir, "parent").getAbsolutePath()); - verifier.addCliArgument( "initialize" ); + verifier.addCliArgument("initialize"); verifier.execute(); /* @@ -91,5 +82,4 @@ public class MavenITmng3331ModulePathNormalizationTest */ verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3355TranslatedPathInterpolationTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3355TranslatedPathInterpolationTest.java index d589afaa6a..8e02604d5d 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3355TranslatedPathInterpolationTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3355TranslatedPathInterpolationTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,29 +29,23 @@ import org.junit.jupiter.api.Test; * * */ -public class MavenITmng3355TranslatedPathInterpolationTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng3355TranslatedPathInterpolationTest() - { - super( "(2.0.8,)" ); // 2.0.9+ +public class MavenITmng3355TranslatedPathInterpolationTest extends AbstractMavenIntegrationTestCase { + public MavenITmng3355TranslatedPathInterpolationTest() { + super("(2.0.8,)"); // 2.0.9+ } @Test - public void testitMNG3355() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3355" ); + public void testitMNG3355() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3355"); Verifier verifier; - verifier = newVerifier( testDir.getAbsolutePath() ); + verifier = newVerifier(testDir.getAbsolutePath()); - verifier.addCliArgument( "-Dversion=foo" ); - verifier.addCliArgument( "validate" ); + verifier.addCliArgument("-Dversion=foo"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3372DirectInvocationOfPluginsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3372DirectInvocationOfPluginsTest.java index 708e10c5c0..c62c8f300b 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3372DirectInvocationOfPluginsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3372DirectInvocationOfPluginsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; -import java.util.Arrays; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,59 +29,52 @@ import org.junit.jupiter.api.Test; * * */ -public class MavenITmng3372DirectInvocationOfPluginsTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3372DirectInvocationOfPluginsTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3372DirectInvocationOfPluginsTest() - { - super( "(2.0.5,)" ); + public MavenITmng3372DirectInvocationOfPluginsTest() { + super("(2.0.5,)"); } @Test - public void testitMNG3372() - throws Exception - { + public void testitMNG3372() throws Exception { // The testdir is computed from the location of this // file. - File testBaseDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3372/direct-using-prefix" ); - File plugin = new File( testBaseDir, "plugin" ); - File project = new File( testBaseDir, "project" ); - File settingsFile = new File( testBaseDir, "settings.xml" ); + File testBaseDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3372/direct-using-prefix"); + File plugin = new File(testBaseDir, "plugin"); + File project = new File(testBaseDir, "project"); + File settingsFile = new File(testBaseDir, "settings.xml"); - Verifier verifier = newVerifier( plugin.getAbsolutePath(), "remote" ); + Verifier verifier = newVerifier(plugin.getAbsolutePath(), "remote"); - verifier.deleteArtifacts( "org.apache.maven.its.mng3372" ); + verifier.deleteArtifacts("org.apache.maven.its.mng3372"); - verifier.getSystemProperties().setProperty( "updateReleaseInfo", "true" ); + verifier.getSystemProperties().setProperty("updateReleaseInfo", "true"); - verifier.addCliArguments( "clean", "install" ); + verifier.addCliArguments("clean", "install"); verifier.execute(); - verifier = newVerifier( project.getAbsolutePath() ); + verifier = newVerifier(project.getAbsolutePath()); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "\"" + settingsFile.getAbsolutePath() + "\"" ); + verifier.addCliArgument("-s"); + verifier.addCliArgument("\"" + settingsFile.getAbsolutePath() + "\""); - verifier.addCliArgument( "mng3372:test" ); + verifier.addCliArgument("mng3372:test"); verifier.execute(); verifier.verifyErrorFreeLog(); } @Test - public void testDependencyTreeInvocation() - throws Exception - { + public void testDependencyTreeInvocation() throws Exception { // The testdir is computed from the location of this // file. - File testBaseDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3372/dependency-tree" ); + File testBaseDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3372/dependency-tree"); - Verifier verifier = newVerifier( testBaseDir.getAbsolutePath(), "remote" ); + Verifier verifier = newVerifier(testBaseDir.getAbsolutePath(), "remote"); - verifier.addCliArgument( "-U" ); + verifier.addCliArgument("-U"); - verifier.addCliArgument( "dependency:tree" ); + verifier.addCliArgument("dependency:tree"); verifier.execute(); verifier.verifyErrorFreeLog(); diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3379ParallelArtifactDownloadsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3379ParallelArtifactDownloadsTest.java index 58463844b0..88ca440899 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3379ParallelArtifactDownloadsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3379ParallelArtifactDownloadsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3379ParallelArtifactDownloadsTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3379ParallelArtifactDownloadsTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3379ParallelArtifactDownloadsTest() - { - super( "[2.0.5,3.0-alpha-1),[3.0-alpha-2,)" ); + public MavenITmng3379ParallelArtifactDownloadsTest() { + super("[2.0.5,3.0-alpha-1),[3.0-alpha-2,)"); } /** @@ -48,109 +43,87 @@ public class MavenITmng3379ParallelArtifactDownloadsTest * @throws Exception in case of failure */ @Test - public void testitMNG3379() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3379" ); + public void testitMNG3379() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3379"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng3379.a" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng3379.b" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng3379.c" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng3379.d" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "-Dmaven.artifact.threads=16" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng3379.a"); + verifier.deleteArtifacts("org.apache.maven.its.mng3379.b"); + verifier.deleteArtifacts("org.apache.maven.its.mng3379.c"); + verifier.deleteArtifacts("org.apache.maven.its.mng3379.d"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("-Dmaven.artifact.threads=16"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); String gid = "org.apache.maven.its.mng3379."; - assertArtifact( verifier, gid + "a", "x", "0.2-SNAPSHOT", "", "jar", - "69c041c12f35894230c7c23c49cd245886c6fb6f" ); - assertArtifact( verifier, gid + "a", "x", "0.2-SNAPSHOT", "", "pom", - "04a8ecb6dc279585b6d17552a4518805f0ff33b9" ); - assertArtifact( verifier, gid + "a", "x", "0.2-SNAPSHOT", "tests", "jar", - "69c041c12f35894230c7c23c49cd245886c6fb6f" ); - assertArtifact( verifier, gid + "a", "x", "0.2-SNAPSHOT", "sources", "jar", - "166f8bef02b9e92f99ec3b163d8321dd1d087e34" ); - assertArtifact( verifier, gid + "a", "x", "0.2-SNAPSHOT", "javadoc", "jar", - "4d96e09f7e93870685a317c574f851b407224415" ); - assertMetadata( verifier, gid + "a", "x", "0.2-SNAPSHOT", - "e1cfc3a77657fc46bb624dee25c61b290e5b4dd7" ); + assertArtifact(verifier, gid + "a", "x", "0.2-SNAPSHOT", "", "jar", "69c041c12f35894230c7c23c49cd245886c6fb6f"); + assertArtifact(verifier, gid + "a", "x", "0.2-SNAPSHOT", "", "pom", "04a8ecb6dc279585b6d17552a4518805f0ff33b9"); + assertArtifact( + verifier, gid + "a", "x", "0.2-SNAPSHOT", "tests", "jar", "69c041c12f35894230c7c23c49cd245886c6fb6f"); + assertArtifact( + verifier, gid + "a", "x", "0.2-SNAPSHOT", "sources", "jar", "166f8bef02b9e92f99ec3b163d8321dd1d087e34"); + assertArtifact( + verifier, gid + "a", "x", "0.2-SNAPSHOT", "javadoc", "jar", "4d96e09f7e93870685a317c574f851b407224415"); + assertMetadata(verifier, gid + "a", "x", "0.2-SNAPSHOT", "e1cfc3a77657fc46bb624dee25c61b290e5b4dd7"); - assertArtifact( verifier, gid + "b", "x", "0.2-SNAPSHOT", "", "jar", - "efb7c4046565774cd7e44645e02f06ecdf91098d" ); - assertArtifact( verifier, gid + "b", "x", "0.2-SNAPSHOT", "", "pom", - "834b45a91af07702a59855bf99614c099979c065" ); - assertArtifact( verifier, gid + "b", "x", "0.2-SNAPSHOT", "tests", "jar", - "efb7c4046565774cd7e44645e02f06ecdf91098d" ); - assertArtifact( verifier, gid + "b", "x", "0.2-SNAPSHOT", "sources", "jar", - "9ad231fc04ea1114987c377cc5cbccfbf83e3dbf" ); - assertArtifact( verifier, gid + "b", "x", "0.2-SNAPSHOT", "javadoc", "jar", - "7807daefd3af3be73d3b92f9c5ab1b52510c0767" ); - assertMetadata( verifier, gid + "b", "x", "0.2-SNAPSHOT", - "5ccc4edfb503f9a5ccadedf102dff8943250d830" ); - assertMetadata( verifier, gid + "b", "x", - "8f38b1041871f22dcb031544d8a3436c335bfcdb" ); + assertArtifact(verifier, gid + "b", "x", "0.2-SNAPSHOT", "", "jar", "efb7c4046565774cd7e44645e02f06ecdf91098d"); + assertArtifact(verifier, gid + "b", "x", "0.2-SNAPSHOT", "", "pom", "834b45a91af07702a59855bf99614c099979c065"); + assertArtifact( + verifier, gid + "b", "x", "0.2-SNAPSHOT", "tests", "jar", "efb7c4046565774cd7e44645e02f06ecdf91098d"); + assertArtifact( + verifier, gid + "b", "x", "0.2-SNAPSHOT", "sources", "jar", "9ad231fc04ea1114987c377cc5cbccfbf83e3dbf"); + assertArtifact( + verifier, gid + "b", "x", "0.2-SNAPSHOT", "javadoc", "jar", "7807daefd3af3be73d3b92f9c5ab1b52510c0767"); + assertMetadata(verifier, gid + "b", "x", "0.2-SNAPSHOT", "5ccc4edfb503f9a5ccadedf102dff8943250d830"); + assertMetadata(verifier, gid + "b", "x", "8f38b1041871f22dcb031544d8a3436c335bfcdb"); - assertArtifact( verifier, gid + "c", "x", "0.2-SNAPSHOT", "", "jar", - "1eb0d5a421b3074e8a69b0dcca7e325c0636a932" ); - assertArtifact( verifier, gid + "c", "x", "0.2-SNAPSHOT", "", "pom", - "f25d7907d7bd9807e823d15f49363de7826204b0" ); - assertArtifact( verifier, gid + "c", "x", "0.2-SNAPSHOT", "tests", "jar", - "1eb0d5a421b3074e8a69b0dcca7e325c0636a932" ); - assertArtifact( verifier, gid + "c", "x", "0.2-SNAPSHOT", "sources", "jar", - "82f9664b3a910fb861fc4ed2b79e39d8f95e3675" ); - assertArtifact( verifier, gid + "c", "x", "0.2-SNAPSHOT", "javadoc", "jar", - "64a3bfe19b294f67b1c52a2514c58922b88e5f97" ); - assertMetadata( verifier, gid + "c", "x", "0.2-SNAPSHOT", - "b31ef40a51bdab4e6e44bfe3f2d1da42e5e42e46" ); - assertMetadata( verifier, gid + "c", "x", - "c4848e60d226ec6304df3abd9eba8fdb301b3660" ); + assertArtifact(verifier, gid + "c", "x", "0.2-SNAPSHOT", "", "jar", "1eb0d5a421b3074e8a69b0dcca7e325c0636a932"); + assertArtifact(verifier, gid + "c", "x", "0.2-SNAPSHOT", "", "pom", "f25d7907d7bd9807e823d15f49363de7826204b0"); + assertArtifact( + verifier, gid + "c", "x", "0.2-SNAPSHOT", "tests", "jar", "1eb0d5a421b3074e8a69b0dcca7e325c0636a932"); + assertArtifact( + verifier, gid + "c", "x", "0.2-SNAPSHOT", "sources", "jar", "82f9664b3a910fb861fc4ed2b79e39d8f95e3675"); + assertArtifact( + verifier, gid + "c", "x", "0.2-SNAPSHOT", "javadoc", "jar", "64a3bfe19b294f67b1c52a2514c58922b88e5f97"); + assertMetadata(verifier, gid + "c", "x", "0.2-SNAPSHOT", "b31ef40a51bdab4e6e44bfe3f2d1da42e5e42e46"); + assertMetadata(verifier, gid + "c", "x", "c4848e60d226ec6304df3abd9eba8fdb301b3660"); - assertArtifact( verifier, gid + "d", "x", "0.2-SNAPSHOT", "", "jar", - "3d606c564625a594165bcbbe4a24c8f11b18b5a0" ); - assertArtifact( verifier, gid + "d", "x", "0.2-SNAPSHOT", "", "pom", - "4255f7a5781e1be7564a09c86eee140fad042de8" ); - assertArtifact( verifier, gid + "d", "x", "0.2-SNAPSHOT", "tests", "jar", - "3d606c564625a594165bcbbe4a24c8f11b18b5a0" ); - assertArtifact( verifier, gid + "d", "x", "0.2-SNAPSHOT", "sources", "jar", - "35a7e140307f4bb67984dc72aa551f0faabacd36" ); - assertArtifact( verifier, gid + "d", "x", "0.2-SNAPSHOT", "javadoc", "jar", - "2fe3487f496fe66f23772b1bada066ec6bd9222f" ); - assertMetadata( verifier, gid + "d", "x", "0.2-SNAPSHOT", - "a0d0b5efd5d6f6a921a3f7c1a6a503359fccef04" ); - assertMetadata( verifier, gid + "d", "x", - "1d2bf926862f2131f1229328e588b906b087bdb3" ); + assertArtifact(verifier, gid + "d", "x", "0.2-SNAPSHOT", "", "jar", "3d606c564625a594165bcbbe4a24c8f11b18b5a0"); + assertArtifact(verifier, gid + "d", "x", "0.2-SNAPSHOT", "", "pom", "4255f7a5781e1be7564a09c86eee140fad042de8"); + assertArtifact( + verifier, gid + "d", "x", "0.2-SNAPSHOT", "tests", "jar", "3d606c564625a594165bcbbe4a24c8f11b18b5a0"); + assertArtifact( + verifier, gid + "d", "x", "0.2-SNAPSHOT", "sources", "jar", "35a7e140307f4bb67984dc72aa551f0faabacd36"); + assertArtifact( + verifier, gid + "d", "x", "0.2-SNAPSHOT", "javadoc", "jar", "2fe3487f496fe66f23772b1bada066ec6bd9222f"); + assertMetadata(verifier, gid + "d", "x", "0.2-SNAPSHOT", "a0d0b5efd5d6f6a921a3f7c1a6a503359fccef04"); + assertMetadata(verifier, gid + "d", "x", "1d2bf926862f2131f1229328e588b906b087bdb3"); } - private void assertArtifact( Verifier verifier, String gid, String aid, String ver, String cls, String ext, String sha1 ) - throws Exception - { - File file = new File( verifier.getArtifactPath( gid, aid, ver, ext, cls ) ); - assertTrue( file.getAbsolutePath(), file.isFile() ); - assertEquals( sha1, ItUtils.calcHash( file, "SHA-1" ) ); + private void assertArtifact( + Verifier verifier, String gid, String aid, String ver, String cls, String ext, String sha1) + throws Exception { + File file = new File(verifier.getArtifactPath(gid, aid, ver, ext, cls)); + assertTrue(file.getAbsolutePath(), file.isFile()); + assertEquals(sha1, ItUtils.calcHash(file, "SHA-1")); } - private void assertMetadata( Verifier verifier, String gid, String aid, String ver, String sha1 ) - throws Exception - { + private void assertMetadata(Verifier verifier, String gid, String aid, String ver, String sha1) throws Exception { String name = "maven-metadata-maven-core-it.xml"; - File file = new File( verifier.getArtifactMetadataPath( gid, aid, ver, name ) ); - assertTrue( file.getAbsolutePath(), file.isFile() ); - assertEquals( sha1, ItUtils.calcHash( file, "SHA-1" ) ); + File file = new File(verifier.getArtifactMetadataPath(gid, aid, ver, name)); + assertTrue(file.getAbsolutePath(), file.isFile()); + assertEquals(sha1, ItUtils.calcHash(file, "SHA-1")); } - private void assertMetadata( Verifier verifier, String gid, String aid, String sha1 ) - throws Exception - { + private void assertMetadata(Verifier verifier, String gid, String aid, String sha1) throws Exception { String name = "maven-metadata-maven-core-it.xml"; - File file = new File( verifier.getArtifactMetadataPath( gid, aid, null, name ) ); - assertTrue( file.getAbsolutePath(), file.isFile() ); - assertEquals( sha1, ItUtils.calcHash( file, "SHA-1" ) ); + File file = new File(verifier.getArtifactMetadataPath(gid, aid, null, name)); + assertTrue(file.getAbsolutePath(), file.isFile()); + assertEquals(sha1, ItUtils.calcHash(file, "SHA-1")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3380ManagedRelocatedTransdepsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3380ManagedRelocatedTransdepsTest.java index b732c3b843..f9d461dd10 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3380ManagedRelocatedTransdepsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3380ManagedRelocatedTransdepsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -39,13 +37,10 @@ import org.junit.jupiter.api.Test; * * */ -public class MavenITmng3380ManagedRelocatedTransdepsTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3380ManagedRelocatedTransdepsTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3380ManagedRelocatedTransdepsTest() - { - super( "(2.0.9,)" ); + public MavenITmng3380ManagedRelocatedTransdepsTest() { + super("(2.0.9,)"); } /** @@ -54,35 +49,32 @@ public class MavenITmng3380ManagedRelocatedTransdepsTest * @throws Exception in case of failure */ @Test - public void testitMNG3380() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3380" ); + public void testitMNG3380() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3380"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng3380" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng3380"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List artifacts = verifier.loadLines( "target/artifacts.txt", "UTF-8" ); - assertEquals( 4, artifacts.size() ); - assertEquals( "org.apache.maven.its.mng3380:direct:jar:1", artifacts.get( 0 ) ); - assertEquals( "org.apache.maven.its.mng3380.new:transitive:jar:2", artifacts.get( 1 ) ); - assertEquals( "org.apache.maven.its.mng3380.other:a:jar:1", artifacts.get( 2 ) ); - assertEquals( "org.apache.maven.its.mng3380.other:b:jar:1", artifacts.get( 3 ) ); + List artifacts = verifier.loadLines("target/artifacts.txt", "UTF-8"); + assertEquals(4, artifacts.size()); + assertEquals("org.apache.maven.its.mng3380:direct:jar:1", artifacts.get(0)); + assertEquals("org.apache.maven.its.mng3380.new:transitive:jar:2", artifacts.get(1)); + assertEquals("org.apache.maven.its.mng3380.other:a:jar:1", artifacts.get(2)); + assertEquals("org.apache.maven.its.mng3380.other:b:jar:1", artifacts.get(3)); - List paths = verifier.loadLines( "target/test.txt", "UTF-8" ); - assertEquals( 6, paths.size() ); - assertEquals( "direct-1.jar", paths.get( 2 ) ); - assertEquals( "transitive-2.jar", paths.get( 3 ) ); - assertEquals( "a-1.jar", paths.get( 4 ) ); - assertEquals( "b-1.jar", paths.get( 5 ) ); + List paths = verifier.loadLines("target/test.txt", "UTF-8"); + assertEquals(6, paths.size()); + assertEquals("direct-1.jar", paths.get(2)); + assertEquals("transitive-2.jar", paths.get(3)); + assertEquals("a-1.jar", paths.get(4)); + assertEquals("b-1.jar", paths.get(5)); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3394POMPluginVersionDominanceTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3394POMPluginVersionDominanceTest.java index 5763e6313c..6f7795915f 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3394POMPluginVersionDominanceTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3394POMPluginVersionDominanceTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -34,50 +32,44 @@ import org.junit.jupiter.api.Test; * when the build/plugins section is missing that plugin, and that * plugin versions in build/plugins override those in build/pluginManagement. */ -public class MavenITmng3394POMPluginVersionDominanceTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3394POMPluginVersionDominanceTest extends AbstractMavenIntegrationTestCase { private static final String BASEDIR_PREFIX = "/mng-3394/"; - public MavenITmng3394POMPluginVersionDominanceTest() - { - super( "(2.0.8,)" ); // only test in 2.0.9+ + public MavenITmng3394POMPluginVersionDominanceTest() { + super("(2.0.8,)"); // only test in 2.0.9+ } @Test - public void testitMNG3394a () - throws Exception - { - //testShouldUsePluginVersionFromPluginMgmtForLifecycleMojoWhenNotInBuildPlugins - File testDir = ResourceExtractor.simpleExtractResources( getClass(), BASEDIR_PREFIX + "lifecycleMojoVersionInPluginMgmt" ); + public void testitMNG3394a() throws Exception { + // testShouldUsePluginVersionFromPluginMgmtForLifecycleMojoWhenNotInBuildPlugins + File testDir = ResourceExtractor.simpleExtractResources( + getClass(), BASEDIR_PREFIX + "lifecycleMojoVersionInPluginMgmt"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "process-resources" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("process-resources"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/resources-resources.txt" ); + verifier.verifyFilePresent("target/resources-resources.txt"); } @Test - public void testitMNG3394b() - throws Exception - { - //testShouldPreferPluginVersionFromBuildPluginsOverThatInPluginMgmt - File testDir = ResourceExtractor.simpleExtractResources( getClass(), BASEDIR_PREFIX + "preferBuildPluginOverPluginMgmt" ); + public void testitMNG3394b() throws Exception { + // testShouldPreferPluginVersionFromBuildPluginsOverThatInPluginMgmt + File testDir = ResourceExtractor.simpleExtractResources( + getClass(), BASEDIR_PREFIX + "preferBuildPluginOverPluginMgmt"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "clean" ); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("clean"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/clean-clean.txt" ); + verifier.verifyFilePresent("target/clean-clean.txt"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3396DependencyManagementForOverConstrainedRangesTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3396DependencyManagementForOverConstrainedRangesTest.java index 2ba6689574..83e1c3c478 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3396DependencyManagementForOverConstrainedRangesTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3396DependencyManagementForOverConstrainedRangesTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,51 +29,46 @@ import org.junit.jupiter.api.Test; * * */ -public class MavenITmng3396DependencyManagementForOverConstrainedRangesTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3396DependencyManagementForOverConstrainedRangesTest extends AbstractMavenIntegrationTestCase { private static final String GROUP_ID = "org.apache.maven.its.mng3396"; - public MavenITmng3396DependencyManagementForOverConstrainedRangesTest() - { - super( "(2.0.8,)" ); // 2.0.9+ + public MavenITmng3396DependencyManagementForOverConstrainedRangesTest() { + super("(2.0.8,)"); // 2.0.9+ } @Test - public void testitMNG3396() - throws Exception - { + public void testitMNG3396() throws Exception { String baseDir = "/mng-3396"; - File testDir = ResourceExtractor.simpleExtractResources( getClass(), baseDir + "/dependencies" ); + File testDir = ResourceExtractor.simpleExtractResources(getClass(), baseDir + "/dependencies"); - Verifier verifier = newVerifier( testDir.getAbsolutePath(), "remote" ); - verifier.deleteArtifact( GROUP_ID, "A", "1.0", "pom" ); - verifier.deleteArtifact( GROUP_ID, "A", "1.0", "jar" ); - verifier.deleteArtifact( GROUP_ID, "B", "1.0", "pom" ); - verifier.deleteArtifact( GROUP_ID, "B", "1.0", "jar" ); - verifier.addCliArgument( "install" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath(), "remote"); + verifier.deleteArtifact(GROUP_ID, "A", "1.0", "pom"); + verifier.deleteArtifact(GROUP_ID, "A", "1.0", "jar"); + verifier.deleteArtifact(GROUP_ID, "B", "1.0", "pom"); + verifier.deleteArtifact(GROUP_ID, "B", "1.0", "jar"); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); - testDir = ResourceExtractor.simpleExtractResources( getClass(), baseDir + "/plugin" ); + testDir = ResourceExtractor.simpleExtractResources(getClass(), baseDir + "/plugin"); - verifier = newVerifier( testDir.getAbsolutePath(), "remote" ); - verifier.deleteArtifact( GROUP_ID, "A", "1.0", "pom" ); - verifier.deleteArtifact( GROUP_ID, "A", "1.0", "jar" ); - verifier.deleteArtifact( GROUP_ID, "A", "3.0", "pom" ); - verifier.deleteArtifact( GROUP_ID, "A", "3.0", "jar" ); - verifier.deleteArtifact( GROUP_ID, "plugin", "1.0", "pom" ); - verifier.deleteArtifact( GROUP_ID, "plugin", "1.0", "jar" ); - verifier.addCliArgument( "install" ); + verifier = newVerifier(testDir.getAbsolutePath(), "remote"); + verifier.deleteArtifact(GROUP_ID, "A", "1.0", "pom"); + verifier.deleteArtifact(GROUP_ID, "A", "1.0", "jar"); + verifier.deleteArtifact(GROUP_ID, "A", "3.0", "pom"); + verifier.deleteArtifact(GROUP_ID, "A", "3.0", "jar"); + verifier.deleteArtifact(GROUP_ID, "plugin", "1.0", "pom"); + verifier.deleteArtifact(GROUP_ID, "plugin", "1.0", "jar"); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); - testDir = ResourceExtractor.simpleExtractResources( getClass(), baseDir + "/pluginuser" ); + testDir = ResourceExtractor.simpleExtractResources(getClass(), baseDir + "/pluginuser"); - verifier = newVerifier( testDir.getAbsolutePath(), "remote" ); - verifier.deleteArtifact( GROUP_ID, "pluginuser", "1.0", "pom" ); - verifier.deleteArtifact( GROUP_ID, "pluginuser", "1.0", "jar" ); - verifier.addCliArgument( "install" ); + verifier = newVerifier(testDir.getAbsolutePath(), "remote"); + verifier.deleteArtifact(GROUP_ID, "pluginuser", "1.0", "pom"); + verifier.deleteArtifact(GROUP_ID, "pluginuser", "1.0", "jar"); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3401CLIDefaultExecIdTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3401CLIDefaultExecIdTest.java index 8f59e44988..225c2d9ea1 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3401CLIDefaultExecIdTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3401CLIDefaultExecIdTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.it; * "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 + * 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 @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Brian Fox * @author jdcasey */ -public class MavenITmng3401CLIDefaultExecIdTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3401CLIDefaultExecIdTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3401CLIDefaultExecIdTest() - { - super( "[2.2.0,)" ); + public MavenITmng3401CLIDefaultExecIdTest() { + super("[2.2.0,)"); } /** @@ -49,10 +44,8 @@ public class MavenITmng3401CLIDefaultExecIdTest * @throws Exception in case of failure */ @Test - public void testitWithoutPluginManagement() - throws Exception - { - testit( "without-mgmt" ); + public void testitWithoutPluginManagement() throws Exception { + testit("without-mgmt"); } /** @@ -62,35 +55,30 @@ public class MavenITmng3401CLIDefaultExecIdTest * @throws Exception in case of failure */ @Test - public void testitWithPluginManagement() - throws Exception - { - testit( "with-mgmt" ); + public void testitWithPluginManagement() throws Exception { + testit("with-mgmt"); } - private void testit( String project ) - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3401/" + project ); + private void testit(String project) throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3401/" + project); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "org.apache.maven.its.plugins:maven-it-plugin-configuration:2.1-SNAPSHOT:config" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("org.apache.maven.its.plugins:maven-it-plugin-configuration:2.1-SNAPSHOT:config"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/config.properties" ); + Properties props = verifier.loadProperties("target/config.properties"); - assertEquals( "PASSED", props.getProperty( "stringParam" ) ); + assertEquals("PASSED", props.getProperty("stringParam")); - assertEquals( "4", props.getProperty( "stringParams" ) ); - assertEquals( "a", props.getProperty( "stringParams.0" ) ); - assertEquals( "c", props.getProperty( "stringParams.1" ) ); - assertEquals( "b", props.getProperty( "stringParams.2" ) ); - assertEquals( "d", props.getProperty( "stringParams.3" ) ); + assertEquals("4", props.getProperty("stringParams")); + assertEquals("a", props.getProperty("stringParams.0")); + assertEquals("c", props.getProperty("stringParams.1")); + assertEquals("b", props.getProperty("stringParams.2")); + assertEquals("d", props.getProperty("stringParams.3")); - assertEquals( "maven-core-it", props.getProperty( "defaultParam" ) ); + assertEquals("maven-core-it", props.getProperty("defaultParam")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3415JunkRepositoryMetadataTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3415JunkRepositoryMetadataTest.java index e9aadf9b36..432c1e2c24 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3415JunkRepositoryMetadataTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3415JunkRepositoryMetadataTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,9 +16,7 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -32,6 +28,8 @@ import java.util.Map; import java.util.concurrent.ConcurrentLinkedDeque; import org.apache.maven.shared.utils.io.FileUtils; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.eclipse.jetty.server.Handler; import org.eclipse.jetty.server.NetworkConnector; import org.eclipse.jetty.server.Request; @@ -42,17 +40,14 @@ import org.junit.jupiter.api.Test; /** * This is a test set for MNG-3415. */ -public class MavenITmng3415JunkRepositoryMetadataTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3415JunkRepositoryMetadataTest extends AbstractMavenIntegrationTestCase { private static final String RESOURCE_BASE = "/mng-3415"; - public MavenITmng3415JunkRepositoryMetadataTest() - { + public MavenITmng3415JunkRepositoryMetadataTest() { // we're going to control the test execution according to the maven version present within each test method. // all methods should execute as long as we're using maven 2.0.9+, but the specific tests may vary a little // depending on which version we're using above 2.0.8. - super( "(2.0.8,)" ); // only test in 2.0.9+ + super("(2.0.8,)"); // only test in 2.0.9+ } /** @@ -81,51 +76,48 @@ public class MavenITmng3415JunkRepositoryMetadataTest * @throws Exception in case of failure */ @Test - public void testitTransferFailed() - throws Exception - { + public void testitTransferFailed() throws Exception { String methodName = getMethodName(); - File testDir = ResourceExtractor.simpleExtractResources( getClass(), RESOURCE_BASE ); + File testDir = ResourceExtractor.simpleExtractResources(getClass(), RESOURCE_BASE); Verifier verifier; - verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng3415" ); + verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng3415"); - setupDummyDependency( verifier, testDir, true ); + setupDummyDependency(verifier, testDir, true); Map filterProps = verifier.newDefaultFilterMap(); - filterProps.put( "@protocol@", "invalid" ); - filterProps.put( "@port@", "0" ); - File settings = verifier.filterFile( "settings-template.xml", "settings-a.xml", "UTF-8", filterProps ); + filterProps.put("@protocol@", "invalid"); + filterProps.put("@port@", "0"); + File settings = verifier.filterFile("settings-template.xml", "settings-a.xml", "UTF-8", filterProps); - verifier.addCliArgument( "-X" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( settings.getName() ); + verifier.addCliArgument("-X"); + verifier.addCliArgument("-s"); + verifier.addCliArgument(settings.getName()); - verifier.setLogFileName( "log-" + methodName + "-firstBuild.txt" ); - verifier.addCliArgument( "validate" ); + verifier.setLogFileName("log-" + methodName + "-firstBuild.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - assertMetadataMissing( verifier ); + assertMetadataMissing(verifier); - setupDummyDependency( verifier, testDir, true ); + setupDummyDependency(verifier, testDir, true); - verifier.setLogFileName( "log-" + methodName + "-secondBuild.txt" ); - verifier.addCliArgument( "validate" ); + verifier.setLogFileName("log-" + methodName + "-secondBuild.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - assertMetadataMissing( verifier ); + assertMetadataMissing(verifier); } - private String getMethodName() - { + private String getMethodName() { return new Throwable().getStackTrace()[1].getMethodName(); } @@ -155,157 +147,145 @@ public class MavenITmng3415JunkRepositoryMetadataTest * @throws Exception in case of failure */ @Test - public void testShouldNotRepeatedlyUpdateOnResourceNotFoundException() - throws Exception - { + public void testShouldNotRepeatedlyUpdateOnResourceNotFoundException() throws Exception { String methodName = getMethodName(); - File testDir = ResourceExtractor.simpleExtractResources( getClass(), RESOURCE_BASE ); + File testDir = ResourceExtractor.simpleExtractResources(getClass(), RESOURCE_BASE); Verifier verifier; - verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng3415" ); + verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng3415"); final Deque requestUris = new ConcurrentLinkedDeque<>(); - Handler repoHandler = new AbstractHandler() - { + Handler repoHandler = new AbstractHandler() { @Override - public void handle( String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response ) - { - System.out.println( "Handling " + request.getMethod() + " " + request.getRequestURL() ); + public void handle( + String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) { + System.out.println("Handling " + request.getMethod() + " " + request.getRequestURL()); - requestUris.add( request.getRequestURI() ); + requestUris.add(request.getRequestURI()); - response.setStatus( HttpServletResponse.SC_NOT_FOUND ); + response.setStatus(HttpServletResponse.SC_NOT_FOUND); - ( (Request) request ).setHandled( true ); + ((Request) request).setHandled(true); } }; - Server server = new Server( 0 ); - server.setHandler( repoHandler ); + Server server = new Server(0); + server.setHandler(repoHandler); - try - { + try { server.start(); - if ( server.isFailed() ) - { - fail( "Couldn't bind the server socket to a free port!" ); + if (server.isFailed()) { + fail("Couldn't bind the server socket to a free port!"); } - int port = ( (NetworkConnector) server.getConnectors()[0] ).getLocalPort(); - System.out.println( "Bound server socket to the port " + port ); + int port = ((NetworkConnector) server.getConnectors()[0]).getLocalPort(); + System.out.println("Bound server socket to the port " + port); Map filterProps = verifier.newDefaultFilterMap(); - filterProps.put( "@protocol@", "http" ); - filterProps.put( "@port@", Integer.toString( port ) ); - File settings = verifier.filterFile( "settings-template.xml", "settings-b.xml", "UTF-8", filterProps ); + filterProps.put("@protocol@", "http"); + filterProps.put("@port@", Integer.toString(port)); + File settings = verifier.filterFile("settings-template.xml", "settings-b.xml", "UTF-8", filterProps); - verifier.addCliArgument( "-X" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( settings.getName() ); + verifier.addCliArgument("-X"); + verifier.addCliArgument("-s"); + verifier.addCliArgument(settings.getName()); - setupDummyDependency( verifier, testDir, true ); + setupDummyDependency(verifier, testDir, true); - verifier.setLogFileName( "log-" + methodName + "-firstBuild.txt" ); - verifier.addCliArgument( "validate" ); + verifier.setLogFileName("log-" + methodName + "-firstBuild.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - assertTrue( requestUris.toString(), requestUris.contains( - "/org/apache/maven/its/mng3415/missing/1.0-SNAPSHOT/maven-metadata.xml" ) ); + assertTrue( + requestUris.toString(), + requestUris.contains("/org/apache/maven/its/mng3415/missing/1.0-SNAPSHOT/maven-metadata.xml")); requestUris.clear(); - File updateCheckFile = getUpdateCheckFile( verifier ); + File updateCheckFile = getUpdateCheckFile(verifier); long firstLastMod = updateCheckFile.lastModified(); - setupDummyDependency( verifier, testDir, false ); + setupDummyDependency(verifier, testDir, false); - verifier.setLogFileName( "log-" + methodName + "-secondBuild.txt" ); - verifier.addCliArgument( "validate" ); + verifier.setLogFileName("log-" + methodName + "-secondBuild.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - assertFalse( requestUris.toString(), requestUris.contains( - "/org/apache/maven/its/mng3415/missing/1.0-SNAPSHOT/maven-metadata.xml" ) ); + assertFalse( + requestUris.toString(), + requestUris.contains("/org/apache/maven/its/mng3415/missing/1.0-SNAPSHOT/maven-metadata.xml")); assertEquals( - "Last-modified time should be unchanged from first build through second build for the file we use for" - + " updateInterval checks.", - firstLastMod, updateCheckFile.lastModified() ); - } - finally - { + "Last-modified time should be unchanged from first build through second build for the file we use for" + + " updateInterval checks.", + firstLastMod, + updateCheckFile.lastModified()); + } finally { server.stop(); server.join(); } } - private void assertMetadataMissing( Verifier verifier ) - { - File metadata = getMetadataFile( verifier ); + private void assertMetadataMissing(Verifier verifier) { + File metadata = getMetadataFile(verifier); - assertFalse( "Metadata file should NOT be present in local repository: " + metadata.getAbsolutePath(), - metadata.exists() ); + assertFalse( + "Metadata file should NOT be present in local repository: " + metadata.getAbsolutePath(), + metadata.exists()); } - private void setupDummyDependency( Verifier verifier, File testDir, boolean resetUpdateInterval ) - throws IOException - { + private void setupDummyDependency(Verifier verifier, File testDir, boolean resetUpdateInterval) throws IOException { String gid = "org.apache.maven.its.mng3415"; String aid = "missing"; String version = "1.0-SNAPSHOT"; - if ( resetUpdateInterval ) - { - verifier.deleteArtifacts( gid ); + if (resetUpdateInterval) { + verifier.deleteArtifacts(gid); } - File pom = new File( verifier.getArtifactPath( gid, aid, version, "pom" ) ); + File pom = new File(verifier.getArtifactPath(gid, aid, version, "pom")); - File pomSrc = new File( testDir, "dependency-pom.xml" ); + File pomSrc = new File(testDir, "dependency-pom.xml"); - System.out.println( "Copying dependency POM\nfrom: " + pomSrc + "\nto: " + pom ); - FileUtils.copyFile( pomSrc, pom ); + System.out.println("Copying dependency POM\nfrom: " + pomSrc + "\nto: " + pom); + FileUtils.copyFile(pomSrc, pom); } - private File getMetadataFile( Verifier verifier ) - { + private File getMetadataFile(Verifier verifier) { String gid = "org.apache.maven.its.mng3415"; String aid = "missing"; String version = "1.0-SNAPSHOT"; String name = "maven-metadata-testing-repo.xml"; - return new File( verifier.getArtifactMetadataPath( gid, aid, version, name ) ); + return new File(verifier.getArtifactMetadataPath(gid, aid, version, name)); } /** * If the current maven version is < 3.0, we'll use the metadata file itself (old maven-artifact code)... * otherwise, use the new resolver-status.properties file (new artifact code). */ - private File getUpdateCheckFile( Verifier verifier ) - { + private File getUpdateCheckFile(Verifier verifier) { String gid = "org.apache.maven.its.mng3415"; String aid = "missing"; String version = "1.0-SNAPSHOT"; String name; // < 3.0 (including snapshots) - if ( matchesVersionRange( "(2.0.8,3.0-alpha-1)" ) ) - { + if (matchesVersionRange("(2.0.8,3.0-alpha-1)")) { name = "maven-metadata-testing-repo.xml"; - } - else - { + } else { name = "resolver-status.properties"; } - return new File( verifier.getArtifactMetadataPath( gid, aid, version, name ) ); + return new File(verifier.getArtifactMetadataPath(gid, aid, version, name)); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3422ActiveComponentCollectionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3422ActiveComponentCollectionTest.java index 0860668784..062f13d0e0 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3422ActiveComponentCollectionTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3422ActiveComponentCollectionTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3422ActiveComponentCollectionTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3422ActiveComponentCollectionTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3422ActiveComponentCollectionTest() - { - super( "[2.0,)" ); + public MavenITmng3422ActiveComponentCollectionTest() { + super("[2.0,)"); } /** @@ -48,21 +43,18 @@ public class MavenITmng3422ActiveComponentCollectionTest * @throws Exception in case of failure */ @Test - public void testitMNG3422() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3422" ); + public void testitMNG3422() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3422"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/layout.properties" ); - assertNotEquals( "0", props.getProperty( "layouts", "0" ) ); - assertNotEquals( "", props.getProperty( "layouts.default", "" ) ); + Properties props = verifier.loadProperties("target/layout.properties"); + assertNotEquals("0", props.getProperty("layouts", "0")); + assertNotEquals("", props.getProperty("layouts.default", "")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3441MetadataUpdatedFromDeploymentRepositoryTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3441MetadataUpdatedFromDeploymentRepositoryTest.java index 07dfd4f9ee..5a976b97dc 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3441MetadataUpdatedFromDeploymentRepositoryTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3441MetadataUpdatedFromDeploymentRepositoryTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,15 +16,15 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.io.FileReader; import java.io.IOException; import org.apache.maven.shared.utils.io.FileUtils; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.codehaus.plexus.util.xml.Xpp3Dom; import org.codehaus.plexus.util.xml.Xpp3DomBuilder; import org.codehaus.plexus.util.xml.pull.XmlPullParserException; @@ -37,53 +35,48 @@ import org.junit.jupiter.api.Test; * * */ -public class MavenITmng3441MetadataUpdatedFromDeploymentRepositoryTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng3441MetadataUpdatedFromDeploymentRepositoryTest() - { - super( "(2.0.8,)" ); +public class MavenITmng3441MetadataUpdatedFromDeploymentRepositoryTest extends AbstractMavenIntegrationTestCase { + public MavenITmng3441MetadataUpdatedFromDeploymentRepositoryTest() { + super("(2.0.8,)"); } @Test - public void testitMNG3441() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3441" ); + public void testitMNG3441() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3441"); - File targetRepository = new File( testDir, "target-repo" ); - FileUtils.deleteDirectory( targetRepository ); - FileUtils.copyDirectoryStructure( new File( testDir, "deploy-repo" ), targetRepository ); + File targetRepository = new File(testDir, "target-repo"); + FileUtils.deleteDirectory(targetRepository); + FileUtils.copyDirectoryStructure(new File(testDir, "deploy-repo"), targetRepository); Verifier verifier; - verifier = newVerifier( testDir.getAbsolutePath(), "remote" ); + verifier = newVerifier(testDir.getAbsolutePath(), "remote"); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "deploy" ); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("deploy"); verifier.execute(); verifier.verifyErrorFreeLog(); - Xpp3Dom dom = readDom( new File( targetRepository, - "org/apache/maven/its/mng3441/test-artifact/1.0-SNAPSHOT/maven-metadata.xml" - ) ); - assertEquals( "2", dom.getChild( "versioning" ).getChild( "snapshot" ).getChild( "buildNumber" ).getValue() ); - - dom = readDom( new File( targetRepository, "org/apache/maven/its/mng3441/maven-metadata.xml" ) ); - Xpp3Dom[] plugins = dom.getChild( "plugins" ).getChildren(); - assertEquals( "other-plugin", plugins[0].getChild( "prefix" ).getValue() ); - assertEquals( "test-artifact", plugins[1].getChild( "prefix" ).getValue() ); + Xpp3Dom dom = readDom(new File( + targetRepository, "org/apache/maven/its/mng3441/test-artifact/1.0-SNAPSHOT/maven-metadata.xml")); + assertEquals( + "2", + dom.getChild("versioning") + .getChild("snapshot") + .getChild("buildNumber") + .getValue()); + dom = readDom(new File(targetRepository, "org/apache/maven/its/mng3441/maven-metadata.xml")); + Xpp3Dom[] plugins = dom.getChild("plugins").getChildren(); + assertEquals("other-plugin", plugins[0].getChild("prefix").getValue()); + assertEquals("test-artifact", plugins[1].getChild("prefix").getValue()); } - private Xpp3Dom readDom( File file ) - throws XmlPullParserException, IOException - { - try ( FileReader reader = new FileReader( file ) ) - { - return Xpp3DomBuilder.build( reader ); + private Xpp3Dom readDom(File file) throws XmlPullParserException, IOException { + try (FileReader reader = new FileReader(file)) { + return Xpp3DomBuilder.build(reader); } } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3461MirrorMatchingTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3461MirrorMatchingTest.java index 67ad9ee835..90b8ec6a30 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3461MirrorMatchingTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3461MirrorMatchingTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,9 +16,7 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -29,6 +25,8 @@ import java.io.File; import java.io.IOException; import java.util.Map; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.eclipse.jetty.server.Handler; import org.eclipse.jetty.server.NetworkConnector; import org.eclipse.jetty.server.Request; @@ -42,13 +40,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3461MirrorMatchingTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3461MirrorMatchingTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3461MirrorMatchingTest() - { - super( "(2.0.8,)" ); + public MavenITmng3461MirrorMatchingTest() { + super("(2.0.8,)"); } /** @@ -58,22 +53,20 @@ public class MavenITmng3461MirrorMatchingTest * @throws Exception in case of failure */ @Test - public void testitExactMatchDominatesWildcard() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3461/test-1" ); + public void testitExactMatchDominatesWildcard() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3461/test-1"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng3461" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng3461"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng3461", "a", "0.1", "jar" ); + verifier.verifyArtifactPresent("org.apache.maven.its.mng3461", "a", "0.1", "jar"); } /** @@ -83,80 +76,67 @@ public class MavenITmng3461MirrorMatchingTest * @throws Exception in case of failure */ @Test - public void testitExternalWildcard() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3461/test-2" ); + public void testitExternalWildcard() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3461/test-2"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); - Handler repoHandler = new AbstractHandler() - { + Handler repoHandler = new AbstractHandler() { @Override - public void handle( String target, Request baseRequest, HttpServletRequest request, - HttpServletResponse response ) - throws IOException - { - System.out.println( "Handling " + request.getMethod() + " " + request.getRequestURL() ); + public void handle( + String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) + throws IOException { + System.out.println("Handling " + request.getMethod() + " " + request.getRequestURL()); - if ( request.getRequestURI().endsWith( "/b-0.1.jar" ) ) - { - response.setStatus( HttpServletResponse.SC_OK ); - response.getWriter().println( request.getRequestURI() ); - } - else if ( request.getRequestURI().endsWith( "/b-0.1.pom" ) ) - { - response.setStatus( HttpServletResponse.SC_OK ); - response.getWriter().println( "" ); - response.getWriter().println( " 4.0.0" ); - response.getWriter().println( " org.apache.maven.its.mng3461" ); - response.getWriter().println( " b" ); - response.getWriter().println( " 0.1" ); - response.getWriter().println( "" ); - } - else - { - response.setStatus( HttpServletResponse.SC_NOT_FOUND ); + if (request.getRequestURI().endsWith("/b-0.1.jar")) { + response.setStatus(HttpServletResponse.SC_OK); + response.getWriter().println(request.getRequestURI()); + } else if (request.getRequestURI().endsWith("/b-0.1.pom")) { + response.setStatus(HttpServletResponse.SC_OK); + response.getWriter().println(""); + response.getWriter().println(" 4.0.0"); + response.getWriter().println(" org.apache.maven.its.mng3461"); + response.getWriter().println(" b"); + response.getWriter().println(" 0.1"); + response.getWriter().println(""); + } else { + response.setStatus(HttpServletResponse.SC_NOT_FOUND); } - ( (Request) request ).setHandled( true ); + ((Request) request).setHandled(true); } }; - Server server = new Server( 0 ); - server.setHandler( repoHandler ); + Server server = new Server(0); + server.setHandler(repoHandler); - try - { + try { server.start(); - if ( server.isFailed() ) - { - fail( "Couldn't bind the server socket to a free port!" ); + if (server.isFailed()) { + fail("Couldn't bind the server socket to a free port!"); } - int port = ( (NetworkConnector) server.getConnectors()[0] ).getLocalPort(); - System.out.println( "Bound server socket to the port " + port ); + int port = ((NetworkConnector) server.getConnectors()[0]).getLocalPort(); + System.out.println("Bound server socket to the port " + port); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng3461" ); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng3461"); Map filterProps = verifier.newDefaultFilterMap(); - filterProps.put( "@test.port@", Integer.toString( port ) ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + filterProps.put("@test.port@", Integer.toString(port)); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8", filterProps); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - } - finally - { + } finally { server.stop(); server.join(); } - verifier.verifyArtifactPresent( "org.apache.maven.its.mng3461", "a", "0.1", "jar" ); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng3461", "b", "0.1", "jar" ); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng3461", "c", "0.1", "jar" ); + verifier.verifyArtifactPresent("org.apache.maven.its.mng3461", "a", "0.1", "jar"); + verifier.verifyArtifactPresent("org.apache.maven.its.mng3461", "b", "0.1", "jar"); + verifier.verifyArtifactPresent("org.apache.maven.its.mng3461", "c", "0.1", "jar"); } /** @@ -166,21 +146,19 @@ public class MavenITmng3461MirrorMatchingTest * @throws Exception in case of failure */ @Test - public void testitNonGreedyWildcard() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3461/test-3" ); + public void testitNonGreedyWildcard() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3461/test-3"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng3461" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng3461"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng3461", "a", "0.1", "jar" ); + verifier.verifyArtifactPresent("org.apache.maven.its.mng3461", "a", "0.1", "jar"); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3470StrictChecksumVerificationOfDependencyPomTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3470StrictChecksumVerificationOfDependencyPomTest.java index b8a88384b0..6d0c8e75d1 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3470StrictChecksumVerificationOfDependencyPomTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3470StrictChecksumVerificationOfDependencyPomTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng3470StrictChecksumVerificationOfDependencyPomTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3470StrictChecksumVerificationOfDependencyPomTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3470StrictChecksumVerificationOfDependencyPomTest() - { - super( "[2.0.3,2.0.4],[3.0-beta-1,)" ); + public MavenITmng3470StrictChecksumVerificationOfDependencyPomTest() { + super("[2.0.3,2.0.4],[3.0-beta-1,)"); } /** @@ -47,44 +42,35 @@ public class MavenITmng3470StrictChecksumVerificationOfDependencyPomTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3470" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3470"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng3470" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - try - { - verifier.setLogFileName( "log-1.txt" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng3470"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + try { + verifier.setLogFileName("log-1.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - fail( "Build did not fail despite broken checksum of dependency POM." ); - } - catch ( VerificationException e ) - { + fail("Build did not fail despite broken checksum of dependency POM."); + } catch (VerificationException e) { // expected } // NOTE: This second try is to make sure the state caching in the local repo properly replays the error - try - { - verifier.setLogFileName( "log-2.txt" ); - verifier.addCliArgument( "validate" ); + try { + verifier.setLogFileName("log-2.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - fail( "Build did not fail despite broken checksum of dependency POM." ); - } - catch ( VerificationException e ) - { + fail("Build did not fail despite broken checksum of dependency POM."); + } catch (VerificationException e) { // expected } } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3475BaseAlignedDirTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3475BaseAlignedDirTest.java index d163af67c7..d74e7c6ad8 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3475BaseAlignedDirTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3475BaseAlignedDirTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.io.IOException; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -35,13 +33,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3475BaseAlignedDirTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3475BaseAlignedDirTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3475BaseAlignedDirTest() - { - super( "(2.0.1,2.0.3),(2.0.3,)"); + public MavenITmng3475BaseAlignedDirTest() { + super("(2.0.1,2.0.3),(2.0.3,)"); } /** @@ -50,49 +45,43 @@ public class MavenITmng3475BaseAlignedDirTest * @throws Exception in case of failure */ @Test - public void testitMNG3475() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3475" ); + public void testitMNG3475() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3475"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties configProps = verifier.loadProperties( "target/config.properties" ); + Properties configProps = verifier.loadProperties("target/config.properties"); - assertPathEquals( testDir, "target", configProps.getProperty( "mapParam.buildDirectory" ) ); + assertPathEquals(testDir, "target", configProps.getProperty("mapParam.buildDirectory")); - assertPathEquals( testDir, "target/classes", configProps.getProperty( "mapParam.buildOutputDirectory" ) ); + assertPathEquals(testDir, "target/classes", configProps.getProperty("mapParam.buildOutputDirectory")); - assertPathEquals( testDir, "target/test-classes", configProps.getProperty( "mapParam.buildTestOutputDirectory" ) ); + assertPathEquals(testDir, "target/test-classes", configProps.getProperty("mapParam.buildTestOutputDirectory")); - assertPathEquals( testDir, "src/main/java", configProps.getProperty( "mapParam.buildSourceDirectory" ) ); + assertPathEquals(testDir, "src/main/java", configProps.getProperty("mapParam.buildSourceDirectory")); - assertPathEquals( testDir, "src/test/java", configProps.getProperty( "mapParam.buildTestSourceDirectory" ) ); + assertPathEquals(testDir, "src/test/java", configProps.getProperty("mapParam.buildTestSourceDirectory")); - if ( matchesVersionRange( "[2.1.0-M1,)" ) ) - { - assertPathEquals( testDir, "target/site", configProps.getProperty( "mapParam.reportingOutputDirectory" ) ); + if (matchesVersionRange("[2.1.0-M1,)")) { + assertPathEquals(testDir, "target/site", configProps.getProperty("mapParam.reportingOutputDirectory")); } // show that using relative paths is aligned for File configuration properties regardless - assertPathEquals( testDir, "target/site", configProps.getProperty( "fileParam" ) ); + assertPathEquals(testDir, "target/site", configProps.getProperty("fileParam")); /* * NOTE: The script source directory is deliberately excluded from the checks due to MNG-3741. */ } - private void assertPathEquals( File basedir, String expected, String actual ) - throws IOException - { - File actualFile = new File( actual ); - assertTrue( "path not absolute: " + actualFile, actualFile.isAbsolute() ); - assertCanonicalFileEquals( new File( basedir, expected ), actualFile ); + private void assertPathEquals(File basedir, String expected, String actual) throws IOException { + File actualFile = new File(actual); + assertTrue("path not absolute: " + actualFile, actualFile.isAbsolute()); + assertCanonicalFileEquals(new File(basedir, expected), actualFile); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3477DependencyResolutionErrorMessageTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3477DependencyResolutionErrorMessageTest.java index 67b4649655..015bb71e89 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3477DependencyResolutionErrorMessageTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3477DependencyResolutionErrorMessageTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,26 +16,23 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** * This is a test set for MNG-3477. */ -public class MavenITmng3477DependencyResolutionErrorMessageTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3477DependencyResolutionErrorMessageTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3477DependencyResolutionErrorMessageTest() - { - super( "[2.1.0,3.0-alpha-1),[3.0-beta-1,)" ); + public MavenITmng3477DependencyResolutionErrorMessageTest() { + super("[2.1.0,3.0-alpha-1),[3.0-beta-1,)"); } /** @@ -46,36 +41,28 @@ public class MavenITmng3477DependencyResolutionErrorMessageTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3477" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3477"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng3477" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - try - { - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng3477"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + try { + verifier.addCliArgument("validate"); verifier.execute(); - fail( "Build should have failed to resolve dependency" ); - } - catch ( VerificationException e ) - { + fail("Build should have failed to resolve dependency"); + } catch (VerificationException e) { boolean foundCause = false; - List lines = verifier.loadLines( verifier.getLogFileName(), "UTF-8" ); - for ( String line : lines ) - { - if ( line.matches( ".*org.apache.maven.its.mng3477:dep:jar:1.0.*Connection.*refused.*" ) ) - { + List lines = verifier.loadLines(verifier.getLogFileName(), "UTF-8"); + for (String line : lines) { + if (line.matches(".*org.apache.maven.its.mng3477:dep:jar:1.0.*Connection.*refused.*")) { foundCause = true; break; } } - assertTrue( "Transfer error cause was not found", foundCause ); + assertTrue("Transfer error cause was not found", foundCause); } } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3482DependencyPomInterpolationTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3482DependencyPomInterpolationTest.java index 0dc0996ce6..1cd06f2a25 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3482DependencyPomInterpolationTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3482DependencyPomInterpolationTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,34 +31,28 @@ import org.junit.jupiter.api.Test; * @author Brian Fox * @author jdcasey */ -public class MavenITmng3482DependencyPomInterpolationTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3482DependencyPomInterpolationTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3482DependencyPomInterpolationTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng3482DependencyPomInterpolationTest() { + super(ALL_MAVEN_VERSIONS); } @Test - public void testitMNG3482() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3482" ); + public void testitMNG3482() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3482"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng3482" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng3482"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List classpath = verifier.loadLines( "target/classpath.txt", "UTF-8" ); - assertTrue( classpath.toString(), classpath.contains( "dep2-1.jar" ) ); + List classpath = verifier.loadLines("target/classpath.txt", "UTF-8"); + assertTrue(classpath.toString(), classpath.contains("dep2-1.jar")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3485OverrideWagonExtensionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3485OverrideWagonExtensionTest.java index 379431115c..ec9873a8ed 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3485OverrideWagonExtensionTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3485OverrideWagonExtensionTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,29 +29,23 @@ import org.junit.jupiter.api.Test; * * */ -public class MavenITmng3485OverrideWagonExtensionTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng3485OverrideWagonExtensionTest() - { - super( "(2.0.8,3.0-alpha-1),[3.0-alpha-7,)" ); +public class MavenITmng3485OverrideWagonExtensionTest extends AbstractMavenIntegrationTestCase { + public MavenITmng3485OverrideWagonExtensionTest() { + super("(2.0.8,3.0-alpha-1),[3.0-alpha-7,)"); } @Test - public void testitMNG3485 () - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3485" ); + public void testitMNG3485() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3485"); Verifier verifier; - verifier = newVerifier( testDir.getAbsolutePath(), "remote" ); + verifier = newVerifier(testDir.getAbsolutePath(), "remote"); - verifier.addCliArgument( "deploy" ); + verifier.addCliArgument("deploy"); verifier.execute(); - verifier.verifyFilePresent( "target/wagon.properties" ); + verifier.verifyFilePresent("target/wagon.properties"); verifier.verifyErrorFreeLog(); - } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3498ForkToOtherMojoTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3498ForkToOtherMojoTest.java index 4bab0833fd..a2013af9d3 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3498ForkToOtherMojoTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3498ForkToOtherMojoTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -35,36 +33,31 @@ import org.junit.jupiter.api.Test; * @author jdcasey * */ -public class MavenITmng3498ForkToOtherMojoTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng3498ForkToOtherMojoTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenITmng3498ForkToOtherMojoTest extends AbstractMavenIntegrationTestCase { + public MavenITmng3498ForkToOtherMojoTest() { + super(ALL_MAVEN_VERSIONS); } @Test - public void testitMNG3498 () - throws Exception - { + public void testitMNG3498() throws Exception { // The testdir is computed from the location of this // file. - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3498" ); + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3498"); - File pluginDir = new File( testDir, "maven-mng3498-plugin" ); - File projectDir = new File( testDir, "mng-3498-project" ); + File pluginDir = new File(testDir, "maven-mng3498-plugin"); + File projectDir = new File(testDir, "mng-3498-project"); - Verifier verifier = newVerifier( pluginDir.getAbsolutePath(), "remote" ); - verifier.deleteArtifact( "org.apache.maven.its.mng3498", "mavenit-mng3498-plugin", "1", "pom" ); + Verifier verifier = newVerifier(pluginDir.getAbsolutePath(), "remote"); + verifier.deleteArtifact("org.apache.maven.its.mng3498", "mavenit-mng3498-plugin", "1", "pom"); - verifier.addCliArgument( "install" ); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier = newVerifier( projectDir.getAbsolutePath() ); + verifier = newVerifier(projectDir.getAbsolutePath()); - verifier.addCliArgument( "validate" ); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3503Xpp3ShadingTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3503Xpp3ShadingTest.java index 8bea1e1fb3..62f4ac0a98 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3503Xpp3ShadingTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3503Xpp3ShadingTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import org.apache.maven.shared.utils.io.FileUtils; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,48 +30,37 @@ import org.junit.jupiter.api.Test; * a plugin using plexus-utils-1.1 does not cause linkage errors. The second test verifies that a plugin with a * different implementation of the shaded classes is used instead. */ -public class MavenITmng3503Xpp3ShadingTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng3503Xpp3ShadingTest() - { - super( "(2.0.9,2.1.0-M1),(2.1.0-M1,)" ); // only test in 2.0.10+, and not in 2.1.0-M1 +public class MavenITmng3503Xpp3ShadingTest extends AbstractMavenIntegrationTestCase { + public MavenITmng3503Xpp3ShadingTest() { + super("(2.0.9,2.1.0-M1),(2.1.0-M1,)"); // only test in 2.0.10+, and not in 2.1.0-M1 } @Test - public void testitMNG3503NoLinkageErrors() - throws Exception - { - File dir = - ResourceExtractor.simpleExtractResources( getClass(), "/mng-3503/mng-3503-xpp3Shading-pu11" ); + public void testitMNG3503NoLinkageErrors() throws Exception { + File dir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3503/mng-3503-xpp3Shading-pu11"); Verifier verifier; - verifier = newVerifier( dir.getAbsolutePath() ); + verifier = newVerifier(dir.getAbsolutePath()); - verifier.addCliArgument( "validate" ); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - - assertEquals( "", FileUtils.fileRead( new File( dir, "target/serialized.xml" ), "UTF-8" ) ); + assertEquals("", FileUtils.fileRead(new File(dir, "target/serialized.xml"), "UTF-8")); } @Test - public void testitMNG3503Xpp3Shading() - throws Exception - { - File dir = - ResourceExtractor.simpleExtractResources( getClass(), "/mng-3503/mng-3503-xpp3Shading-pu-new" ); - Verifier verifier = newVerifier( dir.getAbsolutePath() ); + public void testitMNG3503Xpp3Shading() throws Exception { + File dir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3503/mng-3503-xpp3Shading-pu-new"); + Verifier verifier = newVerifier(dir.getAbsolutePath()); - verifier.addCliArgument( "validate" ); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - - assertEquals( "root", FileUtils.fileRead( new File( dir, "target/serialized.xml" ), "UTF-8" ) ); + assertEquals("root", FileUtils.fileRead(new File(dir, "target/serialized.xml"), "UTF-8")); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3506ArtifactHandlersFromPluginsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3506ArtifactHandlersFromPluginsTest.java index 280fe93f20..ada97222ae 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3506ArtifactHandlersFromPluginsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3506ArtifactHandlersFromPluginsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; import java.io.IOException; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -34,9 +32,7 @@ import org.junit.jupiter.api.Test; * @author John Casey * */ -public class MavenITmng3506ArtifactHandlersFromPluginsTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3506ArtifactHandlersFromPluginsTest extends AbstractMavenIntegrationTestCase { private static final String GID = "org.apache.maven.its.mng3506"; private static final String AID = "mng-3506"; @@ -45,57 +41,56 @@ public class MavenITmng3506ArtifactHandlersFromPluginsTest private static final String BAD_TYPE1 = "coreit-1"; private static final String BAD_TYPE2 = "coreit-2"; - public MavenITmng3506ArtifactHandlersFromPluginsTest() - { - super( "(2.2.0,)" ); + public MavenITmng3506ArtifactHandlersFromPluginsTest() { + super("(2.2.0,)"); } @Test - public void testProjectPackagingUsage() - throws IOException, VerificationException - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/" + AID ); + public void testProjectPackagingUsage() throws IOException, VerificationException { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/" + AID); - Verifier verifier = newVerifier( testDir.getAbsolutePath(), "remote" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath(), "remote"); - verifier.deleteArtifacts( GID ); + verifier.deleteArtifacts(GID); - verifier.addCliArgument( "install" ); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); - // Now, if everything worked, we have .pom and a .jar in the local repo for each child, and a pom for the parent. - // IF IT DIDN'T, we have a .pom and a .coreit-1 for child 1 AND/OR .pom and .coreit-2 for child 2 in the local repo... + // Now, if everything worked, we have .pom and a .jar in the local repo for each child, and a pom for the + // parent. + // IF IT DIDN'T, we have a .pom and a .coreit-1 for child 1 AND/OR .pom and .coreit-2 for child 2 in the local + // repo... // Parent POM - String path = verifier.getArtifactPath( GID, AID, VERSION, "pom" ); - assertTrue( path + " should have been installed.", new File( path ).exists() ); + String path = verifier.getArtifactPath(GID, AID, VERSION, "pom"); + assertTrue(path + " should have been installed.", new File(path).exists()); // Child 1 - path = verifier.getArtifactPath( GID, AID + ".1", VERSION, TYPE ); - assertTrue( path + " should have been installed.", new File( path ).exists() ); + path = verifier.getArtifactPath(GID, AID + ".1", VERSION, TYPE); + assertTrue(path + " should have been installed.", new File(path).exists()); - path = verifier.getArtifactPath( GID, AID + ".1", VERSION, "pom" ); - assertTrue( path + " should have been installed.", new File( path ).exists() ); + path = verifier.getArtifactPath(GID, AID + ".1", VERSION, "pom"); + assertTrue(path + " should have been installed.", new File(path).exists()); - path = verifier.getArtifactPath( GID, AID + ".1", VERSION, BAD_TYPE1 ); - assertFalse( path + " should NOT have been installed.", new File( path ).exists() ); + path = verifier.getArtifactPath(GID, AID + ".1", VERSION, BAD_TYPE1); + assertFalse(path + " should NOT have been installed.", new File(path).exists()); - path = verifier.getArtifactPath( GID, AID + ".1", VERSION, BAD_TYPE2 ); - assertFalse( path + " should _NEVER_ be installed!!!", new File( path ).exists() ); + path = verifier.getArtifactPath(GID, AID + ".1", VERSION, BAD_TYPE2); + assertFalse(path + " should _NEVER_ be installed!!!", new File(path).exists()); // Child 2 - path = verifier.getArtifactPath( GID, AID + ".2", VERSION, TYPE ); - assertTrue( path + " should have been installed.", new File( path ).exists() ); + path = verifier.getArtifactPath(GID, AID + ".2", VERSION, TYPE); + assertTrue(path + " should have been installed.", new File(path).exists()); - path = verifier.getArtifactPath( GID, AID + ".2", VERSION, "pom" ); - assertTrue( path + " should have been installed.", new File( path ).exists() ); + path = verifier.getArtifactPath(GID, AID + ".2", VERSION, "pom"); + assertTrue(path + " should have been installed.", new File(path).exists()); - path = verifier.getArtifactPath( GID, AID + ".2", VERSION, BAD_TYPE1 ); - assertFalse( path + " should _NEVER_ be installed!!!", new File( path ).exists() ); + path = verifier.getArtifactPath(GID, AID + ".2", VERSION, BAD_TYPE1); + assertFalse(path + " should _NEVER_ be installed!!!", new File(path).exists()); - path = verifier.getArtifactPath( GID, AID + ".2", VERSION, BAD_TYPE2 ); - assertFalse( path + " should NOT have been installed.", new File( path ).exists() ); + path = verifier.getArtifactPath(GID, AID + ".2", VERSION, BAD_TYPE2); + assertFalse(path + " should NOT have been installed.", new File(path).exists()); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3529QuotedCliArgTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3529QuotedCliArgTest.java index c58406707c..18be2b43cc 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3529QuotedCliArgTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3529QuotedCliArgTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng3529QuotedCliArgTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3529QuotedCliArgTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3529QuotedCliArgTest() - { - super( "[3.0-beta-1,)" ); + public MavenITmng3529QuotedCliArgTest() { + super("[3.0-beta-1,)"); } /** @@ -47,22 +42,19 @@ public class MavenITmng3529QuotedCliArgTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3529" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3529"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setForkJvm( true ); // NOTE: We want to go through the launcher script - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "-Dtest.a= " ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setForkJvm(true); // NOTE: We want to go through the launcher script + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("-Dtest.a= "); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/pom.properties" ); - assertEquals( "- -", props.getProperty( "project.properties.propA" ) ); + Properties props = verifier.loadProperties("target/pom.properties"); + assertEquals("- -", props.getProperty("project.properties.propA")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3535SelfReferentialPropertiesTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3535SelfReferentialPropertiesTest.java index 6608523ffb..c9109879d2 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3535SelfReferentialPropertiesTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3535SelfReferentialPropertiesTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,56 +29,44 @@ import org.junit.jupiter.api.Test; * * */ -public class MavenITmng3535SelfReferentialPropertiesTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3535SelfReferentialPropertiesTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3535SelfReferentialPropertiesTest() - { - super( "[2.1.0-M1,3.0-alpha-1),[3.0-alpha-3,)" ); + public MavenITmng3535SelfReferentialPropertiesTest() { + super("[2.1.0-M1,3.0-alpha-1),[3.0-alpha-3,)"); } @Test - public void testitMNG3535_ShouldSucceed() - throws Exception - { - File testDir = - ResourceExtractor.simpleExtractResources( getClass(), "/mng-3535/success" ); + public void testitMNG3535_ShouldSucceed() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3535/success"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); - verifier.addCliArgument( "-X" ); + verifier.addCliArgument("-X"); - verifier.setAutoclean( false ); - verifier.addCliArgument( "verify" ); + verifier.setAutoclean(false); + verifier.addCliArgument("verify"); verifier.execute(); verifier.verifyErrorFreeLog(); } @Test - public void testitMNG3535_ShouldFail() - throws Exception - { - File testDir = - ResourceExtractor.simpleExtractResources( getClass(), "/mng-3535/failure" ); + public void testitMNG3535_ShouldFail() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3535/failure"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); - verifier.addCliArgument( "-X" ); + verifier.addCliArgument("-X"); - verifier.setAutoclean( false ); + verifier.setAutoclean(false); - try - { - verifier.addCliArgument( "verify" ); + try { + verifier.addCliArgument("verify"); verifier.execute(); verifier.verifyErrorFreeLog(); - fail( "There is a self-referential property in this build; it should fail." ); - } - catch ( Exception e ) - { + fail("There is a self-referential property in this build; it should fail."); + } catch (Exception e) { // should fail this verification, because there truly is a self-referential property. } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3536AppendedAbsolutePathsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3536AppendedAbsolutePathsTest.java index 2d24299a41..ea2807b6c2 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3536AppendedAbsolutePathsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3536AppendedAbsolutePathsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,33 +29,27 @@ import org.junit.jupiter.api.Test; * * */ -public class MavenITmng3536AppendedAbsolutePathsTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3536AppendedAbsolutePathsTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3536AppendedAbsolutePathsTest() - { - super( "[2.1.0-M1,)"); // 2.1.0+ only + public MavenITmng3536AppendedAbsolutePathsTest() { + super("[2.1.0-M1,)"); // 2.1.0+ only } @Test - public void testitMNG3536() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), - "/mng-3536" ); - File pluginDir = new File( testDir, "plugin" ); - Verifier verifier = newVerifier( pluginDir.getAbsolutePath(), "remote" ); + public void testitMNG3536() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3536"); + File pluginDir = new File(testDir, "plugin"); + Verifier verifier = newVerifier(pluginDir.getAbsolutePath(), "remote"); - verifier.addCliArgument( "install" ); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); - File projectDir = new File( testDir, "project" ); - verifier = newVerifier( projectDir.getAbsolutePath() ); + File projectDir = new File(testDir, "project"); + verifier = newVerifier(projectDir.getAbsolutePath()); - verifier.addCliArgument( "verify" ); + verifier.addCliArgument("verify"); verifier.execute(); verifier.verifyErrorFreeLog(); } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3545ProfileDeactivationTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3545ProfileDeactivationTest.java index 0bbc2e9845..bd5d7bfee1 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3545ProfileDeactivationTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3545ProfileDeactivationTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * it tests activation and deactivation of profiles. * */ -public class MavenITmng3545ProfileDeactivationTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3545ProfileDeactivationTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3545ProfileDeactivationTest() - { - super( "(2.0.9,)" ); + public MavenITmng3545ProfileDeactivationTest() { + super("(2.0.9,)"); } /** @@ -46,26 +41,24 @@ public class MavenITmng3545ProfileDeactivationTest * @throws Exception in case of failure */ @Test - public void testBasicBuildWithDefaultProfiles() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3545" ); + public void testBasicBuildWithDefaultProfiles() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3545"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.setLogFileName( "log1.txt" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.setLogFileName("log1.txt"); - verifier.addCliArgument( "validate" ); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); // profile 1 and 2 are active by default - verifier.verifyFilePresent( "target/profile1/touch.txt" ); - verifier.verifyFilePresent( "target/profile2/touch.txt" ); - verifier.verifyFileNotPresent( "target/profile3/touch.txt" ); - verifier.verifyFileNotPresent( "target/profile4/touch.txt" ); - verifier.verifyFileNotPresent( "target/profile5/touch.txt" ); + verifier.verifyFilePresent("target/profile1/touch.txt"); + verifier.verifyFilePresent("target/profile2/touch.txt"); + verifier.verifyFileNotPresent("target/profile3/touch.txt"); + verifier.verifyFileNotPresent("target/profile4/touch.txt"); + verifier.verifyFileNotPresent("target/profile5/touch.txt"); } /** @@ -74,51 +67,47 @@ public class MavenITmng3545ProfileDeactivationTest * @throws Exception in case of failure */ @Test - public void testDeactivateDefaultProfilesHyphen() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3545" ); + public void testDeactivateDefaultProfilesHyphen() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3545"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.setLogFileName( "log2.txt" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.setLogFileName("log2.txt"); // Deactivate active by default profiles - verifier.addCliArgument( "-P-profile1" ); - verifier.addCliArgument( "-P" ); - verifier.addCliArgument( "-profile2" ); + verifier.addCliArgument("-P-profile1"); + verifier.addCliArgument("-P"); + verifier.addCliArgument("-profile2"); - verifier.addCliArgument( "validate" ); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFileNotPresent( "target/profile1/touch.txt" ); - verifier.verifyFileNotPresent( "target/profile2/touch.txt" ); + verifier.verifyFileNotPresent("target/profile1/touch.txt"); + verifier.verifyFileNotPresent("target/profile2/touch.txt"); } @Test - public void testDeactivateDefaultProfilesExclamation() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3545" ); + public void testDeactivateDefaultProfilesExclamation() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3545"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.setLogFileName( "log3.txt" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.setLogFileName("log3.txt"); // Deactivate active by default profiles - verifier.addCliArgument( "-P!profile1" ); - verifier.addCliArgument( "-P" ); - verifier.addCliArgument( "!profile2" ); + verifier.addCliArgument("-P!profile1"); + verifier.addCliArgument("-P"); + verifier.addCliArgument("!profile2"); - verifier.addCliArgument( "validate" ); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFileNotPresent( "target/profile1/touch.txt" ); - verifier.verifyFileNotPresent( "target/profile2/touch.txt" ); + verifier.verifyFileNotPresent("target/profile1/touch.txt"); + verifier.verifyFileNotPresent("target/profile2/touch.txt"); } /** @@ -128,29 +117,27 @@ public class MavenITmng3545ProfileDeactivationTest * @throws Exception in case of failure */ @Test - public void testDeactivateActivatedByProp() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3545" ); + public void testDeactivateActivatedByProp() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3545"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.setLogFileName( "log4.txt" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.setLogFileName("log4.txt"); // Activate with a prop, then deactivate - verifier.addCliArgument( "-Dprofile3-active-by-property=true" ); - verifier.addCliArgument( "-P-profile3" ); + verifier.addCliArgument("-Dprofile3-active-by-property=true"); + verifier.addCliArgument("-P-profile3"); - verifier.addCliArgument( "validate" ); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/profile1/touch.txt" ); - verifier.verifyFilePresent( "target/profile2/touch.txt" ); - verifier.verifyFileNotPresent( "target/profile3/touch.txt" ); - verifier.verifyFileNotPresent( "target/profile4/touch.txt" ); - verifier.verifyFileNotPresent( "target/profile5/touch.txt" ); + verifier.verifyFilePresent("target/profile1/touch.txt"); + verifier.verifyFilePresent("target/profile2/touch.txt"); + verifier.verifyFileNotPresent("target/profile3/touch.txt"); + verifier.verifyFileNotPresent("target/profile4/touch.txt"); + verifier.verifyFileNotPresent("target/profile5/touch.txt"); } /** @@ -160,29 +147,27 @@ public class MavenITmng3545ProfileDeactivationTest * @throws Exception in case of failure */ @Test - public void testActivateThenDeactivate() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3545" ); + public void testActivateThenDeactivate() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3545"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.setLogFileName( "log5.txt" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.setLogFileName("log5.txt"); // Activate then deactivate - verifier.addCliArgument( "-Pprofile4" ); - verifier.addCliArgument( "-P-profile4" ); + verifier.addCliArgument("-Pprofile4"); + verifier.addCliArgument("-P-profile4"); - verifier.addCliArgument( "validate" ); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/profile1/touch.txt" ); - verifier.verifyFilePresent( "target/profile2/touch.txt" ); - verifier.verifyFileNotPresent( "target/profile3/touch.txt" ); - verifier.verifyFileNotPresent( "target/profile4/touch.txt" ); - verifier.verifyFileNotPresent( "target/profile5/touch.txt" ); + verifier.verifyFilePresent("target/profile1/touch.txt"); + verifier.verifyFilePresent("target/profile2/touch.txt"); + verifier.verifyFileNotPresent("target/profile3/touch.txt"); + verifier.verifyFileNotPresent("target/profile4/touch.txt"); + verifier.verifyFileNotPresent("target/profile5/touch.txt"); } /** @@ -192,28 +177,25 @@ public class MavenITmng3545ProfileDeactivationTest * @throws Exception in case of failure */ @Test - public void testDefaultProfileAutoDeactivation() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3545" ); + public void testDefaultProfileAutoDeactivation() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3545"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.setLogFileName( "log6.txt" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.setLogFileName("log6.txt"); // Activate - verifier.addCliArgument( "-Pprofile4" ); + verifier.addCliArgument("-Pprofile4"); - verifier.addCliArgument( "validate" ); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFileNotPresent( "target/profile1/touch.txt" ); - verifier.verifyFileNotPresent( "target/profile2/touch.txt" ); - verifier.verifyFileNotPresent( "target/profile3/touch.txt" ); - verifier.verifyFilePresent( "target/profile4/touch.txt" ); - verifier.verifyFileNotPresent( "target/profile5/touch.txt" ); + verifier.verifyFileNotPresent("target/profile1/touch.txt"); + verifier.verifyFileNotPresent("target/profile2/touch.txt"); + verifier.verifyFileNotPresent("target/profile3/touch.txt"); + verifier.verifyFilePresent("target/profile4/touch.txt"); + verifier.verifyFileNotPresent("target/profile5/touch.txt"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3575HexadecimalOctalPluginParameterConfigTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3575HexadecimalOctalPluginParameterConfigTest.java index a483052988..d385946bf8 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3575HexadecimalOctalPluginParameterConfigTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3575HexadecimalOctalPluginParameterConfigTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,25 +16,22 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** * This is a test set for MNG-3575. */ -public class MavenITmng3575HexadecimalOctalPluginParameterConfigTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3575HexadecimalOctalPluginParameterConfigTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3575HexadecimalOctalPluginParameterConfigTest() - { - super( "[3.0.3,)" ); + public MavenITmng3575HexadecimalOctalPluginParameterConfigTest() { + super("[3.0.3,)"); } /** @@ -45,23 +40,20 @@ public class MavenITmng3575HexadecimalOctalPluginParameterConfigTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3575" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3575"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/config.properties" ); - assertEquals( "64", props.getProperty( "byteParam" ) ); - assertEquals( "1024", props.getProperty( "shortParam" ) ); - assertEquals( "65536", props.getProperty( "integerParam" ) ); - assertEquals( "68719476735", props.getProperty( "longParam" ) ); + Properties props = verifier.loadProperties("target/config.properties"); + assertEquals("64", props.getProperty("byteParam")); + assertEquals("1024", props.getProperty("shortParam")); + assertEquals("65536", props.getProperty("integerParam")); + assertEquals("68719476735", props.getProperty("longParam")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3581PluginUsesWagonDependencyTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3581PluginUsesWagonDependencyTest.java index 3e90eed515..7ff9047b37 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3581PluginUsesWagonDependencyTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3581PluginUsesWagonDependencyTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,14 +29,11 @@ import org.junit.jupiter.api.Test; * * */ -public class MavenITmng3581PluginUsesWagonDependencyTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3581PluginUsesWagonDependencyTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3581PluginUsesWagonDependencyTest() - { + public MavenITmng3581PluginUsesWagonDependencyTest() { // Not 2.0.9 - super( "(2.0.4,2.0.9),(2.0.9,)" ); + super("(2.0.4,2.0.9),(2.0.9,)"); } /** @@ -47,17 +42,14 @@ public class MavenITmng3581PluginUsesWagonDependencyTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3581" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3581"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.addCliArgument( "initialize" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.addCliArgument("initialize"); verifier.execute(); - verifier.addCliArgument( "-B" ); + verifier.addCliArgument("-B"); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3586SystemScopePluginDependencyTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3586SystemScopePluginDependencyTest.java index 0b87ca2c7c..f20a99c0b2 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3586SystemScopePluginDependencyTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3586SystemScopePluginDependencyTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3586SystemScopePluginDependencyTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3586SystemScopePluginDependencyTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3586SystemScopePluginDependencyTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng3586SystemScopePluginDependencyTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -49,25 +44,23 @@ public class MavenITmng3586SystemScopePluginDependencyTest * @throws Exception in case of failure */ @Test - public void testitFromPlugin() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3586/test-1" ); + public void testitFromPlugin() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3586/test-1"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng3586" ); - verifier.getSystemProperties().setProperty( "test.home", testDir.getAbsolutePath() ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng3586"); + verifier.getSystemProperties().setProperty("test.home", testDir.getAbsolutePath()); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/it.properties" ); - assertEquals( "PASSED", props.getProperty( "test" ) ); + Properties props = verifier.loadProperties("target/it.properties"); + assertEquals("PASSED", props.getProperty("test")); } /** @@ -77,21 +70,18 @@ public class MavenITmng3586SystemScopePluginDependencyTest * @throws Exception in case of failure */ @Test - public void testitFromProject() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3586/test-2" ); + public void testitFromProject() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3586/test-2"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.getSystemProperties().setProperty( "test.home", testDir.getAbsolutePath() ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.getSystemProperties().setProperty("test.home", testDir.getAbsolutePath()); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/pcl.properties" ); - assertEquals( "1", props.getProperty( "maven-core-it.properties.count" ) ); + Properties props = verifier.loadProperties("target/pcl.properties"); + assertEquals("1", props.getProperty("maven-core-it.properties.count")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3599useHttpProxyForWebDAVMk2Test.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3599useHttpProxyForWebDAVMk2Test.java index ef70059f67..617ac2ba40 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3599useHttpProxyForWebDAVMk2Test.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3599useHttpProxyForWebDAVMk2Test.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,9 +16,7 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -30,6 +26,8 @@ import java.io.IOException; import org.apache.maven.shared.utils.StringUtils; import org.apache.maven.shared.utils.io.FileUtils; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.eclipse.jetty.server.Handler; import org.eclipse.jetty.server.NetworkConnector; import org.eclipse.jetty.server.Request; @@ -46,58 +44,48 @@ import org.junit.jupiter.api.Test; * @author John Casey * */ -public class MavenITmng3599useHttpProxyForWebDAVMk2Test - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3599useHttpProxyForWebDAVMk2Test extends AbstractMavenIntegrationTestCase { private Server server; private int port; - private static final String CONTENT = "\n" + - " 4.0.0\n" + - " org.apache.maven.its.mng3599\n" + - " test\n" + - " 1.0-SNAPSHOT\n" + - " MNG-3599\n" + - ""; + private static final String CONTENT = + "\n" + + " 4.0.0\n" + + " org.apache.maven.its.mng3599\n" + + " test\n" + + " 1.0-SNAPSHOT\n" + + " MNG-3599\n" + + ""; private static final String CONTENT_CHECKSUM_SHA1 = "8c2562233bae8fa8aa40697d6bbd5115f9062a71"; - public MavenITmng3599useHttpProxyForWebDAVMk2Test() - { - super( "[3.3.9,)" ); + public MavenITmng3599useHttpProxyForWebDAVMk2Test() { + super("[3.3.9,)"); } @BeforeEach - protected void setUp() - throws Exception - { - Handler handler = new AbstractHandler() - { - public void handle( String target, Request baseRequest, HttpServletRequest request, - HttpServletResponse response ) - throws IOException - { - System.out.println( "Got request for URL: '" + request.getRequestURL() + "'" ); + protected void setUp() throws Exception { + Handler handler = new AbstractHandler() { + public void handle( + String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) + throws IOException { + System.out.println("Got request for URL: '" + request.getRequestURL() + "'"); System.out.flush(); - response.setContentType( "text/plain" ); + response.setContentType("text/plain"); - System.out.println( "Checking for 'Proxy-Connection' header..." ); - if ( request.getHeader( "Proxy-Connection" ) != null ) - { - response.setStatus( HttpServletResponse.SC_OK ); - if ( request.getRequestURI().endsWith( ".sha1" ) ) - { - response.getWriter().print( CONTENT_CHECKSUM_SHA1 ); - } - else - { - response.getWriter().print( CONTENT ); + System.out.println("Checking for 'Proxy-Connection' header..."); + if (request.getHeader("Proxy-Connection") != null) { + response.setStatus(HttpServletResponse.SC_OK); + if (request.getRequestURI().endsWith(".sha1")) { + response.getWriter().print(CONTENT_CHECKSUM_SHA1); + } else { + response.getWriter().print(CONTENT); } - System.out.println( "Proxy-Connection found." ); + System.out.println("Proxy-Connection found."); } /* * 2008-09-29 Oleg: "Proxy-Connection" is not part of http spec, but an extended header, and @@ -105,95 +93,80 @@ public class MavenITmng3599useHttpProxyForWebDAVMk2Test * Changing the code to test for more generalized case: local proxy receives a request with * correct server url and resource uri */ - else if - ( - request.getRequestURI().startsWith( "/org/apache/maven/its/mng3599/test-dependency" ) - && request.getRequestURL().toString().startsWith( "http://www.example.com" ) - ) - { - response.setStatus( HttpServletResponse.SC_OK ); - if ( request.getRequestURI().endsWith( ".sha1" ) ) - { - response.getWriter().print( CONTENT_CHECKSUM_SHA1 ); - } - else - { - response.getWriter().print( CONTENT ); + else if (request.getRequestURI().startsWith("/org/apache/maven/its/mng3599/test-dependency") + && request.getRequestURL().toString().startsWith("http://www.example.com")) { + response.setStatus(HttpServletResponse.SC_OK); + if (request.getRequestURI().endsWith(".sha1")) { + response.getWriter().print(CONTENT_CHECKSUM_SHA1); + } else { + response.getWriter().print(CONTENT); } - System.out.println( "Correct proxied request 'http://www.example.com' for resource '/org/apache/maven/its/mng3599/test-dependency' found." ); - } - else - { - response.setStatus( HttpServletResponse.SC_BAD_REQUEST ); + System.out.println( + "Correct proxied request 'http://www.example.com' for resource '/org/apache/maven/its/mng3599/test-dependency' found."); + } else { + response.setStatus(HttpServletResponse.SC_BAD_REQUEST); - System.out.println( "Proxy-Connection not found." ); + System.out.println("Proxy-Connection not found."); } - ( (Request) request ).setHandled( true ); + ((Request) request).setHandled(true); } }; - server = new Server( 0 ); - server.setHandler( handler ); + server = new Server(0); + server.setHandler(handler); server.start(); - if ( server.isFailed() ) - { - fail( "Couldn't bind the server socket to a free port!" ); + if (server.isFailed()) { + fail("Couldn't bind the server socket to a free port!"); } - port = ( (NetworkConnector) server.getConnectors()[0] ).getLocalPort(); - System.out.println( "Bound server socket to the port " + port ); + port = ((NetworkConnector) server.getConnectors()[0]).getLocalPort(); + System.out.println("Bound server socket to the port " + port); } @AfterEach - protected void tearDown() - throws Exception - { - if ( server != null ) - { + protected void tearDown() throws Exception { + if (server != null) { server.stop(); server.join(); } } @Test - public void testitUseHttpProxyForHttp() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3599-mk2" ); + public void testitUseHttpProxyForHttp() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3599-mk2"); /* * NOTE: Make sure the WebDAV extension required by the test project has been pulled down into the local * repo before the actual test installs Jetty as a mirror for everything. Otherwise, we will get garbage * for the JAR/POM of the extension and its dependencies when run against a vanilla repo. */ - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - String settings = FileUtils.fileRead( new File( testDir, "settings-template.xml" ) ); - settings = StringUtils.replace( settings, "@port@", Integer.toString( port ) ); - String newSettings = StringUtils.replace( settings, "@protocol@", "http" ); + String settings = FileUtils.fileRead(new File(testDir, "settings-template.xml")); + settings = StringUtils.replace(settings, "@port@", Integer.toString(port)); + String newSettings = StringUtils.replace(settings, "@protocol@", "http"); - FileUtils.fileWrite( new File( testDir, "settings.xml" ).getAbsolutePath(), newSettings ); + FileUtils.fileWrite(new File(testDir, "settings.xml").getAbsolutePath(), newSettings); - verifier = newVerifier( testDir.getAbsolutePath() ); + verifier = newVerifier(testDir.getAbsolutePath()); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "-X" ); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("-X"); - verifier.deleteArtifacts( "org.apache.maven.its.mng3599" ); + verifier.deleteArtifacts("org.apache.maven.its.mng3599"); - verifier.setLogFileName( "logHttp.txt" ); - verifier.addCliArgument( "compile" ); + verifier.setLogFileName("logHttp.txt"); + verifier.addCliArgument("compile"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng3599", "test-dependency", "1.0", "jar" ); - verifier.verifyArtifactContent( "org.apache.maven.its.mng3599", "test-dependency", "1.0", "jar", - CONTENT ); + verifier.verifyArtifactPresent("org.apache.maven.its.mng3599", "test-dependency", "1.0", "jar"); + verifier.verifyArtifactContent("org.apache.maven.its.mng3599", "test-dependency", "1.0", "jar", CONTENT); } /** @@ -202,42 +175,39 @@ public class MavenITmng3599useHttpProxyForWebDAVMk2Test * @throws Exception in case of failure */ @Test - public void testitUseHttpProxyForWebDAV() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3599-mk2" ); + public void testitUseHttpProxyForWebDAV() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3599-mk2"); /* * NOTE: Make sure the WebDAV extension required by the test project has been pulled down into the local * repo before the actual test installs Jetty as a mirror for everything. Otherwise, we will get garbage * for the JAR/POM of the extension and its dependencies when run against a vanilla repo. */ - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - String settings = FileUtils.fileRead( new File( testDir, "settings-template.xml" ) ); - settings = StringUtils.replace( settings, "@port@", Integer.toString( port ) ); - String newSettings = StringUtils.replace( settings, "@protocol@", "dav" ); + String settings = FileUtils.fileRead(new File(testDir, "settings-template.xml")); + settings = StringUtils.replace(settings, "@port@", Integer.toString(port)); + String newSettings = StringUtils.replace(settings, "@protocol@", "dav"); - FileUtils.fileWrite( new File( testDir, "settings.xml" ).getAbsolutePath(), newSettings ); + FileUtils.fileWrite(new File(testDir, "settings.xml").getAbsolutePath(), newSettings); - verifier = newVerifier( testDir.getAbsolutePath() ); + verifier = newVerifier(testDir.getAbsolutePath()); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "-X" ); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("-X"); - verifier.deleteArtifacts( "org.apache.maven.its.mng3599" ); + verifier.deleteArtifacts("org.apache.maven.its.mng3599"); - verifier.setLogFileName( "logDAV.txt" ); - verifier.addCliArgument( "compile" ); + verifier.setLogFileName("logDAV.txt"); + verifier.addCliArgument("compile"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng3599", "test-dependency", "1.0", "jar" ); - verifier.verifyArtifactContent( "org.apache.maven.its.mng3599", "test-dependency", "1.0", "jar", - CONTENT ); + verifier.verifyArtifactPresent("org.apache.maven.its.mng3599", "test-dependency", "1.0", "jar"); + verifier.verifyArtifactContent("org.apache.maven.its.mng3599", "test-dependency", "1.0", "jar", CONTENT); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3600DeploymentModeDefaultsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3600DeploymentModeDefaultsTest.java index b74d1bf0cd..3203f39233 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3600DeploymentModeDefaultsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3600DeploymentModeDefaultsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,77 +30,67 @@ import org.junit.jupiter.api.Test; * * */ -public class MavenITmng3600DeploymentModeDefaultsTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3600DeploymentModeDefaultsTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3600DeploymentModeDefaultsTest() - { - super( "(2.1.0-M1,3.0-alpha-1),[3.0.1,)" ); + public MavenITmng3600DeploymentModeDefaultsTest() { + super("(2.1.0-M1,3.0-alpha-1),[3.0.1,)"); } @Test - public void testitMNG3600NoSettings() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3600" ); + public void testitMNG3600NoSettings() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3600"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); - new File( testDir, "wagon.properties" ).delete(); - verifier.setLogFileName( "log-no-settings.txt" ); - verifier.addCliArgument( "validate" ); + new File(testDir, "wagon.properties").delete(); + verifier.setLogFileName("log-no-settings.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "wagon.properties" ); - Properties props = verifier.loadProperties( "wagon.properties" ); - assertNull( props.get( "directory.mode" ) ); - assertNull( props.get( "file.mode" ) ); + verifier.verifyFilePresent("wagon.properties"); + Properties props = verifier.loadProperties("wagon.properties"); + assertNull(props.get("directory.mode")); + assertNull(props.get("file.mode")); } @Test - public void testitMNG3600ServerDefaults() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3600" ); + public void testitMNG3600ServerDefaults() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3600"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); - new File( testDir, "wagon.properties" ).delete(); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings-server-defaults.xml" ); - verifier.setLogFileName( "log-server-defaults.txt" ); - verifier.addCliArgument( "validate" ); + new File(testDir, "wagon.properties").delete(); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings-server-defaults.xml"); + verifier.setLogFileName("log-server-defaults.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "wagon.properties" ); - Properties props = verifier.loadProperties( "wagon.properties" ); - assertNull( props.get( "directory.mode" ) ); - assertNull( props.get( "file.mode" ) ); + verifier.verifyFilePresent("wagon.properties"); + Properties props = verifier.loadProperties("wagon.properties"); + assertNull(props.get("directory.mode")); + assertNull(props.get("file.mode")); } @Test - public void testitMNG3600ModesSet() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3600" ); + public void testitMNG3600ModesSet() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3600"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); - new File( testDir, "wagon.properties" ).delete(); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings-modes-set.xml" ); - verifier.setLogFileName( "log-modes-set.txt" ); - verifier.addCliArgument( "validate" ); + new File(testDir, "wagon.properties").delete(); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings-modes-set.xml"); + verifier.setLogFileName("log-modes-set.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "wagon.properties" ); - Properties props = verifier.loadProperties( "wagon.properties" ); - assertEquals( "700", props.get( "directory.mode" ) ); - assertEquals( "600", props.get( "file.mode" ) ); + verifier.verifyFilePresent("wagon.properties"); + Properties props = verifier.loadProperties("wagon.properties"); + assertEquals("700", props.get("directory.mode")); + assertEquals("600", props.get("file.mode")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3607ClassLoadersUseValidUrlsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3607ClassLoadersUseValidUrlsTest.java index 52a3157f2a..f7dea97aac 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3607ClassLoadersUseValidUrlsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3607ClassLoadersUseValidUrlsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.net.URI; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -34,13 +32,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3607ClassLoadersUseValidUrlsTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3607ClassLoadersUseValidUrlsTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3607ClassLoadersUseValidUrlsTest() - { - super( "[3.0-alpha-2,)" ); + public MavenITmng3607ClassLoadersUseValidUrlsTest() { + super("[3.0-alpha-2,)"); } /** @@ -49,24 +44,21 @@ public class MavenITmng3607ClassLoadersUseValidUrlsTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3607" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3607"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.getSystemProperties().setProperty( "test.home", testDir.getAbsolutePath() ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.getSystemProperties().setProperty("test.home", testDir.getAbsolutePath()); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/pcl.properties" ); - String url = props.getProperty( "maven-core-it.properties" ); - assertNotNull( url ); - assertNotNull( new URI( url ) ); - assertTrue( url.indexOf( ' ' ) < 0 ); + Properties props = verifier.loadProperties("target/pcl.properties"); + String url = props.getProperty("maven-core-it.properties"); + assertNotNull(url); + assertNotNull(new URI(url)); + assertTrue(url.indexOf(' ') < 0); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3621UNCInheritedPathsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3621UNCInheritedPathsTest.java index a74a40a2e8..f4b34dff73 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3621UNCInheritedPathsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3621UNCInheritedPathsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Brett Porter * */ -public class MavenITmng3621UNCInheritedPathsTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3621UNCInheritedPathsTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3621UNCInheritedPathsTest() - { - super( "[2.0.11,2.1.0-M1),[2.1.0,)" ); + public MavenITmng3621UNCInheritedPathsTest() { + super("[2.0.11,2.1.0-M1),[2.1.0,)"); } /** @@ -48,20 +43,17 @@ public class MavenITmng3621UNCInheritedPathsTest * @throws Exception in case of failure */ @Test - public void testitMNG3621() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3621" ); + public void testitMNG3621() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3621"); - Verifier verifier = newVerifier( new File( testDir, "child" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(new File(testDir, "child").getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/pom.properties" ); - assertEquals( "file:////host/site/test-child", props.getProperty( "project.distributionManagement.site.url" ) ); + Properties props = verifier.loadProperties("target/pom.properties"); + assertEquals("file:////host/site/test-child", props.getProperty("project.distributionManagement.site.url")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3641ProfileActivationWarningTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3641ProfileActivationWarningTest.java index c96cbed744..b4fd7d7874 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3641ProfileActivationWarningTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3641ProfileActivationWarningTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,129 +16,120 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; import java.util.regex.Pattern; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** * This is a test set for MNG-3641: * Profile activation warning test */ -public class MavenITmng3641ProfileActivationWarningTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3641ProfileActivationWarningTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3641ProfileActivationWarningTest() - { - super( "[2.0.11,2.1.0-M1),[2.1.0,4.0.0-alpha-1)" ); // only test in 2.0.11+, 2.1.0+ + public MavenITmng3641ProfileActivationWarningTest() { + super("[2.0.11,2.1.0-M1),[2.1.0,4.0.0-alpha-1)"); // only test in 2.0.11+, 2.1.0+ } @Test - public void testitMNG3641() - throws Exception - { + public void testitMNG3641() throws Exception { // (0) Initialize. - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3641" ); + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3641"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); // Delete this artifact. Just in case. - verifier.deleteArtifact( "org.apache.maven.its.mng3641", "parent", "1.0", "pom" ); + verifier.deleteArtifact("org.apache.maven.its.mng3641", "parent", "1.0", "pom"); // (1) make sure the profile is found. Must not contain a warning. - verifier.addCliArgument( "-P" ); - verifier.addCliArgument( "mng-3641-it-provided-profile" ); - verifier.setLogFileName( "log-1.txt" ); - verifier.addCliArgument( "validate" ); + verifier.addCliArgument("-P"); + verifier.addCliArgument("mng-3641-it-provided-profile"); + verifier.setLogFileName("log-1.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List logFile = verifier.loadFile( verifier.getBasedir(), verifier.getLogFileName(), false ); - assertNull( findWarning( logFile, "mng-3641-it-provided-profile" ) ); + List logFile = verifier.loadFile(verifier.getBasedir(), verifier.getLogFileName(), false); + assertNull(findWarning(logFile, "mng-3641-it-provided-profile")); // (2) make sure the profile was not found and a warning was printed. - verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.addCliArgument( "-P" ); - verifier.addCliArgument( "mng-3641-TWlzdGVyIFQgd2FzIGhlcmUuICheX14p" ); - verifier.setLogFileName( "log-2.txt" ); - verifier.addCliArgument( "validate" ); + verifier = newVerifier(testDir.getAbsolutePath()); + verifier.addCliArgument("-P"); + verifier.addCliArgument("mng-3641-TWlzdGVyIFQgd2FzIGhlcmUuICheX14p"); + verifier.setLogFileName("log-2.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - logFile = verifier.loadFile( verifier.getBasedir(), verifier.getLogFileName(), false ); - assertNotNull( findWarning( logFile, "mng-3641-TWlzdGVyIFQgd2FzIGhlcmUuICheX14p" ) ); + logFile = verifier.loadFile(verifier.getBasedir(), verifier.getLogFileName(), false); + assertNotNull(findWarning(logFile, "mng-3641-TWlzdGVyIFQgd2FzIGhlcmUuICheX14p")); // (3) make sure the first profile is found while the other is not and a warning was printed // accordingly. - verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.addCliArgument( "-P" ); - verifier.addCliArgument( "mng-3641-it-provided-profile,mng-3641-TWlzdGVyIFQgd2FzIGhlcmUuICheX14p" ); - verifier.setLogFileName( "log-3.txt" ); - verifier.addCliArgument( "validate" ); + verifier = newVerifier(testDir.getAbsolutePath()); + verifier.addCliArgument("-P"); + verifier.addCliArgument("mng-3641-it-provided-profile,mng-3641-TWlzdGVyIFQgd2FzIGhlcmUuICheX14p"); + verifier.setLogFileName("log-3.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - logFile = verifier.loadFile( verifier.getBasedir(), verifier.getLogFileName(), false ); - assertNull( findWarning( logFile, "mng-3641-it-provided-profile" ) ); - assertNotNull( findWarning( logFile, "mng-3641-TWlzdGVyIFQgd2FzIGhlcmUuICheX14p" ) ); + logFile = verifier.loadFile(verifier.getBasedir(), verifier.getLogFileName(), false); + assertNull(findWarning(logFile, "mng-3641-it-provided-profile")); + assertNotNull(findWarning(logFile, "mng-3641-TWlzdGVyIFQgd2FzIGhlcmUuICheX14p")); // (4) make sure the warning is only printed when the profile is missing in all projects - verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.addCliArgument( "-P" ); - verifier.addCliArgument( "mng-3641-it-provided-profile-child" ); - verifier.setLogFileName( "log-4.txt" ); - verifier.addCliArgument( "validate" ); + verifier = newVerifier(testDir.getAbsolutePath()); + verifier.addCliArgument("-P"); + verifier.addCliArgument("mng-3641-it-provided-profile-child"); + verifier.setLogFileName("log-4.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - logFile = verifier.loadFile( verifier.getBasedir(), verifier.getLogFileName(), false ); - assertNull( findWarning( logFile, "mng-3641-it-provided-profile-child" ) ); + logFile = verifier.loadFile(verifier.getBasedir(), verifier.getLogFileName(), false); + assertNull(findWarning(logFile, "mng-3641-it-provided-profile-child")); // (5) make sure the profile is found in subproject. Must not contain a warning. - verifier = newVerifier( new File( testDir, "child1" ).getAbsolutePath() ); - verifier.addCliArgument( "-P" ); - verifier.addCliArgument( "mng-3641-it-provided-profile-child" ); - verifier.setLogFileName( "log-5.txt" ); - verifier.addCliArgument( "validate" ); + verifier = newVerifier(new File(testDir, "child1").getAbsolutePath()); + verifier.addCliArgument("-P"); + verifier.addCliArgument("mng-3641-it-provided-profile-child"); + verifier.setLogFileName("log-5.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - logFile = verifier.loadFile( verifier.getBasedir(), verifier.getLogFileName(), false ); - assertNull( findWarning( logFile, "mng-3641-it-provided-profile-child" ) ); + logFile = verifier.loadFile(verifier.getBasedir(), verifier.getLogFileName(), false); + assertNull(findWarning(logFile, "mng-3641-it-provided-profile-child")); // (6) make sure the profile is found from parent in subproject. Must not contain a warning. - verifier = newVerifier( new File( testDir, "child1" ).getAbsolutePath() ); - verifier.addCliArgument( "-P" ); - verifier.addCliArgument( "mng-3641-it-provided-profile" ); - verifier.setLogFileName( "log-6.txt" ); - verifier.addCliArgument( "validate" ); + verifier = newVerifier(new File(testDir, "child1").getAbsolutePath()); + verifier.addCliArgument("-P"); + verifier.addCliArgument("mng-3641-it-provided-profile"); + verifier.setLogFileName("log-6.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - logFile = verifier.loadFile( verifier.getBasedir(), verifier.getLogFileName(), false ); - assertNull( findWarning( logFile, "mng-3641-it-provided-profile" ) ); + logFile = verifier.loadFile(verifier.getBasedir(), verifier.getLogFileName(), false); + assertNull(findWarning(logFile, "mng-3641-it-provided-profile")); } - private String findWarning( List logLines, String profileId ) - { - Pattern pattern = Pattern.compile( "(?i).*profile\\s.*\\Q" + profileId + "\\E.*\\snot\\s.*activated.*" ); + private String findWarning(List logLines, String profileId) { + Pattern pattern = Pattern.compile("(?i).*profile\\s.*\\Q" + profileId + "\\E.*\\snot\\s.*activated.*"); - for ( String logLine : logLines ) - { - if ( pattern.matcher( logLine ).matches() ) - { + for (String logLine : logLines) { + if (pattern.matcher(logLine).matches()) { return logLine; } } return null; } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3642DynamicResourcesTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3642DynamicResourcesTest.java index ef88d507ec..4ee7b841dc 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3642DynamicResourcesTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3642DynamicResourcesTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -35,21 +33,16 @@ import org.junit.jupiter.api.Test; * @author jdcasey * */ -public class MavenITmng3642DynamicResourcesTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng3642DynamicResourcesTest() - { - super( "(2.0.9,)" ); // only test in 2.0.9+ +public class MavenITmng3642DynamicResourcesTest extends AbstractMavenIntegrationTestCase { + public MavenITmng3642DynamicResourcesTest() { + super("(2.0.9,)"); // only test in 2.0.9+ } @Test - public void testitMNG3642 () - throws Exception - { + public void testitMNG3642() throws Exception { // The testdir is computed from the location of this // file. - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3642" ); + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3642"); Verifier verifier; @@ -60,7 +53,7 @@ public class MavenITmng3642DynamicResourcesTest * unstable test results. Fortunately, the verifier * makes it easy to do this. */ - verifier = newVerifier( testDir.getAbsolutePath() ); + verifier = newVerifier(testDir.getAbsolutePath()); /* * The Command Line Options (CLI) are passed to the @@ -70,7 +63,7 @@ public class MavenITmng3642DynamicResourcesTest * recurse. We are only installing the parent pom to * the local repo here. */ - verifier.addCliArgument( "process-test-resources" ); + verifier.addCliArgument("process-test-resources"); verifier.execute(); /* @@ -84,10 +77,10 @@ public class MavenITmng3642DynamicResourcesTest */ verifier.verifyErrorFreeLog(); - File first = new File( testDir, "target/test-classes/one.txt" ); - assertTrue( "First resource file was not present: " + first, first.exists() ); + File first = new File(testDir, "target/test-classes/one.txt"); + assertTrue("First resource file was not present: " + first, first.exists()); - File second = new File( testDir, "target/test-classes/two.txt" ); - assertTrue( "Second resource file was not present: " + second, second.exists() ); + File second = new File(testDir, "target/test-classes/two.txt"); + assertTrue("Second resource file was not present: " + second, second.exists()); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3645POMSyntaxErrorTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3645POMSyntaxErrorTest.java index 6935e28cd7..24e7a44a2b 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3645POMSyntaxErrorTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3645POMSyntaxErrorTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -36,13 +34,10 @@ import org.junit.jupiter.api.Test; * @author jdcasey * */ -public class MavenITmng3645POMSyntaxErrorTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3645POMSyntaxErrorTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3645POMSyntaxErrorTest() - { - super( "[2.0.10,2.1.0-M1),[2.1.0,3.0-alpha-1),[3.0-alpha-3,)" ); + public MavenITmng3645POMSyntaxErrorTest() { + super("[2.0.10,2.1.0-M1),[2.1.0,3.0-alpha-1),[3.0-alpha-3,)"); } /** @@ -51,26 +46,21 @@ public class MavenITmng3645POMSyntaxErrorTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3645" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3645"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); - try - { - verifier.addCliArgument( "validate" ); + try { + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - fail( "Should fail to validate the POM syntax due to missing dependency element inside dependencyManagement section." ); - } - catch ( VerificationException e ) - { + fail( + "Should fail to validate the POM syntax due to missing dependency element inside dependencyManagement section."); + } catch (VerificationException e) { // expect this. } } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3652UserAgentHeaderTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3652UserAgentHeaderTest.java index a80e1c6882..d25b6fc9ae 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3652UserAgentHeaderTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3652UserAgentHeaderTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,9 +16,7 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -29,6 +25,8 @@ import java.io.File; import java.io.IOException; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.eclipse.jetty.server.Handler; import org.eclipse.jetty.server.NetworkConnector; import org.eclipse.jetty.server.Request; @@ -41,9 +39,7 @@ import org.junit.jupiter.api.Test; /** * This is a test set for MNG-3652. */ -public class MavenITmng3652UserAgentHeaderTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3652UserAgentHeaderTest extends AbstractMavenIntegrationTestCase { private Server server; private int port; @@ -52,56 +48,47 @@ public class MavenITmng3652UserAgentHeaderTest private String customHeader; - public MavenITmng3652UserAgentHeaderTest() - { - super( "[3.0-beta-3,)" ); + public MavenITmng3652UserAgentHeaderTest() { + super("[3.0-beta-3,)"); } @BeforeEach - protected void setUp() - throws Exception - { - Handler handler = new AbstractHandler() - { + protected void setUp() throws Exception { + Handler handler = new AbstractHandler() { @Override - public void handle( String target, Request baseRequest, HttpServletRequest request, - HttpServletResponse response ) - throws IOException - { - System.out.println( "Handling URL: '" + request.getRequestURL() + "'" ); + public void handle( + String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) + throws IOException { + System.out.println("Handling URL: '" + request.getRequestURL() + "'"); - userAgent = request.getHeader( "User-Agent" ); + userAgent = request.getHeader("User-Agent"); - customHeader = request.getHeader( "Custom-Header" ); + customHeader = request.getHeader("Custom-Header"); - System.out.println( "Got User-Agent: '" + userAgent + "'" ); + System.out.println("Got User-Agent: '" + userAgent + "'"); - response.setContentType( "text/plain" ); - response.setStatus( HttpServletResponse.SC_OK ); - response.getWriter().println( "some content" ); + response.setContentType("text/plain"); + response.setStatus(HttpServletResponse.SC_OK); + response.getWriter().println("some content"); response.getWriter().println(); - ( (Request) request ).setHandled( true ); + ((Request) request).setHandled(true); } }; - server = new Server( 0 ); - server.setHandler( handler ); + server = new Server(0); + server.setHandler(handler); server.start(); - if ( server.isFailed() ) - { - fail( "Couldn't bind the server socket to a free port!" ); + if (server.isFailed()) { + fail("Couldn't bind the server socket to a free port!"); } - port = ( (NetworkConnector) server.getConnectors()[0] ).getLocalPort(); - System.out.println( "Bound server socket to the port " + port ); + port = ((NetworkConnector) server.getConnectors()[0]).getLocalPort(); + System.out.println("Bound server socket to the port " + port); } @AfterEach - protected void tearDown() - throws Exception - { - if ( server != null) - { + protected void tearDown() throws Exception { + if (server != null) { server.stop(); server.join(); } @@ -113,206 +100,201 @@ public class MavenITmng3652UserAgentHeaderTest * @throws Exception in case of failure */ @Test - public void testmng3652_UnConfiguredHttp() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3652" ); - File pluginDir = new File( testDir, "test-plugin" ); - File projectDir = new File( testDir, "test-project" ); + public void testmng3652_UnConfiguredHttp() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3652"); + File pluginDir = new File(testDir, "test-plugin"); + File projectDir = new File(testDir, "test-project"); - Verifier verifier = newVerifier( pluginDir.getAbsolutePath(), "remote" ); - verifier.addCliArgument( "install" ); + Verifier verifier = newVerifier(pluginDir.getAbsolutePath(), "remote"); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier = newVerifier( projectDir.getAbsolutePath(), "remote" ); + verifier = newVerifier(projectDir.getAbsolutePath(), "remote"); - verifier.addCliArgument( "-DtestPort=" + port ); - verifier.addCliArgument( "-X" ); + verifier.addCliArgument("-DtestPort=" + port); + verifier.addCliArgument("-X"); - verifier.setLogFileName( "log-unConfiguredHttp.txt" ); - verifier.addCliArgument( "validate" ); + verifier.setLogFileName("log-unConfiguredHttp.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); String userAgent = this.userAgent; - assertNotNull( userAgent ); + assertNotNull(userAgent); - File touchFile = new File( projectDir, "target/touch.txt" ); - assertTrue( touchFile.exists() ); + File touchFile = new File(projectDir, "target/touch.txt"); + assertTrue(touchFile.exists()); - List lines = verifier.loadFile( touchFile, false ); + List lines = verifier.loadFile(touchFile, false); // NOTE: system property for maven.version may not exist if you use -Dtest // surefire parameter to run this single test. Therefore, the plugin writes // the maven version into the check file. - String mavenVersion = lines.get( 0 ); - String javaVersion = lines.get( 1 ); - String os = lines.get( 2 ) + " " + lines.get( 3 ); - String artifactVersion = lines.get( 4 ); + String mavenVersion = lines.get(0); + String javaVersion = lines.get(1); + String os = lines.get(2) + " " + lines.get(3); + String artifactVersion = lines.get(4); - assertEquals( "Comparing User-Agent '" + userAgent + "'", "Apache-Maven/" + mavenVersion + " (Java " - + javaVersion + "; " + os + ")", userAgent ); + assertEquals( + "Comparing User-Agent '" + userAgent + "'", + "Apache-Maven/" + mavenVersion + " (Java " + javaVersion + "; " + os + ")", + userAgent); } @Test - public void testmng3652_UnConfiguredDAV() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3652" ); - File pluginDir = new File( testDir, "test-plugin" ); - File projectDir = new File( testDir, "test-project" ); + public void testmng3652_UnConfiguredDAV() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3652"); + File pluginDir = new File(testDir, "test-plugin"); + File projectDir = new File(testDir, "test-project"); - Verifier verifier = newVerifier( pluginDir.getAbsolutePath(), "remote" ); - verifier.addCliArgument( "install" ); + Verifier verifier = newVerifier(pluginDir.getAbsolutePath(), "remote"); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier = newVerifier( projectDir.getAbsolutePath(), "remote" ); + verifier = newVerifier(projectDir.getAbsolutePath(), "remote"); // test webdav - verifier.addCliArgument( "-DtestPort=" + port ); - verifier.addCliArgument( "-DtestProtocol=dav:http" ); - verifier.addCliArgument( "-X" ); + verifier.addCliArgument("-DtestPort=" + port); + verifier.addCliArgument("-DtestProtocol=dav:http"); + verifier.addCliArgument("-X"); - verifier.setLogFileName( "log-unConfiguredDAV.txt" ); - verifier.addCliArgument( "validate" ); + verifier.setLogFileName("log-unConfiguredDAV.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - File touchFile = new File( projectDir, "target/touch.txt" ); - assertTrue( touchFile.exists() ); + File touchFile = new File(projectDir, "target/touch.txt"); + assertTrue(touchFile.exists()); - List lines = verifier.loadFile( touchFile, false ); + List lines = verifier.loadFile(touchFile, false); // NOTE: system property for maven.version may not exist if you use -Dtest // surefire parameter to run this single test. Therefore, the plugin writes // the maven version into the check file. - String mavenVersion = lines.get( 0 ); - String javaVersion = lines.get( 1 ); - String os = lines.get( 2 ) + " " + lines.get( 3 ); - String artifactVersion = lines.get( 4 ); + String mavenVersion = lines.get(0); + String javaVersion = lines.get(1); + String os = lines.get(2) + " " + lines.get(3); + String artifactVersion = lines.get(4); String userAgent = this.userAgent; - assertNotNull( userAgent ); + assertNotNull(userAgent); - assertEquals( "Comparing User-Agent '" + userAgent + "'", "Apache-Maven/" + mavenVersion + " (Java " - + javaVersion + "; " + os + ")", userAgent ); + assertEquals( + "Comparing User-Agent '" + userAgent + "'", + "Apache-Maven/" + mavenVersion + " (Java " + javaVersion + "; " + os + ")", + userAgent); } @Test - public void testmng3652_ConfigurationInSettingsWithoutUserAgent() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3652" ); - File pluginDir = new File( testDir, "test-plugin" ); - File projectDir = new File( testDir, "test-project" ); + public void testmng3652_ConfigurationInSettingsWithoutUserAgent() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3652"); + File pluginDir = new File(testDir, "test-plugin"); + File projectDir = new File(testDir, "test-project"); - Verifier verifier = newVerifier( pluginDir.getAbsolutePath(), "remote" ); - verifier.addCliArgument( "install" ); + Verifier verifier = newVerifier(pluginDir.getAbsolutePath(), "remote"); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier = newVerifier( projectDir.getAbsolutePath(), "remote" ); + verifier = newVerifier(projectDir.getAbsolutePath(), "remote"); // test settings with no config - verifier.addCliArgument( "-DtestPort=" + port ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings-no-config.xml" ); - verifier.addCliArgument( "-X" ); + verifier.addCliArgument("-DtestPort=" + port); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings-no-config.xml"); + verifier.addCliArgument("-X"); - verifier.setLogFileName( "log-configWithoutUserAgent.txt" ); - verifier.addCliArgument( "validate" ); + verifier.setLogFileName("log-configWithoutUserAgent.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - File touchFile = new File( projectDir, "target/touch.txt" ); - assertTrue( touchFile.exists() ); + File touchFile = new File(projectDir, "target/touch.txt"); + assertTrue(touchFile.exists()); - List lines = verifier.loadFile( touchFile, false ); + List lines = verifier.loadFile(touchFile, false); // NOTE: system property for maven.version may not exist if you use -Dtest // surefire parameter to run this single test. Therefore, the plugin writes // the maven version into the check file. - String mavenVersion = lines.get( 0 ); - String javaVersion = lines.get( 1 ); - String os = lines.get( 2 ) + " " + lines.get( 3 ); - String artifactVersion = lines.get( 4 ); + String mavenVersion = lines.get(0); + String javaVersion = lines.get(1); + String os = lines.get(2) + " " + lines.get(3); + String artifactVersion = lines.get(4); String userAgent = this.userAgent; - assertNotNull( userAgent ); + assertNotNull(userAgent); - assertEquals( "Comparing User-Agent '" + userAgent + "'", "Apache-Maven/" + mavenVersion + " (Java " - + javaVersion + "; " + os + ")", userAgent ); + assertEquals( + "Comparing User-Agent '" + userAgent + "'", + "Apache-Maven/" + mavenVersion + " (Java " + javaVersion + "; " + os + ")", + userAgent); } @Test - public void testmng3652_UserAgentConfiguredInSettings() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3652" ); - File pluginDir = new File( testDir, "test-plugin" ); - File projectDir = new File( testDir, "test-project" ); + public void testmng3652_UserAgentConfiguredInSettings() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3652"); + File pluginDir = new File(testDir, "test-plugin"); + File projectDir = new File(testDir, "test-project"); - Verifier verifier = newVerifier( pluginDir.getAbsolutePath(), "remote" ); - verifier.addCliArgument( "install" ); + Verifier verifier = newVerifier(pluginDir.getAbsolutePath(), "remote"); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier = newVerifier( projectDir.getAbsolutePath(), "remote" ); + verifier = newVerifier(projectDir.getAbsolutePath(), "remote"); // test settings with config - verifier.addCliArgument( "-DtestPort=" + port ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "-X" ); + verifier.addCliArgument("-DtestPort=" + port); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("-X"); - verifier.setLogFileName( "log-configWithUserAgent.txt" ); - verifier.addCliArgument( "validate" ); + verifier.setLogFileName("log-configWithUserAgent.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); String userAgent = this.userAgent; - assertNotNull( userAgent ); + assertNotNull(userAgent); - assertEquals( "Maven Fu", userAgent ); - assertEquals( "My wonderful header", customHeader ); + assertEquals("Maven Fu", userAgent); + assertEquals("My wonderful header", customHeader); } @Test - public void testmng3652_AdditionnalHttpHeaderConfiguredInSettings() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3652" ); - File pluginDir = new File( testDir, "test-plugin" ); - File projectDir = new File( testDir, "test-project" ); + public void testmng3652_AdditionnalHttpHeaderConfiguredInSettings() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3652"); + File pluginDir = new File(testDir, "test-plugin"); + File projectDir = new File(testDir, "test-project"); - Verifier verifier = newVerifier( pluginDir.getAbsolutePath(), "remote" ); - verifier.addCliArgument( "install" ); + Verifier verifier = newVerifier(pluginDir.getAbsolutePath(), "remote"); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier = newVerifier( projectDir.getAbsolutePath(), "remote" ); + verifier = newVerifier(projectDir.getAbsolutePath(), "remote"); // test settings with config - verifier.addCliArgument( "-DtestPort=" + port ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "-X" ); + verifier.addCliArgument("-DtestPort=" + port); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("-X"); - verifier.setLogFileName( "log-configWithUserAgent.txt" ); - verifier.addCliArgument( "validate" ); + verifier.setLogFileName("log-configWithUserAgent.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); String userAgent = this.userAgent; - assertNotNull( userAgent ); + assertNotNull(userAgent); - assertEquals( "Maven Fu", userAgent ); - assertEquals( "My wonderful header", customHeader ); + assertEquals("Maven Fu", userAgent); + assertEquals("My wonderful header", customHeader); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3667ResolveDepsWithBadPomVersionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3667ResolveDepsWithBadPomVersionTest.java index 6979002096..485063b159 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3667ResolveDepsWithBadPomVersionTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3667ResolveDepsWithBadPomVersionTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -34,13 +32,10 @@ import org.junit.jupiter.api.Test; * @author jdcasey * */ -public class MavenITmng3667ResolveDepsWithBadPomVersionTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3667ResolveDepsWithBadPomVersionTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3667ResolveDepsWithBadPomVersionTest() - { - super( "[2.0.3,)" ); + public MavenITmng3667ResolveDepsWithBadPomVersionTest() { + super("[2.0.3,)"); } /** @@ -50,24 +45,21 @@ public class MavenITmng3667ResolveDepsWithBadPomVersionTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3667" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3667"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng3667" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng3667"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List cp = verifier.loadLines( "target/classpath.txt", "UTF-8" ); - assertTrue( cp.toString(), cp.contains( "dep-0.1.jar" ) ); + List cp = verifier.loadLines("target/classpath.txt", "UTF-8"); + assertTrue(cp.toString(), cp.contains("dep-0.1.jar")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3671PluginLevelDepInterpolationTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3671PluginLevelDepInterpolationTest.java index 4d81b553f5..7df5e2d5c5 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3671PluginLevelDepInterpolationTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3671PluginLevelDepInterpolationTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -37,25 +35,20 @@ import org.junit.jupiter.api.Test; * @author jdcasey * */ -public class MavenITmng3671PluginLevelDepInterpolationTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng3671PluginLevelDepInterpolationTest() - { - super( "(2.0.8,)" ); // only test in 2.0.9+ +public class MavenITmng3671PluginLevelDepInterpolationTest extends AbstractMavenIntegrationTestCase { + public MavenITmng3671PluginLevelDepInterpolationTest() { + super("(2.0.8,)"); // only test in 2.0.9+ } @Test - public void testitMNG3671 () - throws Exception - { + public void testitMNG3671() throws Exception { // The testdir is computed from the location of this // file. - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3671" ); + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3671"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); - verifier.addCliArgument( "compile" ); + verifier.addCliArgument("compile"); verifier.execute(); /* diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3679PluginExecIdInterpolationTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3679PluginExecIdInterpolationTest.java index e6a8b0c9b3..bdeed493f8 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3679PluginExecIdInterpolationTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3679PluginExecIdInterpolationTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,29 +31,23 @@ import org.junit.jupiter.api.Test; * * @author jdcasey */ -public class MavenITmng3679PluginExecIdInterpolationTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3679PluginExecIdInterpolationTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3679PluginExecIdInterpolationTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng3679PluginExecIdInterpolationTest() { + super(ALL_MAVEN_VERSIONS); } @Test - public void testitMNG3679 () - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3679" ); + public void testitMNG3679() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3679"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/check.txt" ); + verifier.verifyFilePresent("target/check.txt"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3680InvalidDependencyPOMTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3680InvalidDependencyPOMTest.java index c4ca7565e7..1fe7007bc4 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3680InvalidDependencyPOMTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3680InvalidDependencyPOMTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author jdcasey */ -public class MavenITmng3680InvalidDependencyPOMTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3680InvalidDependencyPOMTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3680InvalidDependencyPOMTest() - { - super( "(2.0.9,)" ); + public MavenITmng3680InvalidDependencyPOMTest() { + super("(2.0.9,)"); } /** @@ -47,25 +42,22 @@ public class MavenITmng3680InvalidDependencyPOMTest * @throws Exception in case of failure */ @Test - public void testitMNG3680 () - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3680" ); + public void testitMNG3680() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3680"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng3680" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng3680"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List artifacts = verifier.loadLines( "target/artifacts.txt", "UTF-8" ); - assertTrue( artifacts.toString(), artifacts.contains( "org.apache.maven.its.mng3680:direct:jar:0.1" ) ); - assertTrue( artifacts.toString(), artifacts.contains( "org.apache.maven.its.mng3680:transitive:jar:0.1" ) ); + List artifacts = verifier.loadLines("target/artifacts.txt", "UTF-8"); + assertTrue(artifacts.toString(), artifacts.contains("org.apache.maven.its.mng3680:direct:jar:0.1")); + assertTrue(artifacts.toString(), artifacts.contains("org.apache.maven.its.mng3680:transitive:jar:0.1")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3684BuildPluginParameterTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3684BuildPluginParameterTest.java index adb04476c0..6eac610d0c 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3684BuildPluginParameterTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3684BuildPluginParameterTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,37 +31,32 @@ import org.junit.jupiter.api.Test; * * @author jdcasey */ -public class MavenITmng3684BuildPluginParameterTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng3684BuildPluginParameterTest() - { - super( "(2.0.9,)" ); +public class MavenITmng3684BuildPluginParameterTest extends AbstractMavenIntegrationTestCase { + public MavenITmng3684BuildPluginParameterTest() { + super("(2.0.9,)"); } @Test - public void testitMNG3684 () - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3684" ); - File pluginDir = new File( testDir, "maven-mng3684-plugin" ); - File projectDir = new File( testDir, "project" ); + public void testitMNG3684() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3684"); + File pluginDir = new File(testDir, "maven-mng3684-plugin"); + File projectDir = new File(testDir, "project"); - Verifier verifier = newVerifier( pluginDir.getAbsolutePath(), "remote" ); - verifier.addCliArgument( "install" ); + Verifier verifier = newVerifier(pluginDir.getAbsolutePath(), "remote"); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier = newVerifier( projectDir.getAbsolutePath(), "remote" ); - verifier.setLogFileName( "log-validate.txt" ); - verifier.addCliArgument( "validate" ); + verifier = newVerifier(projectDir.getAbsolutePath(), "remote"); + verifier.setLogFileName("log-validate.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.setLogFileName( "log-site.txt" ); - verifier.addCliArgument( "site" ); + verifier.setLogFileName("log-site.txt"); + verifier.addCliArgument("site"); verifier.execute(); verifier.verifyErrorFreeLog(); diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3693PomFileBasedirChangeTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3693PomFileBasedirChangeTest.java index 9da0c6e5cd..d65a6edd2a 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3693PomFileBasedirChangeTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3693PomFileBasedirChangeTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import org.apache.maven.shared.utils.io.FileUtils; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -36,44 +34,38 @@ import org.junit.jupiter.api.Test; * * @author jdcasey */ -public class MavenITmng3693PomFileBasedirChangeTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng3693PomFileBasedirChangeTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenITmng3693PomFileBasedirChangeTest extends AbstractMavenIntegrationTestCase { + public MavenITmng3693PomFileBasedirChangeTest() { + super(ALL_MAVEN_VERSIONS); } @Test - public void testitMNG3693 () - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3693" ); + public void testitMNG3693() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3693"); - File pluginDir = new File( testDir, "maven-mng3693-plugin" ); - File projectsDir = new File( testDir, "projects" ); + File pluginDir = new File(testDir, "maven-mng3693-plugin"); + File projectsDir = new File(testDir, "projects"); - Verifier verifier = newVerifier( pluginDir.getAbsolutePath(), "remote" ); + Verifier verifier = newVerifier(pluginDir.getAbsolutePath(), "remote"); - verifier.addCliArgument( "install" ); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); - String depPath = verifier.getArtifactPath( "org.apache.maven.its.mng3693", "dep", "1", "pom" ); + String depPath = verifier.getArtifactPath("org.apache.maven.its.mng3693", "dep", "1", "pom"); - File dep = new File( depPath ); + File dep = new File(depPath); dep = dep.getParentFile().getParentFile(); // remove the dependency from the local repository. - FileUtils.deleteDirectory( dep ); + FileUtils.deleteDirectory(dep); - verifier = newVerifier( projectsDir.getAbsolutePath() ); + verifier = newVerifier(projectsDir.getAbsolutePath()); - verifier.addCliArgument( "package" ); + verifier.addCliArgument("package"); verifier.execute(); verifier.verifyErrorFreeLog(); - } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3694ReactorProjectsDynamismTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3694ReactorProjectsDynamismTest.java index d7d3397c7d..92308df210 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3694ReactorProjectsDynamismTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3694ReactorProjectsDynamismTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,32 +31,27 @@ import org.junit.jupiter.api.Test; * * @author jdcasey */ -public class MavenITmng3694ReactorProjectsDynamismTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng3694ReactorProjectsDynamismTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenITmng3694ReactorProjectsDynamismTest extends AbstractMavenIntegrationTestCase { + public MavenITmng3694ReactorProjectsDynamismTest() { + super(ALL_MAVEN_VERSIONS); } @Test - public void testitMNG3694 () - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3694" ); + public void testitMNG3694() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3694"); - File pluginDir = new File( testDir, "maven-mng3694-plugin" ); - File projectDir = new File( testDir, "projects" ); + File pluginDir = new File(testDir, "maven-mng3694-plugin"); + File projectDir = new File(testDir, "projects"); - Verifier verifier = newVerifier( pluginDir.getAbsolutePath(), "remote" ); + Verifier verifier = newVerifier(pluginDir.getAbsolutePath(), "remote"); - verifier.addCliArgument( "install" ); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier = newVerifier( projectDir.getAbsolutePath() ); + verifier = newVerifier(projectDir.getAbsolutePath()); - verifier.addCliArgument( "validate" ); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3701ImplicitProfileIdTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3701ImplicitProfileIdTest.java index a6247fde3e..bfb5beb66c 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3701ImplicitProfileIdTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3701ImplicitProfileIdTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3701ImplicitProfileIdTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3701ImplicitProfileIdTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3701ImplicitProfileIdTest() - { - super( "[2.0.11,)" ); + public MavenITmng3701ImplicitProfileIdTest() { + super("[2.0.11,)"); } /** @@ -48,18 +43,15 @@ public class MavenITmng3701ImplicitProfileIdTest * @throws Exception in case of failure */ @Test - public void testitMNG3701() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3701" ); + public void testitMNG3701() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3701"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3703ExecutionProjectWithRelativePathsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3703ExecutionProjectWithRelativePathsTest.java index d1c6a0b629..67d4cd9265 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3703ExecutionProjectWithRelativePathsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3703ExecutionProjectWithRelativePathsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -34,61 +32,54 @@ import org.junit.jupiter.api.Test; * @author Brian Fox * @author jdcasey */ -public class MavenITmng3703ExecutionProjectWithRelativePathsTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng3703ExecutionProjectWithRelativePathsTest() - { - super( "[2.1.0-M1,)" ); // only test in 2.1.0+ +public class MavenITmng3703ExecutionProjectWithRelativePathsTest extends AbstractMavenIntegrationTestCase { + public MavenITmng3703ExecutionProjectWithRelativePathsTest() { + super("[2.1.0-M1,)"); // only test in 2.1.0+ } @Test - public void testForkFromMojo() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3703" ); - File pluginDir = new File( testDir, "maven-mng3703-plugin" ); - File projectDir = new File( testDir, "project" ); + public void testForkFromMojo() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3703"); + File pluginDir = new File(testDir, "maven-mng3703-plugin"); + File projectDir = new File(testDir, "project"); Verifier verifier; - verifier = newVerifier( pluginDir.getAbsolutePath(), "remote" ); + verifier = newVerifier(pluginDir.getAbsolutePath(), "remote"); - verifier.addCliArgument( "install" ); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier = newVerifier( projectDir.getAbsolutePath() ); - verifier.setLogFileName( "log-mojo.txt" ); + verifier = newVerifier(projectDir.getAbsolutePath()); + verifier.setLogFileName("log-mojo.txt"); - verifier.addCliArgument( "package" ); + verifier.addCliArgument("package"); verifier.execute(); verifier.verifyErrorFreeLog(); } @Test - public void testForkFromReport() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3703" ); - File pluginDir = new File( testDir, "maven-mng3703-plugin" ); - File projectDir = new File( testDir, "project" ); + public void testForkFromReport() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3703"); + File pluginDir = new File(testDir, "maven-mng3703-plugin"); + File projectDir = new File(testDir, "project"); Verifier verifier; - verifier = newVerifier( pluginDir.getAbsolutePath(), "remote" ); + verifier = newVerifier(pluginDir.getAbsolutePath(), "remote"); - verifier.addCliArgument( "install" ); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier = newVerifier( projectDir.getAbsolutePath() ); - verifier.setLogFileName( "log-report.txt" ); + verifier = newVerifier(projectDir.getAbsolutePath()); + verifier.setLogFileName("log-report.txt"); - verifier.addCliArgument( "site" ); + verifier.addCliArgument("site"); verifier.execute(); verifier.verifyErrorFreeLog(); diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3710PollutedClonedPluginsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3710PollutedClonedPluginsTest.java index adf26e1655..490bd93848 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3710PollutedClonedPluginsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3710PollutedClonedPluginsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; -import java.util.ArrayList; -import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -37,66 +33,58 @@ import org.junit.jupiter.api.Test; * @author jdcasey * */ -public class MavenITmng3710PollutedClonedPluginsTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng3710PollutedClonedPluginsTest() - { - super( "(2.0.8,)" ); // only test in 2.0.9+ +public class MavenITmng3710PollutedClonedPluginsTest extends AbstractMavenIntegrationTestCase { + public MavenITmng3710PollutedClonedPluginsTest() { + super("(2.0.8,)"); // only test in 2.0.9+ } @Test - public void testitMNG3710_POMInheritance() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3710/pom-inheritance" ); - File pluginDir = new File( testDir, "maven-mng3710-pomInheritance-plugin" ); - File projectsDir = new File( testDir, "projects" ); + public void testitMNG3710_POMInheritance() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3710/pom-inheritance"); + File pluginDir = new File(testDir, "maven-mng3710-pomInheritance-plugin"); + File projectsDir = new File(testDir, "projects"); Verifier verifier; - verifier = newVerifier( pluginDir.getAbsolutePath(), "remote" ); - verifier.addCliArgument( "install" ); + verifier = newVerifier(pluginDir.getAbsolutePath(), "remote"); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier = newVerifier( projectsDir.getAbsolutePath() ); - verifier.addCliArgument( "validate" ); + verifier = newVerifier(projectsDir.getAbsolutePath()); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - File topLevelTouchFile = new File( projectsDir, "target/touch.txt" ); - assertFalse( "Top-level touch file should NOT be created in projects tree.", topLevelTouchFile.exists() ); + File topLevelTouchFile = new File(projectsDir, "target/touch.txt"); + assertFalse("Top-level touch file should NOT be created in projects tree.", topLevelTouchFile.exists()); - File midLevelTouchFile = new File( projectsDir, "middle/target/touch.txt" ); - assertTrue( "Mid-level touch file should have been created in projects tree.", midLevelTouchFile.exists() ); - - File childLevelTouchFile = new File( projectsDir, "middle/child/target/touch.txt" ); - assertTrue( "Child-level touch file should have been created in projects tree.", childLevelTouchFile.exists() ); + File midLevelTouchFile = new File(projectsDir, "middle/target/touch.txt"); + assertTrue("Mid-level touch file should have been created in projects tree.", midLevelTouchFile.exists()); + File childLevelTouchFile = new File(projectsDir, "middle/child/target/touch.txt"); + assertTrue("Child-level touch file should have been created in projects tree.", childLevelTouchFile.exists()); } @Test - public void testitMNG3710_OriginalModel() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3710/original-model" ); - File pluginsDir = new File( testDir, "plugins" ); - File projectDir = new File( testDir, "project" ); + public void testitMNG3710_OriginalModel() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3710/original-model"); + File pluginsDir = new File(testDir, "plugins"); + File projectDir = new File(testDir, "project"); Verifier verifier; - verifier = newVerifier( pluginsDir.getAbsolutePath(), "remote" ); - verifier.addCliArgument( "install" ); + verifier = newVerifier(pluginsDir.getAbsolutePath(), "remote"); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier = newVerifier( projectDir.getAbsolutePath() ); + verifier = newVerifier(projectDir.getAbsolutePath()); - verifier.addCliArguments( "org.apache.maven.its.mng3710:mavenit-mng3710-directInvoke-plugin:1:run", "validate" ); + verifier.addCliArguments("org.apache.maven.its.mng3710:mavenit-mng3710-directInvoke-plugin:1:run", "validate"); verifier.execute(); diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3714ToolchainsCliOptionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3714ToolchainsCliOptionTest.java index 4544696fc1..1b8299e5c5 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3714ToolchainsCliOptionTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3714ToolchainsCliOptionTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Map; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -34,12 +32,9 @@ import org.junit.jupiter.api.Test; * @author Brett Porter * */ -public class MavenITmng3714ToolchainsCliOptionTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng3714ToolchainsCliOptionTest() - { - super( "[2.3.0,)" ); +public class MavenITmng3714ToolchainsCliOptionTest extends AbstractMavenIntegrationTestCase { + public MavenITmng3714ToolchainsCliOptionTest() { + super("[2.3.0,)"); } /** @@ -48,44 +43,40 @@ public class MavenITmng3714ToolchainsCliOptionTest * @throws Exception in case of failure */ @Test - public void testitMNG3714() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3714" ); + public void testitMNG3714() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3714"); - File javaHome = new File( testDir, "javaHome" ); + File javaHome = new File(testDir, "javaHome"); javaHome.mkdirs(); - new File( javaHome, "bin" ).mkdirs(); - new File( javaHome, "bin/javac").createNewFile(); - new File( javaHome, "bin/javac.exe").createNewFile(); + new File(javaHome, "bin").mkdirs(); + new File(javaHome, "bin/javac").createNewFile(); + new File(javaHome, "bin/javac.exe").createNewFile(); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); Map properties = verifier.newDefaultFilterMap(); - properties.put( "@javaHome@", javaHome.getAbsolutePath() ); + properties.put("@javaHome@", javaHome.getAbsolutePath()); - verifier.filterFile( "toolchains.xml", "toolchains.xml", "UTF-8", properties ); + verifier.filterFile("toolchains.xml", "toolchains.xml", "UTF-8", properties); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "--toolchains" ); - verifier.addCliArgument( "toolchains.xml" ); - verifier.addCliArgument( "initialize" ); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("--toolchains"); + verifier.addCliArgument("toolchains.xml"); + verifier.addCliArgument("initialize"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/toolchains.properties" ); - Properties results = verifier.loadProperties( "target/toolchains.properties" ); - String tool = results.getProperty( "tool.1", "" ); - if ( tool.endsWith( ".exe" ) ) - { - tool = tool.substring( 0, tool.length() - 4 ); + verifier.verifyFilePresent("target/toolchains.properties"); + Properties results = verifier.loadProperties("target/toolchains.properties"); + String tool = results.getProperty("tool.1", ""); + if (tool.endsWith(".exe")) { + tool = tool.substring(0, tool.length() - 4); } - assertEquals( new File( javaHome, "bin/javac" ).getAbsolutePath(), tool ); + assertEquals(new File(javaHome, "bin/javac").getAbsolutePath(), tool); - verifier.verifyFilePresent( "target/tool.properties" ); - Properties toolProps = verifier.loadProperties( "target/tool.properties" ); - String path = toolProps.getProperty( "tool.javac", "" ); - assertEquals( results.getProperty( "tool.1", "" ), path ); + verifier.verifyFilePresent("target/tool.properties"); + Properties toolProps = verifier.loadProperties("target/tool.properties"); + String path = toolProps.getProperty("tool.javac", ""); + assertEquals(results.getProperty("tool.1", ""), path); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3716AggregatorForkingTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3716AggregatorForkingTest.java index 020a8e0bec..25eeb40942 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3716AggregatorForkingTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3716AggregatorForkingTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -35,32 +33,27 @@ import org.junit.jupiter.api.Test; * @author jdcasey * */ -public class MavenITmng3716AggregatorForkingTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng3716AggregatorForkingTest() - { - super( "(2.0.8,)" ); // only test in 2.0.9+ +public class MavenITmng3716AggregatorForkingTest extends AbstractMavenIntegrationTestCase { + public MavenITmng3716AggregatorForkingTest() { + super("(2.0.8,)"); // only test in 2.0.9+ } @Test - public void testitMNG3716() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3716" ); - File pluginDir = new File( testDir, "maven-mng3716-plugin" ); - File projectsDir = new File( testDir, "projects" ); + public void testitMNG3716() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3716"); + File pluginDir = new File(testDir, "maven-mng3716-plugin"); + File projectsDir = new File(testDir, "projects"); Verifier verifier; - verifier = newVerifier( pluginDir.getAbsolutePath(), "remote" ); - verifier.addCliArgument( "install" ); + verifier = newVerifier(pluginDir.getAbsolutePath(), "remote"); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier = newVerifier( projectsDir.getAbsolutePath() ); - verifier.addCliArgument( "org.apache.maven.its.mng3716:mavenit-mng3716-plugin:1:run" ); + verifier = newVerifier(projectsDir.getAbsolutePath()); + verifier.addCliArgument("org.apache.maven.its.mng3716:mavenit-mng3716-plugin:1:run"); verifier.execute(); verifier.verifyErrorFreeLog(); diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3719PomExecutionOrderingTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3719PomExecutionOrderingTest.java index 15dde96a0b..775bc360e7 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3719PomExecutionOrderingTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3719PomExecutionOrderingTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,15 +16,15 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -35,13 +33,10 @@ import org.junit.jupiter.api.Test; * @author Brett Porter * */ -public class MavenITmng3719PomExecutionOrderingTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3719PomExecutionOrderingTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3719PomExecutionOrderingTest() - { - super( "[2.0.11,2.1.0-M1),[2.1.0-M2,4.0.0-alpha-1)" ); + public MavenITmng3719PomExecutionOrderingTest() { + super("[2.0.11,2.1.0-M1),[2.1.0-M2,4.0.0-alpha-1)"); } /** @@ -50,37 +45,33 @@ public class MavenITmng3719PomExecutionOrderingTest * @throws Exception in case of failure */ @Test - public void testitMNG3719() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3719" ); + public void testitMNG3719() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3719"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Pattern pattern = Pattern.compile( ".*step-([0-9])\\.properties.*" ); + Pattern pattern = Pattern.compile(".*step-([0-9])\\.properties.*"); int[] stepLines = new int[3]; - List content = verifier.loadFile( verifier.getBasedir(), verifier.getLogFileName(), false ); - for ( int i = 0; i < content.size(); i++ ) - { - String line = (String) content.get( i ); + List content = verifier.loadFile(verifier.getBasedir(), verifier.getLogFileName(), false); + for (int i = 0; i < content.size(); i++) { + String line = (String) content.get(i); - Matcher m = pattern.matcher( line ); - if ( m.matches() ) - { - int step = Integer.valueOf( m.group( 1 ) ); + Matcher m = pattern.matcher(line); + if (m.matches()) { + int step = Integer.valueOf(m.group(1)); stepLines[step - 1] = i + 1; } } // check order - note it is not in sequence as the plugin definitions are merged - assertTrue( "Step 1 should be found", stepLines[0] > 0 ); - assertTrue( "Step 3 should be second", stepLines[0] < stepLines[2] ); - assertTrue( "Step 2 should be third", stepLines[2] < stepLines[1] ); + assertTrue("Step 1 should be found", stepLines[0] > 0); + assertTrue("Step 3 should be second", stepLines[0] < stepLines[2]); + assertTrue("Step 2 should be third", stepLines[2] < stepLines[1]); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3723ConcreteParentProjectTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3723ConcreteParentProjectTest.java index 92f7c1435b..0183c9f4c7 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3723ConcreteParentProjectTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3723ConcreteParentProjectTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -38,35 +36,30 @@ import org.junit.jupiter.api.Test; * @author jdcasey * */ -public class MavenITmng3723ConcreteParentProjectTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng3723ConcreteParentProjectTest() - { - super( "(2.0.8,)" ); // only test in 2.0.9+ +public class MavenITmng3723ConcreteParentProjectTest extends AbstractMavenIntegrationTestCase { + public MavenITmng3723ConcreteParentProjectTest() { + super("(2.0.8,)"); // only test in 2.0.9+ } @Test - public void testitMNG3723 () - throws Exception - { + public void testitMNG3723() throws Exception { // The testdir is computed from the location of this // file. - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3723" ); - File pluginDir = new File( testDir, "maven-mng3723-plugin" ); - File projectDir = new File( testDir, "projects" ); + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3723"); + File pluginDir = new File(testDir, "maven-mng3723-plugin"); + File projectDir = new File(testDir, "projects"); Verifier verifier; - verifier = newVerifier( pluginDir.getAbsolutePath(), "remote" ); + verifier = newVerifier(pluginDir.getAbsolutePath(), "remote"); - verifier.addCliArgument( "install" ); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier = newVerifier( projectDir.getAbsolutePath() ); + verifier = newVerifier(projectDir.getAbsolutePath()); - verifier.addCliArgument( "validate" ); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3724ExecutionProjectSyncTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3724ExecutionProjectSyncTest.java index 8ba7f56b26..a66eda0225 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3724ExecutionProjectSyncTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3724ExecutionProjectSyncTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -35,33 +33,28 @@ import org.junit.jupiter.api.Test; * @author jdcasey * */ -public class MavenITmng3724ExecutionProjectSyncTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng3724ExecutionProjectSyncTest() - { - super( "(2.0.8,)" ); // only test in 2.0.9+ +public class MavenITmng3724ExecutionProjectSyncTest extends AbstractMavenIntegrationTestCase { + public MavenITmng3724ExecutionProjectSyncTest() { + super("(2.0.8,)"); // only test in 2.0.9+ } @Test - public void testitMNG3724 () - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3724" ); - File pluginDir = new File( testDir, "maven-mng3724-plugin" ); - File projectDir = new File( testDir, "project" ); + public void testitMNG3724() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3724"); + File pluginDir = new File(testDir, "maven-mng3724-plugin"); + File projectDir = new File(testDir, "project"); Verifier verifier; - verifier = newVerifier( pluginDir.getAbsolutePath(), "remote" ); + verifier = newVerifier(pluginDir.getAbsolutePath(), "remote"); - verifier.addCliArgument( "install" ); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier = newVerifier( projectDir.getAbsolutePath() ); + verifier = newVerifier(projectDir.getAbsolutePath()); - verifier.addCliArgument( "package" ); + verifier.addCliArgument("package"); verifier.execute(); verifier.verifyErrorFreeLog(); } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3729MultiForkAggregatorsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3729MultiForkAggregatorsTest.java index 93cee3cf5b..4f1ac7932e 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3729MultiForkAggregatorsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3729MultiForkAggregatorsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -49,33 +47,28 @@ import org.junit.jupiter.api.Test; * @author Brian Fox * @author jdcasey */ -public class MavenITmng3729MultiForkAggregatorsTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng3729MultiForkAggregatorsTest() - { - super( "(2.0.8,3.0-alpha-1),[3.0-alpha-3,)" ); // only test in 2.0.9+ +public class MavenITmng3729MultiForkAggregatorsTest extends AbstractMavenIntegrationTestCase { + public MavenITmng3729MultiForkAggregatorsTest() { + super("(2.0.8,3.0-alpha-1),[3.0-alpha-3,)"); // only test in 2.0.9+ } @Test - public void testitMNG3729 () - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3729" ); - File pluginDir = new File( testDir, "maven-mng3729-plugin" ); - File projectDir = new File( testDir, "projects" ); + public void testitMNG3729() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3729"); + File pluginDir = new File(testDir, "maven-mng3729-plugin"); + File projectDir = new File(testDir, "projects"); Verifier verifier; - verifier = newVerifier( pluginDir.getAbsolutePath(), "remote" ); + verifier = newVerifier(pluginDir.getAbsolutePath(), "remote"); - verifier.addCliArgument( "install" ); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier = newVerifier( projectDir.getAbsolutePath() ); + verifier = newVerifier(projectDir.getAbsolutePath()); - verifier.addCliArgument( "package" ); + verifier.addCliArgument("package"); verifier.execute(); verifier.verifyErrorFreeLog(); } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3732ActiveProfilesTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3732ActiveProfilesTest.java index 164972fd75..8a4e511a74 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3732ActiveProfilesTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3732ActiveProfilesTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,9 +16,7 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.ArrayList; @@ -29,6 +25,8 @@ import java.util.Collections; import java.util.List; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -36,13 +34,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng3732ActiveProfilesTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3732ActiveProfilesTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3732ActiveProfilesTest() - { - super( "[2.0,)" ); + public MavenITmng3732ActiveProfilesTest() { + super("[2.0,)"); } /** @@ -51,62 +46,53 @@ public class MavenITmng3732ActiveProfilesTest * @throws Exception in case of failure */ @Test - public void testitMNG3732() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3732" ); + public void testitMNG3732() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3732"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - if ( matchesVersionRange( "[4.0.0-alpha-1,)" ) ) - { - verifier.addCliArgument( "-Ppom,settings" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + if (matchesVersionRange("[4.0.0-alpha-1,)")) { + verifier.addCliArgument("-Ppom,settings"); + } else { + verifier.addCliArgument("-Ppom,profiles,settings"); } - else - { - verifier.addCliArgument( "-Ppom,profiles,settings" ); - } - verifier.addCliArgument( "validate" ); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/profile.properties" ); + Properties props = verifier.loadProperties("target/profile.properties"); List ids = new ArrayList<>(); // support for profiles.xml removed from 3.x (see MNG-4060) - if ( matchesVersionRange( "[2.0,3.0-alpha-1)" ) ) - { - ids.add( props.getProperty( "project.activeProfiles.0.id", "" ) ); - ids.add( props.getProperty( "project.activeProfiles.1.id", "" ) ); - ids.add( props.getProperty( "project.activeProfiles.2.id", "" ) ); - ids.add( props.getProperty( "project.activeProfiles.3.id", "" ) ); - ids.remove( "it-defaults" ); - Collections.sort( ids ); + if (matchesVersionRange("[2.0,3.0-alpha-1)")) { + ids.add(props.getProperty("project.activeProfiles.0.id", "")); + ids.add(props.getProperty("project.activeProfiles.1.id", "")); + ids.add(props.getProperty("project.activeProfiles.2.id", "")); + ids.add(props.getProperty("project.activeProfiles.3.id", "")); + ids.remove("it-defaults"); + Collections.sort(ids); - assertEquals( Arrays.asList( new String[]{ "pom", "profiles", "settings" } ), ids ); - assertEquals( "4", props.getProperty( "project.activeProfiles" ) ); + assertEquals(Arrays.asList(new String[] {"pom", "profiles", "settings"}), ids); + assertEquals("4", props.getProperty("project.activeProfiles")); - assertEquals( "PASSED-1", props.getProperty( "project.properties.pomProperty" ) ); - assertEquals( "PASSED-2", props.getProperty( "project.properties.settingsProperty" ) ); - assertEquals( "PASSED-3", props.getProperty( "project.properties.profilesProperty" ) ); - } - else - { - ids.add( props.getProperty( "project.activeProfiles.0.id", "" ) ); - ids.add( props.getProperty( "project.activeProfiles.1.id", "" ) ); - ids.add( props.getProperty( "project.activeProfiles.2.id", "" ) ); - ids.remove( "it-defaults" ); - Collections.sort( ids ); + assertEquals("PASSED-1", props.getProperty("project.properties.pomProperty")); + assertEquals("PASSED-2", props.getProperty("project.properties.settingsProperty")); + assertEquals("PASSED-3", props.getProperty("project.properties.profilesProperty")); + } else { + ids.add(props.getProperty("project.activeProfiles.0.id", "")); + ids.add(props.getProperty("project.activeProfiles.1.id", "")); + ids.add(props.getProperty("project.activeProfiles.2.id", "")); + ids.remove("it-defaults"); + Collections.sort(ids); - assertEquals( Arrays.asList( new String[]{ "pom", "settings" } ), ids ); - assertEquals( "3", props.getProperty( "project.activeProfiles" ) ); + assertEquals(Arrays.asList(new String[] {"pom", "settings"}), ids); + assertEquals("3", props.getProperty("project.activeProfiles")); - assertEquals( "PASSED-1", props.getProperty( "project.properties.pomProperty" ) ); - assertEquals( "PASSED-2", props.getProperty( "project.properties.settingsProperty" ) ); + assertEquals("PASSED-1", props.getProperty("project.properties.pomProperty")); + assertEquals("PASSED-2", props.getProperty("project.properties.settingsProperty")); } } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3740SelfReferentialReactorProjectsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3740SelfReferentialReactorProjectsTest.java index 2f3f3fbb65..8e54102376 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3740SelfReferentialReactorProjectsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3740SelfReferentialReactorProjectsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -37,33 +35,27 @@ import org.junit.jupiter.api.Test; * @author jdcasey * */ -public class MavenITmng3740SelfReferentialReactorProjectsTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng3740SelfReferentialReactorProjectsTest() - { - super( "(2.0.8,)" ); // only test in 2.0.9+ +public class MavenITmng3740SelfReferentialReactorProjectsTest extends AbstractMavenIntegrationTestCase { + public MavenITmng3740SelfReferentialReactorProjectsTest() { + super("(2.0.8,)"); // only test in 2.0.9+ } @Test - public void testitMNG3740 () - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3740" ); - File v1 = new File( testDir, "projects.v1" ); - File v2 = new File( testDir, "projects.v2" ); + public void testitMNG3740() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3740"); + File v1 = new File(testDir, "projects.v1"); + File v2 = new File(testDir, "projects.v2"); Verifier verifier; - verifier = newVerifier( v1.getAbsolutePath(), "remote" ); - verifier.addCliArgument( "install" ); + verifier = newVerifier(v1.getAbsolutePath(), "remote"); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier = newVerifier( v2.getAbsolutePath() ); - verifier.addCliArgument( "package" ); + verifier = newVerifier(v2.getAbsolutePath()); + verifier.addCliArgument("package"); verifier.execute(); verifier.verifyErrorFreeLog(); - } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3746POMPropertyOverrideTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3746POMPropertyOverrideTest.java index 7843b11360..e0f44310ff 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3746POMPropertyOverrideTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3746POMPropertyOverrideTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -34,65 +32,58 @@ import org.junit.jupiter.api.Test; * @author Brian Fox * @author jdcasey */ -public class MavenITmng3746POMPropertyOverrideTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng3746POMPropertyOverrideTest() - { - super( "(2.0.8,)" ); // only test in 2.0.9+ +public class MavenITmng3746POMPropertyOverrideTest extends AbstractMavenIntegrationTestCase { + public MavenITmng3746POMPropertyOverrideTest() { + super("(2.0.8,)"); // only test in 2.0.9+ } @Test - public void testitMNG3746_UsingDefaultSystemProperty() - throws Exception - { + public void testitMNG3746_UsingDefaultSystemProperty() throws Exception { // The testdir is computed from the location of this // file. - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3746" ); - File pluginDir = new File( testDir, "maven-mng3746-plugin" ); - File projectDir = new File( testDir, "project" ); + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3746"); + File pluginDir = new File(testDir, "maven-mng3746-plugin"); + File projectDir = new File(testDir, "project"); Verifier verifier; - verifier = newVerifier( pluginDir.getAbsolutePath(), "remote" ); - verifier.setLogFileName( "log-sys.txt" ); - verifier.addCliArgument( "install" ); + verifier = newVerifier(pluginDir.getAbsolutePath(), "remote"); + verifier.setLogFileName("log-sys.txt"); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier = newVerifier( projectDir.getAbsolutePath() ); - verifier.setLogFileName( "log-sys.txt" ); - verifier.addCliArgument( "validate" ); + verifier = newVerifier(projectDir.getAbsolutePath()); + verifier.setLogFileName("log-sys.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); } @Test - public void testitMNG3746_UsingCLIProperty() - throws Exception - { + public void testitMNG3746_UsingCLIProperty() throws Exception { // The testdir is computed from the location of this // file. - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3746" ); - File pluginDir = new File( testDir, "maven-mng3746-plugin" ); - File projectDir = new File( testDir, "project" ); + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3746"); + File pluginDir = new File(testDir, "maven-mng3746-plugin"); + File projectDir = new File(testDir, "project"); Verifier verifier; - verifier = newVerifier( pluginDir.getAbsolutePath(), "remote" ); - verifier.setLogFileName( "log-cli.txt" ); - verifier.addCliArgument( "install" ); + verifier = newVerifier(pluginDir.getAbsolutePath(), "remote"); + verifier.setLogFileName("log-cli.txt"); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier = newVerifier( projectDir.getAbsolutePath() ); - verifier.setLogFileName( "log-cli.txt" ); + verifier = newVerifier(projectDir.getAbsolutePath()); + verifier.setLogFileName("log-cli.txt"); - verifier.addCliArgument( "-Dtest.verification=cli" ); - verifier.addCliArgument( "-Dtest.usingCliValue=true" ); - verifier.addCliArgument( "-Djava.version=cli" ); + verifier.addCliArgument("-Dtest.verification=cli"); + verifier.addCliArgument("-Dtest.usingCliValue=true"); + verifier.addCliArgument("-Djava.version=cli"); - verifier.addCliArgument( "validate" ); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3747PrefixedPathExpressionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3747PrefixedPathExpressionTest.java index e8a0eb36ee..6d0445cebd 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3747PrefixedPathExpressionTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3747PrefixedPathExpressionTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -36,30 +34,25 @@ import org.junit.jupiter.api.Test; * @author jdcasey * */ -public class MavenITmng3747PrefixedPathExpressionTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng3747PrefixedPathExpressionTest() - { - super( "(2.0.8,)" ); // only test in 2.0.9+ +public class MavenITmng3747PrefixedPathExpressionTest extends AbstractMavenIntegrationTestCase { + public MavenITmng3747PrefixedPathExpressionTest() { + super("(2.0.8,)"); // only test in 2.0.9+ } @Test - public void testitMNG3747 () - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3747" ); + public void testitMNG3747() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3747"); - Verifier verifier = newVerifier( testDir.getCanonicalPath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getCanonicalPath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/config.properties" ); - assertEquals( "path is: " + new File( testDir, "relative" ).getCanonicalPath() + "/somepath", - props.getProperty( "stringParam" ) ); + Properties props = verifier.loadProperties("target/config.properties"); + assertEquals( + "path is: " + new File(testDir, "relative").getCanonicalPath() + "/somepath", + props.getProperty("stringParam")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3748BadSettingsXmlTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3748BadSettingsXmlTest.java index 5e7aa9948d..93b69c9a19 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3748BadSettingsXmlTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3748BadSettingsXmlTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -37,60 +35,46 @@ import org.junit.jupiter.api.Test; * @author jdcasey * */ -public class MavenITmng3748BadSettingsXmlTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3748BadSettingsXmlTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3748BadSettingsXmlTest() - { - super( "(2.0.8,)" ); // only test in 2.0.9+ + public MavenITmng3748BadSettingsXmlTest() { + super("(2.0.8,)"); // only test in 2.0.9+ } @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3748" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3748"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); // Maven 3.x will only print warnings (see MNG-4390) - if ( matchesVersionRange( "(,3.0-alpha-3)" ) ) - { - try - { - verifier.addCliArgument( "validate" ); + if (matchesVersionRange("(,3.0-alpha-3)")) { + try { + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - fail( "build should fail if settings.xml contains unrecognized elements." ); - } - catch ( VerificationException e ) - { + fail("build should fail if settings.xml contains unrecognized elements."); + } catch (VerificationException e) { // expected } - } - else - { - verifier.addCliArgument( "validate" ); + } else { + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List lines = verifier.loadLines( verifier.getLogFileName(), null ); + List lines = verifier.loadLines(verifier.getLogFileName(), null); boolean foundWarning = false; - for ( String line : lines ) - { - if ( line.matches( "(?i)\\[WARNING\\].*unrecognised tag.+repositories.+2.*" ) ) - { + for (String line : lines) { + if (line.matches("(?i)\\[WARNING\\].*unrecognised tag.+repositories.+2.*")) { foundWarning = true; break; } } - assertTrue( foundWarning ); + assertTrue(foundWarning); } } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3766ToolchainsFromExtensionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3766ToolchainsFromExtensionTest.java index 66baf4ea61..0c3deae875 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3766ToolchainsFromExtensionTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3766ToolchainsFromExtensionTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng3766ToolchainsFromExtensionTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3766ToolchainsFromExtensionTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3766ToolchainsFromExtensionTest() - { - super( "[3.0-alpha-3,)" ); + public MavenITmng3766ToolchainsFromExtensionTest() { + super("[3.0-alpha-3,)"); } /** @@ -47,23 +42,20 @@ public class MavenITmng3766ToolchainsFromExtensionTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3766" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3766"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "--toolchains" ); - verifier.addCliArgument( "toolchains.xml" ); - verifier.addCliArgument( "initialize" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("--toolchains"); + verifier.addCliArgument("toolchains.xml"); + verifier.addCliArgument("initialize"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/tool.properties" ); - Properties toolProps = verifier.loadProperties( "target/tool.properties" ); - assertEquals( "toolname", toolProps.getProperty( "tool.toolname", "" ) ); + verifier.verifyFilePresent("target/tool.properties"); + Properties toolProps = verifier.loadProperties("target/tool.properties"); + assertEquals("toolname", toolProps.getProperty("tool.toolname", "")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3769ExclusionRelocatedTransdepsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3769ExclusionRelocatedTransdepsTest.java index 437ff05aa5..64c4d38ca1 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3769ExclusionRelocatedTransdepsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3769ExclusionRelocatedTransdepsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Collections; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,12 +31,9 @@ import org.junit.jupiter.api.Test; * * */ -public class MavenITmng3769ExclusionRelocatedTransdepsTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3769ExclusionRelocatedTransdepsTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3769ExclusionRelocatedTransdepsTest() - { + public MavenITmng3769ExclusionRelocatedTransdepsTest() { // also didn't work in 2.0, but did in 2.0.1+ until regressed in 2.1.0-M1 super("[2.0.1,2.1.0-M1),(2.1.0-M1,)"); } @@ -49,28 +44,25 @@ public class MavenITmng3769ExclusionRelocatedTransdepsTest * @throws Exception in case of failure */ @Test - public void testitMNG3769() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3769" ); + public void testitMNG3769() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3769"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng3769" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng3769"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List artifacts = verifier.loadLines( "target/artifacts.txt", "UTF-8" ); - assertEquals( Collections.singletonList( "org.apache.maven.its.mng3769:dependency:jar:1.0" ), artifacts ); + List artifacts = verifier.loadLines("target/artifacts.txt", "UTF-8"); + assertEquals(Collections.singletonList("org.apache.maven.its.mng3769:dependency:jar:1.0"), artifacts); - List paths = verifier.loadLines( "target/test.txt", "UTF-8" ); - assertEquals( 3, paths.size() ); - assertEquals( "dependency-1.0.jar", paths.get( 2 ) ); + List paths = verifier.loadLines("target/test.txt", "UTF-8"); + assertEquals(3, paths.size()); + assertEquals("dependency-1.0.jar", paths.get(2)); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3775ConflictResolutionBacktrackingTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3775ConflictResolutionBacktrackingTest.java index fcb1a40a4a..bfc174d34d 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3775ConflictResolutionBacktrackingTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3775ConflictResolutionBacktrackingTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,55 +30,40 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng3775ConflictResolutionBacktrackingTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3775ConflictResolutionBacktrackingTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3775ConflictResolutionBacktrackingTest() - { - super( "[3.0,)" ); + public MavenITmng3775ConflictResolutionBacktrackingTest() { + super("[3.0,)"); } @Test - public void testitABC() - throws Exception - { - testit( "test-abc" ); + public void testitABC() throws Exception { + testit("test-abc"); } @Test - public void testitACB() - throws Exception - { - testit( "test-acb" ); + public void testitACB() throws Exception { + testit("test-acb"); } @Test - public void testitBAC() - throws Exception - { - testit( "test-bac" ); + public void testitBAC() throws Exception { + testit("test-bac"); } @Test - public void testitBCA() - throws Exception - { - testit( "test-bca" ); + public void testitBCA() throws Exception { + testit("test-bca"); } @Test - public void testitCAB() - throws Exception - { - testit( "test-cab" ); + public void testitCAB() throws Exception { + testit("test-cab"); } @Test - public void testitCBA() - throws Exception - { - testit( "test-cba" ); + public void testitCBA() throws Exception { + testit("test-cba"); } /** @@ -88,28 +71,25 @@ public class MavenITmng3775ConflictResolutionBacktrackingTest * In other words, when a subtree gets disabled, all previously selected winners among the children need to * be revised. */ - private void testit( String project ) - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3775" ); + private void testit(String project) throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3775"); - Verifier verifier = newVerifier( new File( testDir, project ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng3775" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.filterFile( "../settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(new File(testDir, project).getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng3775"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.filterFile("../settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List test = verifier.loadLines( "target/test.txt", "UTF-8" ); + List test = verifier.loadLines("target/test.txt", "UTF-8"); - assertTrue( project + " > " + test.toString(), test.contains( "a-0.1.jar" ) ); - assertTrue( project + " > " + test.toString(), test.contains( "b-0.1.jar" ) ); - assertTrue( project + " > " + test.toString(), test.contains( "x-0.1.jar" ) ); - assertTrue( project + " > " + test.toString(), test.contains( "c-0.1.jar" ) ); + assertTrue(project + " > " + test.toString(), test.contains("a-0.1.jar")); + assertTrue(project + " > " + test.toString(), test.contains("b-0.1.jar")); + assertTrue(project + " > " + test.toString(), test.contains("x-0.1.jar")); + assertTrue(project + " > " + test.toString(), test.contains("c-0.1.jar")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3796ClassImportInconsistencyTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3796ClassImportInconsistencyTest.java index 0d856f3fb6..eb9737899f 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3796ClassImportInconsistencyTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3796ClassImportInconsistencyTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3796ClassImportInconsistencyTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3796ClassImportInconsistencyTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3796ClassImportInconsistencyTest() - { - super( "(2.0.2,)" ); + public MavenITmng3796ClassImportInconsistencyTest() { + super("(2.0.2,)"); } /** @@ -48,22 +43,19 @@ public class MavenITmng3796ClassImportInconsistencyTest * @throws Exception in case of failure */ @Test - public void testitMNG3796() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3796" ); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + public void testitMNG3796() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3796"); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties pclProps = verifier.loadProperties( "target/pcl.properties" ); - assertNotNull( pclProps.getProperty( "org.codehaus.plexus.util.xml.Xpp3Dom" ) ); + Properties pclProps = verifier.loadProperties("target/pcl.properties"); + assertNotNull(pclProps.getProperty("org.codehaus.plexus.util.xml.Xpp3Dom")); - Properties tcclProps = verifier.loadProperties( "target/tccl.properties" ); - assertEquals( pclProps, tcclProps ); + Properties tcclProps = verifier.loadProperties("target/tccl.properties"); + assertEquals(pclProps, tcclProps); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3805ExtensionClassPathOrderingTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3805ExtensionClassPathOrderingTest.java index a69068cd0c..4021fdba0c 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3805ExtensionClassPathOrderingTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3805ExtensionClassPathOrderingTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3805ExtensionClassPathOrderingTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3805ExtensionClassPathOrderingTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3805ExtensionClassPathOrderingTest() - { - super( "(2.0.9,2.1.0-M1),(2.1.0-M1,)" ); + public MavenITmng3805ExtensionClassPathOrderingTest() { + super("(2.0.9,2.1.0-M1),(2.1.0-M1,)"); } /** @@ -49,30 +44,27 @@ public class MavenITmng3805ExtensionClassPathOrderingTest * @throws Exception in case of failure */ @Test - public void testitMNG3805() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3805" ); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng3805" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + public void testitMNG3805() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3805"); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng3805"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties wclProps = verifier.loadProperties( "target/wcl.properties" ); + Properties wclProps = verifier.loadProperties("target/wcl.properties"); String prefix = "org/apache/maven/its/mng3805/a.properties."; String resource = "org/apache/maven/its/mng3805/a.properties"; - assertEquals( "5", wclProps.getProperty( prefix + "count" ) ); - assertTrue( wclProps.getProperty( prefix + "0" ).endsWith( "wagon-a-0.1.jar!/" + resource ) ); - assertTrue( wclProps.getProperty( prefix + "1" ).endsWith( "dep-a-0.1.jar!/" + resource ) ); - assertTrue( wclProps.getProperty( prefix + "2" ).endsWith( "dep-b-0.1.jar!/" + resource ) ); - assertTrue( wclProps.getProperty( prefix + "3" ).endsWith( "dep-c-0.1.jar!/" + resource ) ); - assertTrue( wclProps.getProperty( prefix + "4" ).endsWith( "dep-d-0.1.jar!/" + resource ) ); + assertEquals("5", wclProps.getProperty(prefix + "count")); + assertTrue(wclProps.getProperty(prefix + "0").endsWith("wagon-a-0.1.jar!/" + resource)); + assertTrue(wclProps.getProperty(prefix + "1").endsWith("dep-a-0.1.jar!/" + resource)); + assertTrue(wclProps.getProperty(prefix + "2").endsWith("dep-b-0.1.jar!/" + resource)); + assertTrue(wclProps.getProperty(prefix + "3").endsWith("dep-c-0.1.jar!/" + resource)); + assertTrue(wclProps.getProperty(prefix + "4").endsWith("dep-d-0.1.jar!/" + resource)); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3807PluginConfigExpressionEvaluationTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3807PluginConfigExpressionEvaluationTest.java index c4e1e49598..082f54088c 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3807PluginConfigExpressionEvaluationTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3807PluginConfigExpressionEvaluationTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * */ -public class MavenITmng3807PluginConfigExpressionEvaluationTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3807PluginConfigExpressionEvaluationTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3807PluginConfigExpressionEvaluationTest() - { - super( "[3.0-alpha-3,)" ); + public MavenITmng3807PluginConfigExpressionEvaluationTest() { + super("[3.0-alpha-3,)"); } /** @@ -48,37 +43,33 @@ public class MavenITmng3807PluginConfigExpressionEvaluationTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3807" ); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3807"); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/config.properties" ); + Properties props = verifier.loadProperties("target/config.properties"); - assertEvaluated( props.getProperty( "stringParams.0" ) ); - assertEvaluated( props.getProperty( "stringParams.1" ) ); + assertEvaluated(props.getProperty("stringParams.0")); + assertEvaluated(props.getProperty("stringParams.1")); - assertEvaluated( props.getProperty( "listParam.0" ) ); - assertEvaluated( props.getProperty( "listParam.1" ) ); + assertEvaluated(props.getProperty("listParam.0")); + assertEvaluated(props.getProperty("listParam.1")); - assertEvaluated( props.getProperty( "mapParam.test0" ) ); - assertEvaluated( props.getProperty( "mapParam.test1" ) ); + assertEvaluated(props.getProperty("mapParam.test0")); + assertEvaluated(props.getProperty("mapParam.test1")); - assertEvaluated( props.getProperty( "propertiesParam.test0" ) ); - assertEvaluated( props.getProperty( "propertiesParam.test1" ) ); + assertEvaluated(props.getProperty("propertiesParam.test0")); + assertEvaluated(props.getProperty("propertiesParam.test1")); } - private void assertEvaluated( String value ) - { - assertNotNull( value ); - assertTrue( value.length() > 0 ); - assertFalse( value, value.contains( "${" ) ); + private void assertEvaluated(String value) { + assertNotNull(value); + assertTrue(value.length() > 0); + assertFalse(value, value.contains("${")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3808ReportInheritanceOrderingTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3808ReportInheritanceOrderingTest.java index 1ca8d2fe59..255b4a5cb5 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3808ReportInheritanceOrderingTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3808ReportInheritanceOrderingTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Brett Porter * */ -public class MavenITmng3808ReportInheritanceOrderingTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3808ReportInheritanceOrderingTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3808ReportInheritanceOrderingTest() - { - super( "[2.0.11,2.1.0-M1),[2.1.0-M2,)" ); + public MavenITmng3808ReportInheritanceOrderingTest() { + super("[2.0.11,2.1.0-M1),[2.1.0-M2,)"); } /** @@ -48,23 +43,21 @@ public class MavenITmng3808ReportInheritanceOrderingTest * @throws Exception in case of failure */ @Test - public void testitMNG3808() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3808" ); - testDir = new File( testDir, "child" ); + public void testitMNG3808() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3808"); + testDir = new File(testDir, "child"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/model.properties" ); - Properties props = verifier.loadProperties( "target/model.properties" ); - assertEquals( "maven-it-plugin-log-file", props.getProperty( "project.reporting.plugins.0.artifactId" ) ); - assertEquals( "maven-it-plugin-expression", props.getProperty( "project.reporting.plugins.1.artifactId" ) ); - assertEquals( "maven-it-plugin-configuration", props.getProperty( "project.reporting.plugins.2.artifactId" ) ); + verifier.verifyFilePresent("target/model.properties"); + Properties props = verifier.loadProperties("target/model.properties"); + assertEquals("maven-it-plugin-log-file", props.getProperty("project.reporting.plugins.0.artifactId")); + assertEquals("maven-it-plugin-expression", props.getProperty("project.reporting.plugins.1.artifactId")); + assertEquals("maven-it-plugin-configuration", props.getProperty("project.reporting.plugins.2.artifactId")); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3810BadProfileActivationTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3810BadProfileActivationTest.java index fbb904b85f..9bc8dae317 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3810BadProfileActivationTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3810BadProfileActivationTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,34 +30,25 @@ import org.junit.jupiter.api.Test; * @author Brett Porter * */ -public class MavenITmng3810BadProfileActivationTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3810BadProfileActivationTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3810BadProfileActivationTest() - { - super( "(2.0.10,2.1.0-M1),(2.1.0-M1,3.0-alpha-1),[3.0-alpha-3,)" ); // 2.0.11+, 2.1.0-M2+ + public MavenITmng3810BadProfileActivationTest() { + super("(2.0.10,2.1.0-M1),(2.1.0-M1,3.0-alpha-1),[3.0-alpha-3,)"); // 2.0.11+, 2.1.0-M2+ } @Test - public void testitMNG3810Property() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3810/property" ); + public void testitMNG3810Property() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3810/property"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - try - { - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + try { + verifier.addCliArgument("validate"); verifier.execute(); - fail( "Build should not succeed" ); - } - catch ( Exception e ) - { - verifier.verifyTextInLog( "The property name is required to activate the profile" ); + fail("Build should not succeed"); + } catch (Exception e) { + verifier.verifyTextInLog("The property name is required to activate the profile"); } } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3811ReportingPluginConfigurationInheritanceTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3811ReportingPluginConfigurationInheritanceTest.java index 85e5a30a39..0b22d85a84 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3811ReportingPluginConfigurationInheritanceTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3811ReportingPluginConfigurationInheritanceTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Brett Porter * */ -public class MavenITmng3811ReportingPluginConfigurationInheritanceTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng3811ReportingPluginConfigurationInheritanceTest() - { +public class MavenITmng3811ReportingPluginConfigurationInheritanceTest extends AbstractMavenIntegrationTestCase { + public MavenITmng3811ReportingPluginConfigurationInheritanceTest() { // TODO: fix for 3.0+ - super( "[2.0.11,2.1.0-M1),[2.1.0,)" ); + super("[2.0.11,2.1.0-M1),[2.1.0,)"); } /** @@ -48,25 +43,22 @@ public class MavenITmng3811ReportingPluginConfigurationInheritanceTest * @throws Exception in case of failure */ @Test - public void testitMNG3811() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3811" ); + public void testitMNG3811() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3811"); - Verifier verifier = newVerifier( new File( testDir, "child" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(new File(testDir, "child").getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/config.properties" ); + Properties props = verifier.loadProperties("target/config.properties"); String p = "project.reporting.plugins.0.configuration.children."; - assertEquals( "2", props.getProperty( p + "stringParams.0.children" ) ); - assertEquals( "parentParam", props.getProperty( p + "stringParams.0.children.stringParam.0.value" ) ); - assertEquals( "childParam", props.getProperty( p + "stringParams.0.children.stringParam.1.value" ) ); - assertEquals( "true", props.getProperty( p + "booleanParam.0.value" ) ); + assertEquals("2", props.getProperty(p + "stringParams.0.children")); + assertEquals("parentParam", props.getProperty(p + "stringParams.0.children.stringParam.0.value")); + assertEquals("childParam", props.getProperty(p + "stringParams.0.children.stringParam.1.value")); + assertEquals("true", props.getProperty(p + "booleanParam.0.value")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3813PluginClassPathOrderingTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3813PluginClassPathOrderingTest.java index 1d26e5a582..b7ce64cc9b 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3813PluginClassPathOrderingTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3813PluginClassPathOrderingTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3813PluginClassPathOrderingTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3813PluginClassPathOrderingTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3813PluginClassPathOrderingTest() - { - super( "(2.0.8,)" ); + public MavenITmng3813PluginClassPathOrderingTest() { + super("(2.0.8,)"); } /** @@ -48,40 +43,37 @@ public class MavenITmng3813PluginClassPathOrderingTest * @throws Exception in case of failure */ @Test - public void testitMNG3813() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3813" ); + public void testitMNG3813() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3813"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng3813" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng3813"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties pclProps = verifier.loadProperties( "target/pcl.properties" ); + Properties pclProps = verifier.loadProperties("target/pcl.properties"); String className = "org.apache.maven.its.mng3813.SomeClass"; - String resName = className.replace( '.', '/' ) + ".class"; + String resName = className.replace('.', '/') + ".class"; - assertEquals( "depA", pclProps.getProperty( className + ".methods" ) ); - assertTrue( pclProps.getProperty( resName ).endsWith( "/dep-a-0.1.jar!/" + resName ) ); + assertEquals("depA", pclProps.getProperty(className + ".methods")); + assertTrue(pclProps.getProperty(resName).endsWith("/dep-a-0.1.jar!/" + resName)); - assertEquals( "8", pclProps.getProperty( resName + ".count" ) ); + assertEquals("8", pclProps.getProperty(resName + ".count")); - assertTrue( pclProps.getProperty( resName + ".0" ).endsWith( "/dep-a-0.1.jar!/" + resName ) ); - assertTrue( pclProps.getProperty( resName + ".1" ).endsWith( "/dep-aa-0.1.jar!/" + resName ) ); - assertTrue( pclProps.getProperty( resName + ".2" ).endsWith( "/dep-ac-0.1.jar!/" + resName ) ); - assertTrue( pclProps.getProperty( resName + ".3" ).endsWith( "/dep-ab-0.1.jar!/" + resName ) ); - assertTrue( pclProps.getProperty( resName + ".4" ).endsWith( "/dep-ad-0.1.jar!/" + resName ) ); - assertTrue( pclProps.getProperty( resName + ".5" ).endsWith( "/dep-c-0.1.jar!/" + resName ) ); - assertTrue( pclProps.getProperty( resName + ".6" ).endsWith( "/dep-b-0.1.jar!/" + resName ) ); - assertTrue( pclProps.getProperty( resName + ".7" ).endsWith( "/dep-d-0.1.jar!/" + resName ) ); + assertTrue(pclProps.getProperty(resName + ".0").endsWith("/dep-a-0.1.jar!/" + resName)); + assertTrue(pclProps.getProperty(resName + ".1").endsWith("/dep-aa-0.1.jar!/" + resName)); + assertTrue(pclProps.getProperty(resName + ".2").endsWith("/dep-ac-0.1.jar!/" + resName)); + assertTrue(pclProps.getProperty(resName + ".3").endsWith("/dep-ab-0.1.jar!/" + resName)); + assertTrue(pclProps.getProperty(resName + ".4").endsWith("/dep-ad-0.1.jar!/" + resName)); + assertTrue(pclProps.getProperty(resName + ".5").endsWith("/dep-c-0.1.jar!/" + resName)); + assertTrue(pclProps.getProperty(resName + ".6").endsWith("/dep-b-0.1.jar!/" + resName)); + assertTrue(pclProps.getProperty(resName + ".7").endsWith("/dep-d-0.1.jar!/" + resName)); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3814BogusProjectCycleTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3814BogusProjectCycleTest.java index e012ee7a4e..d39cbe18c1 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3814BogusProjectCycleTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3814BogusProjectCycleTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3814BogusProjectCycleTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3814BogusProjectCycleTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3814BogusProjectCycleTest() - { - super( "[3.0-alpha-3,)" ); + public MavenITmng3814BogusProjectCycleTest() { + super("[3.0-alpha-3,)"); } /** @@ -47,20 +42,17 @@ public class MavenITmng3814BogusProjectCycleTest * @throws Exception in case of failure */ @Test - public void testitMNG3814() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3814" ); + public void testitMNG3814() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3814"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng3814" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng3814"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3821EqualPluginExecIdsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3821EqualPluginExecIdsTest.java index 00fd7fb9aa..668793703f 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3821EqualPluginExecIdsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3821EqualPluginExecIdsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3821EqualPluginExecIdsTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3821EqualPluginExecIdsTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3821EqualPluginExecIdsTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng3821EqualPluginExecIdsTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -48,17 +43,14 @@ public class MavenITmng3821EqualPluginExecIdsTest * @throws Exception in case of failure */ @Test - public void testitMNG3821() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3821" ); + public void testitMNG3821() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3821"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3822BasedirAlignedInterpolationTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3822BasedirAlignedInterpolationTest.java index 1ab2fe75c2..d8e7ee3b16 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3822BasedirAlignedInterpolationTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3822BasedirAlignedInterpolationTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3822BasedirAlignedInterpolationTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3822BasedirAlignedInterpolationTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3822BasedirAlignedInterpolationTest() - { - super( "[2.1.0-M1,)"); + public MavenITmng3822BasedirAlignedInterpolationTest() { + super("[2.1.0-M1,)"); } /** @@ -48,36 +43,31 @@ public class MavenITmng3822BasedirAlignedInterpolationTest * @throws Exception in case of failure */ @Test - public void testitMNG3822() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3822" ); + public void testitMNG3822() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3822"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "initialize" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("initialize"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties pomProps = verifier.loadProperties( "target/interpolated.properties" ); - assertEquals( testDir, "src/main/java", pomProps.getProperty( "project.properties.buildMainSrc" ) ); - assertEquals( testDir, "src/test/java", pomProps.getProperty( "project.properties.buildTestSrc" ) ); - assertEquals( testDir, "src/main/scripts", pomProps.getProperty( "project.properties.buildScriptSrc" ) ); - assertEquals( testDir, "target", pomProps.getProperty( "project.properties.buildOut" ) ); - assertEquals( testDir, "target/classes", pomProps.getProperty( "project.properties.buildMainOut" ) ); - assertEquals( testDir, "target/test-classes", pomProps.getProperty( "project.properties.buildTestOut" ) ); - assertEquals( testDir, "target/site", pomProps.getProperty( "project.properties.siteOut" ) ); + Properties pomProps = verifier.loadProperties("target/interpolated.properties"); + assertEquals(testDir, "src/main/java", pomProps.getProperty("project.properties.buildMainSrc")); + assertEquals(testDir, "src/test/java", pomProps.getProperty("project.properties.buildTestSrc")); + assertEquals(testDir, "src/main/scripts", pomProps.getProperty("project.properties.buildScriptSrc")); + assertEquals(testDir, "target", pomProps.getProperty("project.properties.buildOut")); + assertEquals(testDir, "target/classes", pomProps.getProperty("project.properties.buildMainOut")); + assertEquals(testDir, "target/test-classes", pomProps.getProperty("project.properties.buildTestOut")); + assertEquals(testDir, "target/site", pomProps.getProperty("project.properties.siteOut")); } - private void assertEquals( File testDir, String buildDir, String interpolatedPath ) - throws Exception - { - File actual = new File( interpolatedPath ); - File expected = new File( testDir, buildDir ); + private void assertEquals(File testDir, String buildDir, String interpolatedPath) throws Exception { + File actual = new File(interpolatedPath); + File expected = new File(testDir, buildDir); - assertTrue( actual.isAbsolute() ); - assertEquals( expected.getCanonicalFile(), actual.getCanonicalFile() ); + assertTrue(actual.isAbsolute()); + assertEquals(expected.getCanonicalFile(), actual.getCanonicalFile()); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3827PluginConfigTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3827PluginConfigTest.java index 0d3228ed3d..7224b43164 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3827PluginConfigTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3827PluginConfigTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3827PluginConfigTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3827PluginConfigTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3827PluginConfigTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng3827PluginConfigTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -48,65 +43,62 @@ public class MavenITmng3827PluginConfigTest * @throws Exception in case of failure */ @Test - public void testitMNG3827() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3827" ); + public void testitMNG3827() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3827"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/plugin-config.properties" ); + Properties props = verifier.loadProperties("target/plugin-config.properties"); - assertCanonicalFileEquals( new File( testDir, "pom.xml" ), new File( props.getProperty( "fileParam" ) ) ); - assertEquals( "true", props.getProperty( "booleanParam" ) ); - assertEquals( "42", props.getProperty( "byteParam" ) ); - assertEquals( "-12345", props.getProperty( "shortParam" ) ); - assertEquals( "0", props.getProperty( "integerParam" ) ); - assertEquals( "9876543210", props.getProperty( "longParam" ) ); - assertEquals( "0.0", props.getProperty( "floatParam" ) ); - assertEquals( "-1.5", props.getProperty( "doubleParam" ) ); - assertEquals( "X", props.getProperty( "characterParam" ) ); - assertEquals( "Hello World!", props.getProperty( "stringParam" ) ); - assertEquals( "2008-11-09 11:59:03", props.getProperty( "dateParam" ) ); - assertEquals( "http://maven.apache.org/", props.getProperty( "urlParam" ) ); + assertCanonicalFileEquals(new File(testDir, "pom.xml"), new File(props.getProperty("fileParam"))); + assertEquals("true", props.getProperty("booleanParam")); + assertEquals("42", props.getProperty("byteParam")); + assertEquals("-12345", props.getProperty("shortParam")); + assertEquals("0", props.getProperty("integerParam")); + assertEquals("9876543210", props.getProperty("longParam")); + assertEquals("0.0", props.getProperty("floatParam")); + assertEquals("-1.5", props.getProperty("doubleParam")); + assertEquals("X", props.getProperty("characterParam")); + assertEquals("Hello World!", props.getProperty("stringParam")); + assertEquals("2008-11-09 11:59:03", props.getProperty("dateParam")); + assertEquals("http://maven.apache.org/", props.getProperty("urlParam")); - assertEquals( "4", props.getProperty( "stringParams" ) ); - assertEquals( "one", props.getProperty( "stringParams.0" ) ); - assertEquals( "two", props.getProperty( "stringParams.1" ) ); - assertEquals( "three", props.getProperty( "stringParams.2" ) ); - assertEquals( "four", props.getProperty( "stringParams.3" ) ); + assertEquals("4", props.getProperty("stringParams")); + assertEquals("one", props.getProperty("stringParams.0")); + assertEquals("two", props.getProperty("stringParams.1")); + assertEquals("three", props.getProperty("stringParams.2")); + assertEquals("four", props.getProperty("stringParams.3")); - assertEquals( "4", props.getProperty( "listParam" ) ); - assertEquals( "one", props.getProperty( "listParam.0" ) ); - assertEquals( "two", props.getProperty( "listParam.1" ) ); - assertEquals( "three", props.getProperty( "listParam.2" ) ); - assertEquals( "four", props.getProperty( "listParam.3" ) ); + assertEquals("4", props.getProperty("listParam")); + assertEquals("one", props.getProperty("listParam.0")); + assertEquals("two", props.getProperty("listParam.1")); + assertEquals("three", props.getProperty("listParam.2")); + assertEquals("four", props.getProperty("listParam.3")); - assertEquals( "1", props.getProperty( "setParam" ) ); - assertEquals( "item", props.getProperty( "setParam.0" ) ); + assertEquals("1", props.getProperty("setParam")); + assertEquals("item", props.getProperty("setParam.0")); - assertEquals( "2", props.getProperty( "mapParam" ) ); - assertEquals( "value1", props.getProperty( "mapParam.key1" ) ); - assertEquals( "value2", props.getProperty( "mapParam.key2" ) ); + assertEquals("2", props.getProperty("mapParam")); + assertEquals("value1", props.getProperty("mapParam.key1")); + assertEquals("value2", props.getProperty("mapParam.key2")); - assertEquals( "2", props.getProperty( "propertiesParam" ) ); - assertEquals( "value1", props.getProperty( "propertiesParam.key1" ) ); - assertEquals( "value2", props.getProperty( "propertiesParam.key2" ) ); + assertEquals("2", props.getProperty("propertiesParam")); + assertEquals("value1", props.getProperty("propertiesParam.key1")); + assertEquals("value2", props.getProperty("propertiesParam.key2")); - assertEquals( "field", props.getProperty( "beanParam.fieldParam" ) ); - assertEquals( "setter", props.getProperty( "beanParam.setterParam" ) ); - assertEquals( "true", props.getProperty( "beanParam.setterCalled" ) ); + assertEquals("field", props.getProperty("beanParam.fieldParam")); + assertEquals("setter", props.getProperty("beanParam.setterParam")); + assertEquals("true", props.getProperty("beanParam.setterCalled")); - assertEquals( "4", props.getProperty( "domParam.children" ) ); - assertEquals( "one", props.getProperty( "domParam.children.echo.0.value" ) ); - assertEquals( "two", props.getProperty( "domParam.children.echo.1.value" ) ); - assertEquals( "three", props.getProperty( "domParam.children.echo.2.value" ) ); - assertEquals( "four", props.getProperty( "domParam.children.echo.3.value" ) ); + assertEquals("4", props.getProperty("domParam.children")); + assertEquals("one", props.getProperty("domParam.children.echo.0.value")); + assertEquals("two", props.getProperty("domParam.children.echo.1.value")); + assertEquals("three", props.getProperty("domParam.children.echo.2.value")); + assertEquals("four", props.getProperty("domParam.children.echo.3.value")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3831PomInterpolationTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3831PomInterpolationTest.java index 1999f08f6c..5c03a62c9f 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3831PomInterpolationTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3831PomInterpolationTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3831PomInterpolationTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3831PomInterpolationTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3831PomInterpolationTest() - { - super( "(,2.0.2),(2.0.2,4.0.0-alpha-1)" ); + public MavenITmng3831PomInterpolationTest() { + super("(,2.0.2),(2.0.2,4.0.0-alpha-1)"); } /** @@ -48,54 +43,50 @@ public class MavenITmng3831PomInterpolationTest * @throws Exception in case of failure */ @Test - public void testitMNG3831() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3831" ); - File child = new File( testDir, "child" ); + public void testitMNG3831() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3831"); + File child = new File(testDir, "child"); - Verifier verifier = newVerifier( child.getAbsolutePath() ); - verifier.addCliArgument( "initialize" ); + Verifier verifier = newVerifier(child.getAbsolutePath()); + verifier.addCliArgument("initialize"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/interpolated.properties" ); + Properties props = verifier.loadProperties("target/interpolated.properties"); String prefix = "project.properties."; - assertEquals( child.getCanonicalFile(), new File( props.getProperty( prefix + "projectDir" ) ).getCanonicalFile() ); + assertEquals(child.getCanonicalFile(), new File(props.getProperty(prefix + "projectDir")).getCanonicalFile()); - assertEquals( "org.apache.maven.its.mng3831.child", props.getProperty( prefix + "projectGroupId" ) ); - assertEquals( "child", props.getProperty( prefix + "projectArtifactId" ) ); - assertEquals( "2.0-alpha-1", props.getProperty( prefix + "projectVersion" ) ); - assertEquals( "jar", props.getProperty( prefix + "projectPackaging" ) ); + assertEquals("org.apache.maven.its.mng3831.child", props.getProperty(prefix + "projectGroupId")); + assertEquals("child", props.getProperty(prefix + "projectArtifactId")); + assertEquals("2.0-alpha-1", props.getProperty(prefix + "projectVersion")); + assertEquals("jar", props.getProperty(prefix + "projectPackaging")); - assertEquals( "child-name", props.getProperty( prefix + "projectName" ) ); - assertEquals( "child-desc", props.getProperty( prefix + "projectDesc" ) ); - assertEquals( "http://child.org/", props.getProperty( prefix + "projectUrl" ) ); - assertEquals( "2008", props.getProperty( prefix + "projectYear" ) ); - assertEquals( "child-org-name", props.getProperty( prefix + "projectOrgName" ) ); + assertEquals("child-name", props.getProperty(prefix + "projectName")); + assertEquals("child-desc", props.getProperty(prefix + "projectDesc")); + assertEquals("http://child.org/", props.getProperty(prefix + "projectUrl")); + assertEquals("2008", props.getProperty(prefix + "projectYear")); + assertEquals("child-org-name", props.getProperty(prefix + "projectOrgName")); - assertEquals( "2.0.0", props.getProperty( prefix + "projectPrereqMvn" ) ); - assertEquals( "http://scm.org/", props.getProperty( prefix + "projectScmUrl" ) ); - assertEquals( "http://issue.org/", props.getProperty( prefix + "projectIssueUrl" ) ); - assertEquals( "http://ci.org/", props.getProperty( prefix + "projectCiUrl" ) ); - assertEquals( "child-dist-repo", props.getProperty( prefix + "projectDistRepoName" ) ); - assertEquals( "http://dist.org/", props.getProperty( prefix + "projectDistRepoUrl" ) ); - assertEquals( "http://site.org/", props.getProperty( prefix + "projectDistSiteUrl" ) ); + assertEquals("2.0.0", props.getProperty(prefix + "projectPrereqMvn")); + assertEquals("http://scm.org/", props.getProperty(prefix + "projectScmUrl")); + assertEquals("http://issue.org/", props.getProperty(prefix + "projectIssueUrl")); + assertEquals("http://ci.org/", props.getProperty(prefix + "projectCiUrl")); + assertEquals("child-dist-repo", props.getProperty(prefix + "projectDistRepoName")); + assertEquals("http://dist.org/", props.getProperty(prefix + "projectDistRepoUrl")); + assertEquals("http://site.org/", props.getProperty(prefix + "projectDistSiteUrl")); - assertEquals( "org.apache.maven.its.mng3831", props.getProperty( prefix + "parentGroupId" ) ); - assertEquals( "parent", props.getProperty( prefix + "parentArtifactId" ) ); - assertEquals( "1.0", props.getProperty( prefix + "parentVersion" ) ); + assertEquals("org.apache.maven.its.mng3831", props.getProperty(prefix + "parentGroupId")); + assertEquals("parent", props.getProperty(prefix + "parentArtifactId")); + assertEquals("1.0", props.getProperty(prefix + "parentVersion")); /* * NOTE: We intentionally do not check whether the build paths have been basedir aligned, that's another * story... */ - if ( matchesVersionRange( "(2.0.8,)" ) ) - { - assertTrue( props.getProperty( prefix + "projectBuildOut" ).endsWith( "bin" ) ); + if (matchesVersionRange("(2.0.8,)")) { + assertTrue(props.getProperty(prefix + "projectBuildOut").endsWith("bin")); } - assertTrue( props.getProperty( prefix + "projectSiteOut" ).endsWith( "doc" ) ); + assertTrue(props.getProperty(prefix + "projectSiteOut").endsWith("doc")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3833PomInterpolationDataFlowChainTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3833PomInterpolationDataFlowChainTest.java index 0f2255cd7b..1e88f4a0ff 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3833PomInterpolationDataFlowChainTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3833PomInterpolationDataFlowChainTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3833PomInterpolationDataFlowChainTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3833PomInterpolationDataFlowChainTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3833PomInterpolationDataFlowChainTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng3833PomInterpolationDataFlowChainTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -49,25 +44,21 @@ public class MavenITmng3833PomInterpolationDataFlowChainTest * @throws Exception in case of failure */ @Test - public void testitMNG3833() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3833" ); + public void testitMNG3833() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3833"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/interpolated.properties" ); + Properties props = verifier.loadProperties("target/interpolated.properties"); - for ( int i = 0; i < 24; i++ ) - { - String index = ( ( i < 10 ) ? "0" : "" ) + i; - assertEquals( "PASSED", props.getProperty( "project.properties.property" + index ) ); + for (int i = 0; i < 24; i++) { + String index = ((i < 10) ? "0" : "") + i; + assertEquals("PASSED", props.getProperty("project.properties.property" + index)); } } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3836PluginConfigInheritanceTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3836PluginConfigInheritanceTest.java index bef9808f83..af8c9f4b90 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3836PluginConfigInheritanceTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3836PluginConfigInheritanceTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3836PluginConfigInheritanceTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3836PluginConfigInheritanceTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3836PluginConfigInheritanceTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng3836PluginConfigInheritanceTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -48,37 +43,34 @@ public class MavenITmng3836PluginConfigInheritanceTest * @throws Exception in case of failure */ @Test - public void testitMNG3836() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3836" ); + public void testitMNG3836() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3836"); - Verifier verifier = newVerifier( new File( testDir, "child" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(new File(testDir, "child").getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/plugin-config.properties" ); + Properties props = verifier.loadProperties("target/plugin-config.properties"); - assertEquals( "4", props.getProperty( "stringParams" ) ); - assertEquals( "PASSED-1", props.getProperty( "stringParams.0" ) ); - assertEquals( "PASSED-3", props.getProperty( "stringParams.1" ) ); - assertEquals( "PASSED-2", props.getProperty( "stringParams.2" ) ); - assertEquals( "PASSED-4", props.getProperty( "stringParams.3" ) ); + assertEquals("4", props.getProperty("stringParams")); + assertEquals("PASSED-1", props.getProperty("stringParams.0")); + assertEquals("PASSED-3", props.getProperty("stringParams.1")); + assertEquals("PASSED-2", props.getProperty("stringParams.2")); + assertEquals("PASSED-4", props.getProperty("stringParams.3")); - assertEquals( "4", props.getProperty( "listParam" ) ); - assertEquals( "PASSED-1", props.getProperty( "listParam.0" ) ); - assertEquals( "PASSED-3", props.getProperty( "listParam.1" ) ); - assertEquals( "PASSED-2", props.getProperty( "listParam.2" ) ); - assertEquals( "PASSED-4", props.getProperty( "listParam.3" ) ); + assertEquals("4", props.getProperty("listParam")); + assertEquals("PASSED-1", props.getProperty("listParam.0")); + assertEquals("PASSED-3", props.getProperty("listParam.1")); + assertEquals("PASSED-2", props.getProperty("listParam.2")); + assertEquals("PASSED-4", props.getProperty("listParam.3")); - assertEquals( "4", props.getProperty( "domParam.children" ) ); - assertEquals( "PASSED-1", props.getProperty( "domParam.children.echo.0.value" ) ); - assertEquals( "PASSED-3", props.getProperty( "domParam.children.echo.1.value" ) ); - assertEquals( "PASSED-2", props.getProperty( "domParam.children.echo.2.value" ) ); - assertEquals( "PASSED-4", props.getProperty( "domParam.children.echo.3.value" ) ); + assertEquals("4", props.getProperty("domParam.children")); + assertEquals("PASSED-1", props.getProperty("domParam.children.echo.0.value")); + assertEquals("PASSED-3", props.getProperty("domParam.children.echo.1.value")); + assertEquals("PASSED-2", props.getProperty("domParam.children.echo.2.value")); + assertEquals("PASSED-4", props.getProperty("domParam.children.echo.3.value")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3838EqualPluginDepsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3838EqualPluginDepsTest.java index ef83d4e4b8..4f5848727e 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3838EqualPluginDepsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3838EqualPluginDepsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,12 +30,9 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3838EqualPluginDepsTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng3838EqualPluginDepsTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenITmng3838EqualPluginDepsTest extends AbstractMavenIntegrationTestCase { + public MavenITmng3838EqualPluginDepsTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -46,16 +41,13 @@ public class MavenITmng3838EqualPluginDepsTest * @throws Exception in case of failure */ @Test - public void testitMNG3838() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3838" ); + public void testitMNG3838() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3838"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3839PomParsingCoalesceTextTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3839PomParsingCoalesceTextTest.java index ca5e9d7e47..d22db371d8 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3839PomParsingCoalesceTextTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3839PomParsingCoalesceTextTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3839PomParsingCoalesceTextTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3839PomParsingCoalesceTextTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3839PomParsingCoalesceTextTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng3839PomParsingCoalesceTextTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -48,22 +43,24 @@ public class MavenITmng3839PomParsingCoalesceTextTest * @throws Exception in case of failure */ @Test - public void testitMNG3839() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3839" ); + public void testitMNG3839() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3839"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/xml.properties" ); - assertEquals( "A Test Project Property", props.getProperty( "project.properties.prop0" ) ); - assertEquals( "That's a test!", props.getProperty( "project.properties.prop1" ) ); - assertEquals( 32 * 1024, props.getProperty( "project.properties.prop2" ).trim().replaceAll( "[\n\r]", "" ).length() ); + Properties props = verifier.loadProperties("target/xml.properties"); + assertEquals("A Test Project Property", props.getProperty("project.properties.prop0")); + assertEquals("That's a test!", props.getProperty("project.properties.prop1")); + assertEquals( + 32 * 1024, + props.getProperty("project.properties.prop2") + .trim() + .replaceAll("[\n\r]", "") + .length()); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3843PomInheritanceTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3843PomInheritanceTest.java index 55027ce972..9384632333 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3843PomInheritanceTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3843PomInheritanceTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,15 +16,15 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Collection; import java.util.Properties; import java.util.TreeSet; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -35,13 +33,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3843PomInheritanceTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3843PomInheritanceTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3843PomInheritanceTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng3843PomInheritanceTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -50,279 +45,257 @@ public class MavenITmng3843PomInheritanceTest * @throws Exception in case of failure */ @Test - public void testitMNG3843() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3843" ); + public void testitMNG3843() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3843"); testDir = testDir.getCanonicalFile(); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "test-1/target" ); - verifier.deleteDirectory( "test-2/target" ); - verifier.deleteDirectory( "test-2/child-1/target" ); - verifier.deleteDirectory( "test-2/child-2/target" ); - verifier.deleteDirectory( "test-3/sub-parent/child-a/target" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("test-1/target"); + verifier.deleteDirectory("test-2/target"); + verifier.deleteDirectory("test-2/child-1/target"); + verifier.deleteDirectory("test-2/child-2/target"); + verifier.deleteDirectory("test-3/sub-parent/child-a/target"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); Properties props; File basedir; - basedir = new File( verifier.getBasedir(), "test-1" ); - props = verifier.loadProperties( "test-1/target/pom.properties" ); - assertEquals( "org.apache.maven.its.mng3843", props.getProperty( "project.groupId" ) ); - assertEquals( "test-1", props.getProperty( "project.artifactId" ) ); - assertEquals( "0.1", props.getProperty( "project.version" ) ); - assertEquals( "jar", props.getProperty( "project.packaging" ) ); - assertEquals( "test", props.getProperty( "project.name", "" ) ); - assertEquals( "", props.getProperty( "project.description", "" ) ); - assertEquals( "", props.getProperty( "project.url", "" ) ); - assertEquals( "", props.getProperty( "project.inceptionYear", "" ) ); - assertEquals( "", props.getProperty( "project.build.defaultGoal", "" ) ); - if ( matchesVersionRange( "[4.0.0-alpha-6,)" ) ) - { - assertEquals( "2", props.getProperty( "project.properties" ) ); - assertEquals( "UTF-8", props.getProperty( "project.properties.project.build.sourceEncoding" ) ); - assertEquals( "UTF-8", props.getProperty( "project.properties.project.reporting.outputEncoding" ) ); + basedir = new File(verifier.getBasedir(), "test-1"); + props = verifier.loadProperties("test-1/target/pom.properties"); + assertEquals("org.apache.maven.its.mng3843", props.getProperty("project.groupId")); + assertEquals("test-1", props.getProperty("project.artifactId")); + assertEquals("0.1", props.getProperty("project.version")); + assertEquals("jar", props.getProperty("project.packaging")); + assertEquals("test", props.getProperty("project.name", "")); + assertEquals("", props.getProperty("project.description", "")); + assertEquals("", props.getProperty("project.url", "")); + assertEquals("", props.getProperty("project.inceptionYear", "")); + assertEquals("", props.getProperty("project.build.defaultGoal", "")); + if (matchesVersionRange("[4.0.0-alpha-6,)")) { + assertEquals("2", props.getProperty("project.properties")); + assertEquals("UTF-8", props.getProperty("project.properties.project.build.sourceEncoding")); + assertEquals("UTF-8", props.getProperty("project.properties.project.reporting.outputEncoding")); + } else { + assertMissing(props, "project.properties."); } - else - { - assertMissing( props, "project.properties." ); + assertMissing(props, "project.prerequisites."); + assertMissing(props, "project.modules."); + assertMissing(props, "project.licenses."); + assertMissing(props, "project.developers."); + assertMissing(props, "project.contributors."); + assertMissing(props, "project.mailingLists."); + assertMissing(props, "project.organization."); + assertMissing(props, "project.scm."); + assertMissing(props, "project.ciManagement."); + assertMissing(props, "project.issueManagement."); + assertMissing(props, "project.distributionManagement."); + assertMissing(props, "project.profiles."); + assertEquals("test-1-0.1", props.getProperty("project.build.finalName")); + assertPathEquals(basedir, "src/main/java", props.getProperty("project.build.sourceDirectory")); + assertPathEquals(basedir, "src/test/java", props.getProperty("project.build.testSourceDirectory")); + assertPathEquals(basedir, "src/main/scripts", props.getProperty("project.build.scriptSourceDirectory")); + if (matchesVersionRange("[4.0.0-alpha-1,)")) { + assertEquals("2", props.getProperty("project.build.resources")); + assertEquals("2", props.getProperty("project.build.testResources")); + } else { + assertEquals("1", props.getProperty("project.build.resources")); + assertEquals("1", props.getProperty("project.build.testResources")); } - assertMissing( props, "project.prerequisites." ); - assertMissing( props, "project.modules." ); - assertMissing( props, "project.licenses." ); - assertMissing( props, "project.developers." ); - assertMissing( props, "project.contributors." ); - assertMissing( props, "project.mailingLists." ); - assertMissing( props, "project.organization." ); - assertMissing( props, "project.scm." ); - assertMissing( props, "project.ciManagement." ); - assertMissing( props, "project.issueManagement." ); - assertMissing( props, "project.distributionManagement." ); - assertMissing( props, "project.profiles." ); - assertEquals( "test-1-0.1", props.getProperty( "project.build.finalName" ) ); - assertPathEquals( basedir, "src/main/java", props.getProperty( "project.build.sourceDirectory" ) ); - assertPathEquals( basedir, "src/test/java", props.getProperty( "project.build.testSourceDirectory" ) ); - assertPathEquals( basedir, "src/main/scripts", props.getProperty( "project.build.scriptSourceDirectory" ) ); - if ( matchesVersionRange( "[4.0.0-alpha-1,)" ) ) - { - assertEquals( "2", props.getProperty( "project.build.resources" ) ); - assertEquals( "2", props.getProperty( "project.build.testResources" ) ); + assertPathEquals(basedir, "src/main/resources", props.getProperty("project.build.resources.0.directory")); + assertPathEquals(basedir, "src/test/resources", props.getProperty("project.build.testResources.0.directory")); + if (matchesVersionRange("[4.0.0-alpha-1,)")) { + assertPathEquals( + basedir, "src/main/resources-filtered", props.getProperty("project.build.resources.1.directory")); + assertPathEquals( + basedir, + "src/test/resources-filtered", + props.getProperty("project.build.testResources.1.directory")); } - else - { - assertEquals( "1", props.getProperty( "project.build.resources" ) ); - assertEquals( "1", props.getProperty( "project.build.testResources" ) ); - } - assertPathEquals( basedir, "src/main/resources", props.getProperty( "project.build.resources.0.directory" ) ); - assertPathEquals( basedir, "src/test/resources", - props.getProperty( "project.build.testResources.0.directory" ) ); - if ( matchesVersionRange( "[4.0.0-alpha-1,)" ) ) - { - assertPathEquals( basedir, "src/main/resources-filtered", props.getProperty( "project.build.resources.1.directory" ) ); - assertPathEquals( basedir, "src/test/resources-filtered", - props.getProperty( "project.build.testResources.1.directory" ) ); - } - assertPathEquals( basedir, "target", props.getProperty( "project.build.directory" ) ); - assertPathEquals( basedir, "target/classes", props.getProperty( "project.build.outputDirectory" ) ); - assertPathEquals( basedir, "target/test-classes", props.getProperty( "project.build.testOutputDirectory" ) ); - assertPathEquals( basedir, "target/site", props.getProperty( "project.reporting.outputDirectory" ) ); - assertEquals( "false", props.getProperty( "project.reporting.excludeDefaults" ) ); - assertTrue( Integer.parseInt( props.getProperty( "project.repositories" ) ) > 0 ); - if ( matchesVersionRange( "(,3.0-alpha-3)" ) ) - { + assertPathEquals(basedir, "target", props.getProperty("project.build.directory")); + assertPathEquals(basedir, "target/classes", props.getProperty("project.build.outputDirectory")); + assertPathEquals(basedir, "target/test-classes", props.getProperty("project.build.testOutputDirectory")); + assertPathEquals(basedir, "target/site", props.getProperty("project.reporting.outputDirectory")); + assertEquals("false", props.getProperty("project.reporting.excludeDefaults")); + assertTrue(Integer.parseInt(props.getProperty("project.repositories")) > 0); + if (matchesVersionRange("(,3.0-alpha-3)")) { // 3.x will provide the lifecycle bindings in the effective model, don't count these - assertEquals( "1", props.getProperty( "project.build.plugins" ) ); + assertEquals("1", props.getProperty("project.build.plugins")); } - assertMissing( props, "project.dependencies." ); - assertMissing( props, "project.dependencyManagement." ); + assertMissing(props, "project.dependencies."); + assertMissing(props, "project.dependencyManagement."); - basedir = new File( verifier.getBasedir(), "test-2" ); - props = verifier.loadProperties( "test-2/target/pom.properties" ); + basedir = new File(verifier.getBasedir(), "test-2"); + props = verifier.loadProperties("test-2/target/pom.properties"); - basedir = new File( verifier.getBasedir(), "test-2/child-1" ); - props = verifier.loadProperties( "test-2/child-1/target/pom.properties" ); - assertEquals( "org.apache.maven.its.mng3843", props.getProperty( "project.groupId" ) ); - assertEquals( "child-1", props.getProperty( "project.artifactId" ) ); - assertEquals( "0.1", props.getProperty( "project.version" ) ); - assertEquals( "jar", props.getProperty( "project.packaging" ) ); - assertNotEquals( "parent-name", props.getProperty( "project.name" ) ); - assertEquals( "parent-description", props.getProperty( "project.description", "" ) ); - assertUrlCommon( "http://parent.url", props.getProperty( "project.url", "" ) ); - assertEquals( "2008", props.getProperty( "project.inceptionYear", "" ) ); - assertEquals( "initialize", props.getProperty( "project.build.defaultGoal" ) ); - assertEquals( "parent-property", props.getProperty( "project.properties.parentProperty" ) ); - assertMissing( props, "project.prerequisites." ); - assertMissing( props, "project.modules." ); - assertEquals( "1", props.getProperty( "project.licenses" ) ); - assertEquals( "http://parent.url/license", props.getProperty( "project.licenses.0.url" ) ); - assertEquals( "1", props.getProperty( "project.developers" ) ); - assertEquals( "parent-developer", props.getProperty( "project.developers.0.name" ) ); - assertEquals( "1", props.getProperty( "project.contributors" ) ); - assertEquals( "parent-contributor", props.getProperty( "project.contributors.0.name" ) ); - assertEquals( "1", props.getProperty( "project.mailingLists" ) ); - assertEquals( "parent-mailing-list", props.getProperty( "project.mailingLists.0.name" ) ); - assertEquals( "http://parent-org.url/", props.getProperty( "project.organization.url" ) ); - assertUrlCommon( "http://parent.url/trunk", props.getProperty( "project.scm.url" ) ); - assertUrlCommon( "http://parent.url/scm", props.getProperty( "project.scm.connection" ) ); - assertUrlCommon( "https://parent.url/scm", props.getProperty( "project.scm.developerConnection" ) ); - assertEquals( "http://parent.url/ci", props.getProperty( "project.ciManagement.url" ) ); - assertEquals( "http://parent.url/issues", props.getProperty( "project.issueManagement.url" ) ); - assertEquals( "http://parent.url/dist", props.getProperty( "project.distributionManagement.repository.url" ) ); - assertEquals( "http://parent.url/snaps", - props.getProperty( "project.distributionManagement.snapshotRepository.url" ) ); - assertUrlCommon( "http://parent.url/site", props.getProperty( "project.distributionManagement.site.url" ) ); - assertUrlCommon( "http://parent.url/download", - props.getProperty( "project.distributionManagement.downloadUrl" ) ); - if ( matchesVersionRange( "(2.0.2,)" ) ) - { - assertMissing( props, "project.distributionManagement.relocation." ); + basedir = new File(verifier.getBasedir(), "test-2/child-1"); + props = verifier.loadProperties("test-2/child-1/target/pom.properties"); + assertEquals("org.apache.maven.its.mng3843", props.getProperty("project.groupId")); + assertEquals("child-1", props.getProperty("project.artifactId")); + assertEquals("0.1", props.getProperty("project.version")); + assertEquals("jar", props.getProperty("project.packaging")); + assertNotEquals("parent-name", props.getProperty("project.name")); + assertEquals("parent-description", props.getProperty("project.description", "")); + assertUrlCommon("http://parent.url", props.getProperty("project.url", "")); + assertEquals("2008", props.getProperty("project.inceptionYear", "")); + assertEquals("initialize", props.getProperty("project.build.defaultGoal")); + assertEquals("parent-property", props.getProperty("project.properties.parentProperty")); + assertMissing(props, "project.prerequisites."); + assertMissing(props, "project.modules."); + assertEquals("1", props.getProperty("project.licenses")); + assertEquals("http://parent.url/license", props.getProperty("project.licenses.0.url")); + assertEquals("1", props.getProperty("project.developers")); + assertEquals("parent-developer", props.getProperty("project.developers.0.name")); + assertEquals("1", props.getProperty("project.contributors")); + assertEquals("parent-contributor", props.getProperty("project.contributors.0.name")); + assertEquals("1", props.getProperty("project.mailingLists")); + assertEquals("parent-mailing-list", props.getProperty("project.mailingLists.0.name")); + assertEquals("http://parent-org.url/", props.getProperty("project.organization.url")); + assertUrlCommon("http://parent.url/trunk", props.getProperty("project.scm.url")); + assertUrlCommon("http://parent.url/scm", props.getProperty("project.scm.connection")); + assertUrlCommon("https://parent.url/scm", props.getProperty("project.scm.developerConnection")); + assertEquals("http://parent.url/ci", props.getProperty("project.ciManagement.url")); + assertEquals("http://parent.url/issues", props.getProperty("project.issueManagement.url")); + assertEquals("http://parent.url/dist", props.getProperty("project.distributionManagement.repository.url")); + assertEquals( + "http://parent.url/snaps", props.getProperty("project.distributionManagement.snapshotRepository.url")); + assertUrlCommon("http://parent.url/site", props.getProperty("project.distributionManagement.site.url")); + assertUrlCommon("http://parent.url/download", props.getProperty("project.distributionManagement.downloadUrl")); + if (matchesVersionRange("(2.0.2,)")) { + assertMissing(props, "project.distributionManagement.relocation."); } - assertMissing( props, "project.profiles." ); - assertEquals( "child-1-0.1", props.getProperty( "project.build.finalName" ) ); - assertPathEquals( basedir, "src/main", props.getProperty( "project.build.sourceDirectory" ) ); - assertPathEquals( basedir, "src/test", props.getProperty( "project.build.testSourceDirectory" ) ); - assertPathEquals( basedir, "src/scripts", props.getProperty( "project.build.scriptSourceDirectory" ) ); - assertEquals( "1", props.getProperty( "project.build.resources" ) ); - assertPathEquals( basedir, "res/main", props.getProperty( "project.build.resources.0.directory" ) ); - assertEquals( "1", props.getProperty( "project.build.testResources" ) ); - assertPathEquals( basedir, "res/test", props.getProperty( "project.build.testResources.0.directory" ) ); - assertPathEquals( basedir, "out", props.getProperty( "project.build.directory" ) ); - assertPathEquals( basedir, "out/main", props.getProperty( "project.build.outputDirectory" ) ); - assertPathEquals( basedir, "out/test", props.getProperty( "project.build.testOutputDirectory" ) ); - assertPathEquals( basedir, "site", props.getProperty( "project.reporting.outputDirectory" ) ); - if ( matchesVersionRange( "(2.0.9,2.1.0-M1),(2.1.0-M1,)" ) ) - { + assertMissing(props, "project.profiles."); + assertEquals("child-1-0.1", props.getProperty("project.build.finalName")); + assertPathEquals(basedir, "src/main", props.getProperty("project.build.sourceDirectory")); + assertPathEquals(basedir, "src/test", props.getProperty("project.build.testSourceDirectory")); + assertPathEquals(basedir, "src/scripts", props.getProperty("project.build.scriptSourceDirectory")); + assertEquals("1", props.getProperty("project.build.resources")); + assertPathEquals(basedir, "res/main", props.getProperty("project.build.resources.0.directory")); + assertEquals("1", props.getProperty("project.build.testResources")); + assertPathEquals(basedir, "res/test", props.getProperty("project.build.testResources.0.directory")); + assertPathEquals(basedir, "out", props.getProperty("project.build.directory")); + assertPathEquals(basedir, "out/main", props.getProperty("project.build.outputDirectory")); + assertPathEquals(basedir, "out/test", props.getProperty("project.build.testOutputDirectory")); + assertPathEquals(basedir, "site", props.getProperty("project.reporting.outputDirectory")); + if (matchesVersionRange("(2.0.9,2.1.0-M1),(2.1.0-M1,)")) { // MNG-1999 - assertEquals( "true", props.getProperty( "project.reporting.excludeDefaults" ) ); + assertEquals("true", props.getProperty("project.reporting.excludeDefaults")); } - assertTrue( Integer.parseInt( props.getProperty( "project.repositories" ) ) > 1 ); - if ( matchesVersionRange( "(,3.0-alpha-3)" ) ) - { + assertTrue(Integer.parseInt(props.getProperty("project.repositories")) > 1); + if (matchesVersionRange("(,3.0-alpha-3)")) { // 3.x will provide the lifecycle bindings in the effective model, don't count these - assertEquals( "1", props.getProperty( "project.build.plugins" ) ); + assertEquals("1", props.getProperty("project.build.plugins")); } - assertEquals( "1", props.getProperty( "project.dependencies" ) ); - assertEquals( "parent-dep-b", props.getProperty( "project.dependencies.0.artifactId" ) ); - assertEquals( "1", props.getProperty( "project.dependencyManagement.dependencies" ) ); - assertEquals( "parent-dep-a", props.getProperty( "project.dependencyManagement.dependencies.0.artifactId" ) ); + assertEquals("1", props.getProperty("project.dependencies")); + assertEquals("parent-dep-b", props.getProperty("project.dependencies.0.artifactId")); + assertEquals("1", props.getProperty("project.dependencyManagement.dependencies")); + assertEquals("parent-dep-a", props.getProperty("project.dependencyManagement.dependencies.0.artifactId")); - basedir = new File( verifier.getBasedir(), "test-2/child-2" ); - props = verifier.loadProperties( "test-2/child-2/target/pom.properties" ); - assertEquals( "org.apache.maven.its.mng3843.child", props.getProperty( "project.groupId" ) ); - assertEquals( "child-2", props.getProperty( "project.artifactId" ) ); - assertEquals( "0.2", props.getProperty( "project.version" ) ); - assertEquals( "jar", props.getProperty( "project.packaging" ) ); - assertEquals( "child-name", props.getProperty( "project.name" ) ); - assertEquals( "child-description", props.getProperty( "project.description", "" ) ); - assertUrlCommon( "http://child.url", props.getProperty( "project.url", "" ) ); - assertEquals( "2009", props.getProperty( "project.inceptionYear", "" ) ); - assertEquals( "validate", props.getProperty( "project.build.defaultGoal" ) ); - assertEquals( "parent-property", props.getProperty( "project.properties.parentProperty" ) ); - assertEquals( "child-property", props.getProperty( "project.properties.childProperty" ) ); - assertEquals( "child-override", props.getProperty( "project.properties.overriddenProperty" ) ); - assertEquals( "2.0.1", props.getProperty( "project.prerequisites.maven" ) ); - assertMissing( props, "project.modules." ); - assertEquals( "1", props.getProperty( "project.licenses" ) ); - assertEquals( "http://child.url/license", props.getProperty( "project.licenses.0.url" ) ); - assertEquals( "1", props.getProperty( "project.developers" ) ); - assertEquals( "child-developer", props.getProperty( "project.developers.0.name" ) ); - assertEquals( "1", props.getProperty( "project.contributors" ) ); - assertEquals( "child-contributor", props.getProperty( "project.contributors.0.name" ) ); - assertEquals( "1", props.getProperty( "project.mailingLists" ) ); - assertEquals( "child-mailing-list", props.getProperty( "project.mailingLists.0.name" ) ); - assertEquals( "http://child-org.url/", props.getProperty( "project.organization.url" ) ); - assertUrlCommon( "http://child.url/trunk", props.getProperty( "project.scm.url" ) ); - assertUrlCommon( "http://child.url/scm", props.getProperty( "project.scm.connection" ) ); - assertUrlCommon( "https://child.url/scm", props.getProperty( "project.scm.developerConnection" ) ); - assertEquals( "http://child.url/ci", props.getProperty( "project.ciManagement.url" ) ); - assertEquals( "http://child.url/issues", props.getProperty( "project.issueManagement.url" ) ); - assertEquals( "http://child.url/dist", props.getProperty( "project.distributionManagement.repository.url" ) ); - assertEquals( "http://child.url/snaps", - props.getProperty( "project.distributionManagement.snapshotRepository.url" ) ); - assertUrlCommon( "http://child.url/site", props.getProperty( "project.distributionManagement.site.url" ) ); - assertUrlCommon( "http://child.url/download", - props.getProperty( "project.distributionManagement.downloadUrl" ) ); - assertEquals( "child-reloc-msg", props.getProperty( "project.distributionManagement.relocation.message" ) ); - assertMissing( props, "project.profiles." ); - assertEquals( "coreit", props.getProperty( "project.build.finalName" ) ); - assertPathEquals( basedir, "sources/main", props.getProperty( "project.build.sourceDirectory" ) ); - assertPathEquals( basedir, "sources/test", props.getProperty( "project.build.testSourceDirectory" ) ); - assertPathEquals( basedir, "sources/scripts", props.getProperty( "project.build.scriptSourceDirectory" ) ); - assertEquals( "1", props.getProperty( "project.build.resources" ) ); - assertPathEquals( basedir, "resources/main", props.getProperty( "project.build.resources.0.directory" ) ); - assertEquals( "1", props.getProperty( "project.build.testResources" ) ); - assertPathEquals( basedir, "resources/test", props.getProperty( "project.build.testResources.0.directory" ) ); - assertPathEquals( basedir, "build", props.getProperty( "project.build.directory" ) ); - assertPathEquals( basedir, "build/main", props.getProperty( "project.build.outputDirectory" ) ); - assertPathEquals( basedir, "build/test", props.getProperty( "project.build.testOutputDirectory" ) ); - assertPathEquals( basedir, "docs", props.getProperty( "project.reporting.outputDirectory" ) ); - assertEquals( "false", props.getProperty( "project.reporting.excludeDefaults" ) ); - assertTrue( Integer.parseInt( props.getProperty( "project.repositories" ) ) > 1 ); - if ( matchesVersionRange( "(2.0.4,3.0-alpha-3)" ) ) - { + basedir = new File(verifier.getBasedir(), "test-2/child-2"); + props = verifier.loadProperties("test-2/child-2/target/pom.properties"); + assertEquals("org.apache.maven.its.mng3843.child", props.getProperty("project.groupId")); + assertEquals("child-2", props.getProperty("project.artifactId")); + assertEquals("0.2", props.getProperty("project.version")); + assertEquals("jar", props.getProperty("project.packaging")); + assertEquals("child-name", props.getProperty("project.name")); + assertEquals("child-description", props.getProperty("project.description", "")); + assertUrlCommon("http://child.url", props.getProperty("project.url", "")); + assertEquals("2009", props.getProperty("project.inceptionYear", "")); + assertEquals("validate", props.getProperty("project.build.defaultGoal")); + assertEquals("parent-property", props.getProperty("project.properties.parentProperty")); + assertEquals("child-property", props.getProperty("project.properties.childProperty")); + assertEquals("child-override", props.getProperty("project.properties.overriddenProperty")); + assertEquals("2.0.1", props.getProperty("project.prerequisites.maven")); + assertMissing(props, "project.modules."); + assertEquals("1", props.getProperty("project.licenses")); + assertEquals("http://child.url/license", props.getProperty("project.licenses.0.url")); + assertEquals("1", props.getProperty("project.developers")); + assertEquals("child-developer", props.getProperty("project.developers.0.name")); + assertEquals("1", props.getProperty("project.contributors")); + assertEquals("child-contributor", props.getProperty("project.contributors.0.name")); + assertEquals("1", props.getProperty("project.mailingLists")); + assertEquals("child-mailing-list", props.getProperty("project.mailingLists.0.name")); + assertEquals("http://child-org.url/", props.getProperty("project.organization.url")); + assertUrlCommon("http://child.url/trunk", props.getProperty("project.scm.url")); + assertUrlCommon("http://child.url/scm", props.getProperty("project.scm.connection")); + assertUrlCommon("https://child.url/scm", props.getProperty("project.scm.developerConnection")); + assertEquals("http://child.url/ci", props.getProperty("project.ciManagement.url")); + assertEquals("http://child.url/issues", props.getProperty("project.issueManagement.url")); + assertEquals("http://child.url/dist", props.getProperty("project.distributionManagement.repository.url")); + assertEquals( + "http://child.url/snaps", props.getProperty("project.distributionManagement.snapshotRepository.url")); + assertUrlCommon("http://child.url/site", props.getProperty("project.distributionManagement.site.url")); + assertUrlCommon("http://child.url/download", props.getProperty("project.distributionManagement.downloadUrl")); + assertEquals("child-reloc-msg", props.getProperty("project.distributionManagement.relocation.message")); + assertMissing(props, "project.profiles."); + assertEquals("coreit", props.getProperty("project.build.finalName")); + assertPathEquals(basedir, "sources/main", props.getProperty("project.build.sourceDirectory")); + assertPathEquals(basedir, "sources/test", props.getProperty("project.build.testSourceDirectory")); + assertPathEquals(basedir, "sources/scripts", props.getProperty("project.build.scriptSourceDirectory")); + assertEquals("1", props.getProperty("project.build.resources")); + assertPathEquals(basedir, "resources/main", props.getProperty("project.build.resources.0.directory")); + assertEquals("1", props.getProperty("project.build.testResources")); + assertPathEquals(basedir, "resources/test", props.getProperty("project.build.testResources.0.directory")); + assertPathEquals(basedir, "build", props.getProperty("project.build.directory")); + assertPathEquals(basedir, "build/main", props.getProperty("project.build.outputDirectory")); + assertPathEquals(basedir, "build/test", props.getProperty("project.build.testOutputDirectory")); + assertPathEquals(basedir, "docs", props.getProperty("project.reporting.outputDirectory")); + assertEquals("false", props.getProperty("project.reporting.excludeDefaults")); + assertTrue(Integer.parseInt(props.getProperty("project.repositories")) > 1); + if (matchesVersionRange("(2.0.4,3.0-alpha-3)")) { // 3.x will provide the lifecycle bindings in the effective model, don't count these - assertEquals( "1", props.getProperty( "project.build.plugins" ) ); + assertEquals("1", props.getProperty("project.build.plugins")); } - assertEquals( "4", props.getProperty( "project.dependencies" ) ); + assertEquals("4", props.getProperty("project.dependencies")); Collection actualDeps = new TreeSet<>(); - actualDeps.add( props.getProperty( "project.dependencies.0.artifactId" ) ); - actualDeps.add( props.getProperty( "project.dependencies.1.artifactId" ) ); - actualDeps.add( props.getProperty( "project.dependencies.2.artifactId" ) ); - actualDeps.add( props.getProperty( "project.dependencies.3.artifactId" ) ); + actualDeps.add(props.getProperty("project.dependencies.0.artifactId")); + actualDeps.add(props.getProperty("project.dependencies.1.artifactId")); + actualDeps.add(props.getProperty("project.dependencies.2.artifactId")); + actualDeps.add(props.getProperty("project.dependencies.3.artifactId")); Collection expectedDeps = new TreeSet<>(); - expectedDeps.add( "parent-dep-b" ); - expectedDeps.add( "child-dep-b" ); - expectedDeps.add( "child-dep-c" ); - expectedDeps.add( "child-dep-d" ); - assertEquals( expectedDeps, actualDeps ); - assertEquals( "2", props.getProperty( "project.dependencyManagement.dependencies" ) ); + expectedDeps.add("parent-dep-b"); + expectedDeps.add("child-dep-b"); + expectedDeps.add("child-dep-c"); + expectedDeps.add("child-dep-d"); + assertEquals(expectedDeps, actualDeps); + assertEquals("2", props.getProperty("project.dependencyManagement.dependencies")); Collection actualMngtDeps = new TreeSet<>(); - actualMngtDeps.add( props.getProperty( "project.dependencyManagement.dependencies.0.artifactId" ) ); - actualMngtDeps.add( props.getProperty( "project.dependencyManagement.dependencies.1.artifactId" ) ); + actualMngtDeps.add(props.getProperty("project.dependencyManagement.dependencies.0.artifactId")); + actualMngtDeps.add(props.getProperty("project.dependencyManagement.dependencies.1.artifactId")); Collection expectedMngtDeps = new TreeSet<>(); - expectedMngtDeps.add( "parent-dep-a" ); - expectedMngtDeps.add( "child-dep-a" ); - assertEquals( expectedMngtDeps, actualMngtDeps ); + expectedMngtDeps.add("parent-dep-a"); + expectedMngtDeps.add("child-dep-a"); + assertEquals(expectedMngtDeps, actualMngtDeps); - basedir = new File( verifier.getBasedir(), "test-3/sub-parent/child-a" ); - props = verifier.loadProperties( "test-3/sub-parent/child-a/target/pom.properties" ); - assertEquals( "../pom.xml", props.getProperty( "project.originalModel.parent.relativePath" ) ); + basedir = new File(verifier.getBasedir(), "test-3/sub-parent/child-a"); + props = verifier.loadProperties("test-3/sub-parent/child-a/target/pom.properties"); + assertEquals("../pom.xml", props.getProperty("project.originalModel.parent.relativePath")); } - private void assertPathEquals( File basedir, String expected, String actual ) - { + private void assertPathEquals(File basedir, String expected, String actual) { // NOTE: Basedir alignment is another issue, so don't test this here - File actualFile = new File( actual ); - if ( actualFile.isAbsolute() ) - { - assertEquals( new File( basedir, expected ), actualFile ); - } - else - { - assertEquals( new File( expected ), actualFile ); + File actualFile = new File(actual); + if (actualFile.isAbsolute()) { + assertEquals(new File(basedir, expected), actualFile); + } else { + assertEquals(new File(expected), actualFile); } } - private void assertUrlCommon( String expected, String actual ) - { + private void assertUrlCommon(String expected, String actual) { // NOTE: URL adjustment is a slightly different issue, so don't test here and merely check for common prefix - assertTrue( "expected " + expected + " but was " + actual, actual.startsWith( expected ) ); + assertTrue("expected " + expected + " but was " + actual, actual.startsWith(expected)); } - private void assertMissing( Properties props, String prefix ) - { - for ( Object o : props.keySet() ) - { + private void assertMissing(Properties props, String prefix) { + for (Object o : props.keySet()) { String key = o.toString(); - assertFalse( "Found unexpected key: " + key, key.startsWith( prefix ) ); + assertFalse("Found unexpected key: " + key, key.startsWith(prefix)); } } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3845LimitedPomInheritanceTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3845LimitedPomInheritanceTest.java index 6253adba5f..eaf8cb9624 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3845LimitedPomInheritanceTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3845LimitedPomInheritanceTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3845LimitedPomInheritanceTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3845LimitedPomInheritanceTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3845LimitedPomInheritanceTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng3845LimitedPomInheritanceTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -48,37 +43,38 @@ public class MavenITmng3845LimitedPomInheritanceTest * @throws Exception in case of failure */ @Test - public void testitMNG3845() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3845" ); + public void testitMNG3845() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3845"); - Verifier verifier = newVerifier( new File( testDir, "child" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(new File(testDir, "child").getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/pom.properties" ); - assertEquals( "child-org", props.getProperty( "project.organization.name", "" ) ); - assertEquals( "", props.getProperty( "project.organization.url", "" ) ); - assertEquals( "http://child.url/issues", props.getProperty( "project.issueManagement.url", "" ) ); - assertEquals( "", props.getProperty( "project.issueManagement.system", "" ) ); - assertEquals( "0", props.getProperty( "project.ciManagement.notifiers", "0" ) ); - assertEquals( "child-distros", props.getProperty( "project.distributionManagement.repository.id", "" ) ); - assertEquals( "ssh://child.url/distros", props.getProperty( "project.distributionManagement.repository.url", "" ) ); - assertEquals( "", props.getProperty( "project.distributionManagement.repository.name", "" ) ); - assertEquals( "true", props.getProperty( "project.distributionManagement.repository.uniqueVersion", "true" ) ); - assertEquals( "default", props.getProperty( "project.distributionManagement.repository.layout", "default" ) ); - assertEquals( "child-snaps", props.getProperty( "project.distributionManagement.snapshotRepository.id", "" ) ); - assertEquals( "ssh://child.url/snaps", props.getProperty( "project.distributionManagement.snapshotRepository.url", "" ) ); - assertEquals( "", props.getProperty( "project.distributionManagement.snapshotRepository.name", "" ) ); - assertEquals( "true", props.getProperty( "project.distributionManagement.snapshotRepository.uniqueVersion", "true" ) ); - assertEquals( "default", props.getProperty( "project.distributionManagement.snapshotRepository.layout", "default" ) ); - assertEquals( "child-site", props.getProperty( "project.distributionManagement.site.id", "" ) ); - assertEquals( "scp://child.url/site", props.getProperty( "project.distributionManagement.site.url", "" ) ); - assertEquals( "", props.getProperty( "project.distributionManagement.site.name", "" ) ); + Properties props = verifier.loadProperties("target/pom.properties"); + assertEquals("child-org", props.getProperty("project.organization.name", "")); + assertEquals("", props.getProperty("project.organization.url", "")); + assertEquals("http://child.url/issues", props.getProperty("project.issueManagement.url", "")); + assertEquals("", props.getProperty("project.issueManagement.system", "")); + assertEquals("0", props.getProperty("project.ciManagement.notifiers", "0")); + assertEquals("child-distros", props.getProperty("project.distributionManagement.repository.id", "")); + assertEquals("ssh://child.url/distros", props.getProperty("project.distributionManagement.repository.url", "")); + assertEquals("", props.getProperty("project.distributionManagement.repository.name", "")); + assertEquals("true", props.getProperty("project.distributionManagement.repository.uniqueVersion", "true")); + assertEquals("default", props.getProperty("project.distributionManagement.repository.layout", "default")); + assertEquals("child-snaps", props.getProperty("project.distributionManagement.snapshotRepository.id", "")); + assertEquals( + "ssh://child.url/snaps", + props.getProperty("project.distributionManagement.snapshotRepository.url", "")); + assertEquals("", props.getProperty("project.distributionManagement.snapshotRepository.name", "")); + assertEquals( + "true", props.getProperty("project.distributionManagement.snapshotRepository.uniqueVersion", "true")); + assertEquals( + "default", props.getProperty("project.distributionManagement.snapshotRepository.layout", "default")); + assertEquals("child-site", props.getProperty("project.distributionManagement.site.id", "")); + assertEquals("scp://child.url/site", props.getProperty("project.distributionManagement.site.url", "")); + assertEquals("", props.getProperty("project.distributionManagement.site.name", "")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3846PomInheritanceUrlAdjustmentTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3846PomInheritanceUrlAdjustmentTest.java index 01ce293beb..835dce4d9a 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3846PomInheritanceUrlAdjustmentTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3846PomInheritanceUrlAdjustmentTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3846PomInheritanceUrlAdjustmentTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3846PomInheritanceUrlAdjustmentTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3846PomInheritanceUrlAdjustmentTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng3846PomInheritanceUrlAdjustmentTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -48,31 +43,30 @@ public class MavenITmng3846PomInheritanceUrlAdjustmentTest * @throws Exception in case of failure */ @Test - public void testitOneParent() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3846" ); + public void testitOneParent() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3846"); - Verifier verifier = newVerifier( new File( testDir, "sub" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(new File(testDir, "sub").getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/pom.properties" ); - assertEquals( "http://parent.url/child", props.getProperty( "project.url" ) ); - assertEquals( "http://parent.url/org/", props.getProperty( "project.organization.url" ) ); - assertEquals( "http://parent.url/license.txt", props.getProperty( "project.licenses.0.url" ) ); - assertEquals( "http://parent.url/viewvc/child", props.getProperty( "project.scm.url" ) ); - assertEquals( "http://parent.url/scm/child", props.getProperty( "project.scm.connection" ) ); - assertEquals( "https://parent.url/scm/child", props.getProperty( "project.scm.developerConnection" ) ); - assertEquals( "http://parent.url/issues", props.getProperty( "project.issueManagement.url" ) ); - assertEquals( "http://parent.url/ci", props.getProperty( "project.ciManagement.url" ) ); - assertEquals( "http://parent.url/dist", props.getProperty( "project.distributionManagement.repository.url" ) ); - assertEquals( "http://parent.url/snaps", props.getProperty( "project.distributionManagement.snapshotRepository.url" ) ); - assertEquals( "http://parent.url/site/child", props.getProperty( "project.distributionManagement.site.url" ) ); - assertEquals( "http://parent.url/download", props.getProperty( "project.distributionManagement.downloadUrl" ) ); + Properties props = verifier.loadProperties("target/pom.properties"); + assertEquals("http://parent.url/child", props.getProperty("project.url")); + assertEquals("http://parent.url/org/", props.getProperty("project.organization.url")); + assertEquals("http://parent.url/license.txt", props.getProperty("project.licenses.0.url")); + assertEquals("http://parent.url/viewvc/child", props.getProperty("project.scm.url")); + assertEquals("http://parent.url/scm/child", props.getProperty("project.scm.connection")); + assertEquals("https://parent.url/scm/child", props.getProperty("project.scm.developerConnection")); + assertEquals("http://parent.url/issues", props.getProperty("project.issueManagement.url")); + assertEquals("http://parent.url/ci", props.getProperty("project.ciManagement.url")); + assertEquals("http://parent.url/dist", props.getProperty("project.distributionManagement.repository.url")); + assertEquals( + "http://parent.url/snaps", props.getProperty("project.distributionManagement.snapshotRepository.url")); + assertEquals("http://parent.url/site/child", props.getProperty("project.distributionManagement.site.url")); + assertEquals("http://parent.url/download", props.getProperty("project.distributionManagement.downloadUrl")); } /** @@ -82,31 +76,29 @@ public class MavenITmng3846PomInheritanceUrlAdjustmentTest * @throws Exception in case of failure */ @Test - public void testitTwoParents() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3846" ); + public void testitTwoParents() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3846"); - Verifier verifier = newVerifier( new File( testDir, "another-parent/sub" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(new File(testDir, "another-parent/sub").getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/pom.properties" ); - assertEquals( "http://parent.url/ap/child", props.getProperty( "project.url" ) ); - assertEquals( "http://parent.url/org/", props.getProperty( "project.organization.url" ) ); - assertEquals( "http://parent.url/license.txt", props.getProperty( "project.licenses.0.url" ) ); - assertEquals( "http://parent.url/viewvc/ap/child", props.getProperty( "project.scm.url" ) ); - assertEquals( "http://parent.url/scm/ap/child", props.getProperty( "project.scm.connection" ) ); - assertEquals( "https://parent.url/scm/ap/child", props.getProperty( "project.scm.developerConnection" ) ); - assertEquals( "http://parent.url/issues", props.getProperty( "project.issueManagement.url" ) ); - assertEquals( "http://parent.url/ci", props.getProperty( "project.ciManagement.url" ) ); - assertEquals( "http://parent.url/dist", props.getProperty( "project.distributionManagement.repository.url" ) ); - assertEquals( "http://parent.url/snaps", props.getProperty( "project.distributionManagement.snapshotRepository.url" ) ); - assertEquals( "http://parent.url/site/ap/child", props.getProperty( "project.distributionManagement.site.url" ) ); - assertEquals( "http://parent.url/download", props.getProperty( "project.distributionManagement.downloadUrl" ) ); + Properties props = verifier.loadProperties("target/pom.properties"); + assertEquals("http://parent.url/ap/child", props.getProperty("project.url")); + assertEquals("http://parent.url/org/", props.getProperty("project.organization.url")); + assertEquals("http://parent.url/license.txt", props.getProperty("project.licenses.0.url")); + assertEquals("http://parent.url/viewvc/ap/child", props.getProperty("project.scm.url")); + assertEquals("http://parent.url/scm/ap/child", props.getProperty("project.scm.connection")); + assertEquals("https://parent.url/scm/ap/child", props.getProperty("project.scm.developerConnection")); + assertEquals("http://parent.url/issues", props.getProperty("project.issueManagement.url")); + assertEquals("http://parent.url/ci", props.getProperty("project.ciManagement.url")); + assertEquals("http://parent.url/dist", props.getProperty("project.distributionManagement.repository.url")); + assertEquals( + "http://parent.url/snaps", props.getProperty("project.distributionManagement.snapshotRepository.url")); + assertEquals("http://parent.url/site/ap/child", props.getProperty("project.distributionManagement.site.url")); + assertEquals("http://parent.url/download", props.getProperty("project.distributionManagement.downloadUrl")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3852PluginConfigWithHeterogeneousListTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3852PluginConfigWithHeterogeneousListTest.java index bdde1ed872..ad9393d16b 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3852PluginConfigWithHeterogeneousListTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3852PluginConfigWithHeterogeneousListTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3852PluginConfigWithHeterogeneousListTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3852PluginConfigWithHeterogeneousListTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3852PluginConfigWithHeterogeneousListTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng3852PluginConfigWithHeterogeneousListTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -49,26 +44,25 @@ public class MavenITmng3852PluginConfigWithHeterogeneousListTest * @throws Exception in case of failure */ @Test - public void testitMNG3852() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3852" ); + public void testitMNG3852() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3852"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/plugin-config.properties" ); + Properties props = verifier.loadProperties("target/plugin-config.properties"); - assertEquals( "5", props.getProperty( "listParam" ) ); - assertEquals( "one", props.getProperty( "listParam.0" ) ); - assertEquals( "two", props.getProperty( "listParam.1" ) ); - assertEquals( "three", props.getProperty( "listParam.3" ) ); - assertEquals( "four", props.getProperty( "listParam.4" ) ); - assertEquals( "org.apache.maven.plugin.coreit.Bean", props.getProperty( "listParam.2" ).substring( 0, 35 ) ); + assertEquals("5", props.getProperty("listParam")); + assertEquals("one", props.getProperty("listParam.0")); + assertEquals("two", props.getProperty("listParam.1")); + assertEquals("three", props.getProperty("listParam.3")); + assertEquals("four", props.getProperty("listParam.4")); + assertEquals( + "org.apache.maven.plugin.coreit.Bean", + props.getProperty("listParam.2").substring(0, 35)); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3853ProfileInjectedDistReposTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3853ProfileInjectedDistReposTest.java index 655b524b22..ce8e525eaa 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3853ProfileInjectedDistReposTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3853ProfileInjectedDistReposTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3853ProfileInjectedDistReposTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3853ProfileInjectedDistReposTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3853ProfileInjectedDistReposTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng3853ProfileInjectedDistReposTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -52,22 +47,19 @@ public class MavenITmng3853ProfileInjectedDistReposTest * @throws Exception in case of failure */ @Test - public void testitMNG3853() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3853" ); + public void testitMNG3853() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3853"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "-Pcoreit" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("-Pcoreit"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/dist.properties" ); - assertEquals( "1", props.getProperty( "listParam" ) ); - assertEquals( "maven-core-it", props.getProperty( "listParam.0" ) ); + Properties props = verifier.loadProperties("target/dist.properties"); + assertEquals("1", props.getProperty("listParam")); + assertEquals("maven-core-it", props.getProperty("listParam.0")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3863AutoPluginGroupIdTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3863AutoPluginGroupIdTest.java index 837ce12a29..39184a4434 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3863AutoPluginGroupIdTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3863AutoPluginGroupIdTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3863AutoPluginGroupIdTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3863AutoPluginGroupIdTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3863AutoPluginGroupIdTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng3863AutoPluginGroupIdTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -48,25 +43,19 @@ public class MavenITmng3863AutoPluginGroupIdTest * @throws Exception in case of failure */ @Test - public void testitMNG3853() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3863" ); + public void testitMNG3853() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3863"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - try - { - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + try { + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - fail( "Validation step did not detect missing groupId for dependency" ); - } - catch ( VerificationException e ) - { + fail("Validation step did not detect missing groupId for dependency"); + } catch (VerificationException e) { // expected } } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3864PerExecPluginConfigTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3864PerExecPluginConfigTest.java index 5974e78963..527799407e 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3864PerExecPluginConfigTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3864PerExecPluginConfigTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3864PerExecPluginConfigTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3864PerExecPluginConfigTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3864PerExecPluginConfigTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng3864PerExecPluginConfigTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -48,65 +43,62 @@ public class MavenITmng3864PerExecPluginConfigTest * @throws Exception in case of failure */ @Test - public void testitMNG3864() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3864" ); + public void testitMNG3864() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3864"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/plugin-config.properties" ); + Properties props = verifier.loadProperties("target/plugin-config.properties"); - assertCanonicalFileEquals( new File( testDir, "pom.xml" ), new File( props.getProperty( "fileParam" ) ) ); - assertEquals( "true", props.getProperty( "booleanParam" ) ); - assertEquals( "42", props.getProperty( "byteParam" ) ); - assertEquals( "-12345", props.getProperty( "shortParam" ) ); - assertEquals( "0", props.getProperty( "integerParam" ) ); - assertEquals( "9876543210", props.getProperty( "longParam" ) ); - assertEquals( "0.0", props.getProperty( "floatParam" ) ); - assertEquals( "-1.5", props.getProperty( "doubleParam" ) ); - assertEquals( "X", props.getProperty( "characterParam" ) ); - assertEquals( "Hello World!", props.getProperty( "stringParam" ) ); - assertEquals( "2008-11-09 11:59:03", props.getProperty( "dateParam" ) ); - assertEquals( "http://maven.apache.org/", props.getProperty( "urlParam" ) ); + assertCanonicalFileEquals(new File(testDir, "pom.xml"), new File(props.getProperty("fileParam"))); + assertEquals("true", props.getProperty("booleanParam")); + assertEquals("42", props.getProperty("byteParam")); + assertEquals("-12345", props.getProperty("shortParam")); + assertEquals("0", props.getProperty("integerParam")); + assertEquals("9876543210", props.getProperty("longParam")); + assertEquals("0.0", props.getProperty("floatParam")); + assertEquals("-1.5", props.getProperty("doubleParam")); + assertEquals("X", props.getProperty("characterParam")); + assertEquals("Hello World!", props.getProperty("stringParam")); + assertEquals("2008-11-09 11:59:03", props.getProperty("dateParam")); + assertEquals("http://maven.apache.org/", props.getProperty("urlParam")); - assertEquals( "4", props.getProperty( "stringParams" ) ); - assertEquals( "one", props.getProperty( "stringParams.0" ) ); - assertEquals( "two", props.getProperty( "stringParams.1" ) ); - assertEquals( "three", props.getProperty( "stringParams.2" ) ); - assertEquals( "four", props.getProperty( "stringParams.3" ) ); + assertEquals("4", props.getProperty("stringParams")); + assertEquals("one", props.getProperty("stringParams.0")); + assertEquals("two", props.getProperty("stringParams.1")); + assertEquals("three", props.getProperty("stringParams.2")); + assertEquals("four", props.getProperty("stringParams.3")); - assertEquals( "4", props.getProperty( "listParam" ) ); - assertEquals( "one", props.getProperty( "listParam.0" ) ); - assertEquals( "two", props.getProperty( "listParam.1" ) ); - assertEquals( "three", props.getProperty( "listParam.2" ) ); - assertEquals( "four", props.getProperty( "listParam.3" ) ); + assertEquals("4", props.getProperty("listParam")); + assertEquals("one", props.getProperty("listParam.0")); + assertEquals("two", props.getProperty("listParam.1")); + assertEquals("three", props.getProperty("listParam.2")); + assertEquals("four", props.getProperty("listParam.3")); - assertEquals( "1", props.getProperty( "setParam" ) ); - assertEquals( "item", props.getProperty( "setParam.0" ) ); + assertEquals("1", props.getProperty("setParam")); + assertEquals("item", props.getProperty("setParam.0")); - assertEquals( "2", props.getProperty( "mapParam" ) ); - assertEquals( "value1", props.getProperty( "mapParam.key1" ) ); - assertEquals( "value2", props.getProperty( "mapParam.key2" ) ); + assertEquals("2", props.getProperty("mapParam")); + assertEquals("value1", props.getProperty("mapParam.key1")); + assertEquals("value2", props.getProperty("mapParam.key2")); - assertEquals( "2", props.getProperty( "propertiesParam" ) ); - assertEquals( "value1", props.getProperty( "propertiesParam.key1" ) ); - assertEquals( "value2", props.getProperty( "propertiesParam.key2" ) ); + assertEquals("2", props.getProperty("propertiesParam")); + assertEquals("value1", props.getProperty("propertiesParam.key1")); + assertEquals("value2", props.getProperty("propertiesParam.key2")); - assertEquals( "field", props.getProperty( "beanParam.fieldParam" ) ); - assertEquals( "setter", props.getProperty( "beanParam.setterParam" ) ); - assertEquals( "true", props.getProperty( "beanParam.setterCalled" ) ); + assertEquals("field", props.getProperty("beanParam.fieldParam")); + assertEquals("setter", props.getProperty("beanParam.setterParam")); + assertEquals("true", props.getProperty("beanParam.setterCalled")); - assertEquals( "4", props.getProperty( "domParam.children" ) ); - assertEquals( "one", props.getProperty( "domParam.children.echo.0.value" ) ); - assertEquals( "two", props.getProperty( "domParam.children.echo.1.value" ) ); - assertEquals( "three", props.getProperty( "domParam.children.echo.2.value" ) ); - assertEquals( "four", props.getProperty( "domParam.children.echo.3.value" ) ); + assertEquals("4", props.getProperty("domParam.children")); + assertEquals("one", props.getProperty("domParam.children.echo.0.value")); + assertEquals("two", props.getProperty("domParam.children.echo.1.value")); + assertEquals("three", props.getProperty("domParam.children.echo.2.value")); + assertEquals("four", props.getProperty("domParam.children.echo.3.value")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3866PluginConfigInheritanceTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3866PluginConfigInheritanceTest.java index 3ebf0ca811..ef8e2dbfb6 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3866PluginConfigInheritanceTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3866PluginConfigInheritanceTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3866PluginConfigInheritanceTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3866PluginConfigInheritanceTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3866PluginConfigInheritanceTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng3866PluginConfigInheritanceTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -49,20 +44,17 @@ public class MavenITmng3866PluginConfigInheritanceTest * @throws Exception in case of failure */ @Test - public void testitMNG3866() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3866" ); + public void testitMNG3866() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3866"); - Verifier verifier = newVerifier( new File( testDir, "sub" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(new File(testDir, "sub").getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/plugin-config.properties" ); - assertEquals( "PASSED", props.getProperty( "stringParam" ) ); + Properties props = verifier.loadProperties("target/plugin-config.properties"); + assertEquals("PASSED", props.getProperty("stringParam")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3872ProfileActivationInRelocatedPomTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3872ProfileActivationInRelocatedPomTest.java index ffe33d1436..fc054957e1 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3872ProfileActivationInRelocatedPomTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3872ProfileActivationInRelocatedPomTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng3872ProfileActivationInRelocatedPomTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3872ProfileActivationInRelocatedPomTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3872ProfileActivationInRelocatedPomTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng3872ProfileActivationInRelocatedPomTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -47,26 +42,23 @@ public class MavenITmng3872ProfileActivationInRelocatedPomTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3872" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3872"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng3872" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng3872"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List compileClassPath = verifier.loadLines( "target/compile.txt", "UTF-8" ); - assertTrue( compileClassPath.toString(), compileClassPath.contains( "a-0.1.jar" ) ); - assertTrue( compileClassPath.toString(), compileClassPath.contains( "b-0.1.jar" ) ); - assertFalse( compileClassPath.toString(), compileClassPath.contains( "c-0.1.jar" ) ); + List compileClassPath = verifier.loadLines("target/compile.txt", "UTF-8"); + assertTrue(compileClassPath.toString(), compileClassPath.contains("a-0.1.jar")); + assertTrue(compileClassPath.toString(), compileClassPath.contains("b-0.1.jar")); + assertFalse(compileClassPath.toString(), compileClassPath.contains("c-0.1.jar")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3873MultipleExecutionGoalsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3873MultipleExecutionGoalsTest.java index 2be8c23aca..d3d6f6dbf8 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3873MultipleExecutionGoalsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3873MultipleExecutionGoalsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3873MultipleExecutionGoalsTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3873MultipleExecutionGoalsTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3873MultipleExecutionGoalsTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng3873MultipleExecutionGoalsTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -49,10 +44,8 @@ public class MavenITmng3873MultipleExecutionGoalsTest * @throws Exception in case of failure */ @Test - public void testitWithoutPluginMngt() - throws Exception - { - testitMNG3873( "test-1" ); + public void testitWithoutPluginMngt() throws Exception { + testitMNG3873("test-1"); } /** @@ -62,30 +55,25 @@ public class MavenITmng3873MultipleExecutionGoalsTest * @throws Exception in case of failure */ @Test - public void testitWithPluginMngt() - throws Exception - { - testitMNG3873( "test-2" ); + public void testitWithPluginMngt() throws Exception { + testitMNG3873("test-2"); } - private void testitMNG3873( String project ) - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3873" ); + private void testitMNG3873(String project) throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3873"); - Verifier verifier = newVerifier( new File( testDir, project ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(new File(testDir, project).getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); /* * NOTE: We deliberately don't check the exact order here, that's another issue. */ - List lines = verifier.loadLines( "target/it.log", "UTF-8" ); - assertTrue( lines.toString(), lines.contains( "test" ) ); - assertTrue( lines.toString(), lines.contains( "----" ) ); + List lines = verifier.loadLines("target/it.log", "UTF-8"); + assertTrue(lines.toString(), lines.contains("test")); + assertTrue(lines.toString(), lines.contains("----")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3877BasedirAlignedModelTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3877BasedirAlignedModelTest.java index c1ccb59d0f..a056035764 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3877BasedirAlignedModelTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3877BasedirAlignedModelTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.io.IOException; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -34,13 +32,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3877BasedirAlignedModelTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3877BasedirAlignedModelTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3877BasedirAlignedModelTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng3877BasedirAlignedModelTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -49,55 +44,50 @@ public class MavenITmng3877BasedirAlignedModelTest * @throws Exception in case of failure */ @Test - public void testitMNG3877() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3877" ); + public void testitMNG3877() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3877"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties modelProps = verifier.loadProperties( "target/model.properties" ); + Properties modelProps = verifier.loadProperties("target/model.properties"); - assertPathEquals( testDir, "target", modelProps.getProperty( "project.build.directory" ) ); + assertPathEquals(testDir, "target", modelProps.getProperty("project.build.directory")); - assertPathEquals( testDir, "target/classes", modelProps.getProperty( "project.build.outputDirectory" ) ); + assertPathEquals(testDir, "target/classes", modelProps.getProperty("project.build.outputDirectory")); - assertPathEquals( testDir, "target/test-classes", modelProps.getProperty( "project.build.testOutputDirectory" ) ); + assertPathEquals(testDir, "target/test-classes", modelProps.getProperty("project.build.testOutputDirectory")); - assertPathEquals( testDir, "src/main/java", modelProps.getProperty( "project.build.sourceDirectory" ) ); - assertPathEquals( testDir, "src/main/java", modelProps.getProperty( "project.compileSourceRoots.0" ) ); + assertPathEquals(testDir, "src/main/java", modelProps.getProperty("project.build.sourceDirectory")); + assertPathEquals(testDir, "src/main/java", modelProps.getProperty("project.compileSourceRoots.0")); - assertPathEquals( testDir, "src/test/java", modelProps.getProperty( "project.build.testSourceDirectory" ) ); - assertPathEquals( testDir, "src/test/java", modelProps.getProperty( "project.testCompileSourceRoots.0" ) ); + assertPathEquals(testDir, "src/test/java", modelProps.getProperty("project.build.testSourceDirectory")); + assertPathEquals(testDir, "src/test/java", modelProps.getProperty("project.testCompileSourceRoots.0")); - assertPathEquals( testDir, "src/main/resources", modelProps.getProperty( "project.build.resources.0.directory" ) ); + assertPathEquals(testDir, "src/main/resources", modelProps.getProperty("project.build.resources.0.directory")); - assertPathEquals( testDir, "src/test/resources", modelProps.getProperty( "project.build.testResources.0.directory" ) ); + assertPathEquals( + testDir, "src/test/resources", modelProps.getProperty("project.build.testResources.0.directory")); - assertPathEquals( testDir, "src/main/filters/it.properties", modelProps.getProperty( "project.build.filters.0" ) ); + assertPathEquals(testDir, "src/main/filters/it.properties", modelProps.getProperty("project.build.filters.0")); /* * NOTE: The script source directory is deliberately excluded from the checks due to MNG-3741. */ // MNG-3877 - if ( matchesVersionRange( "[3.0-alpha-3,)" ) ) - { - assertPathEquals( testDir, "target/site", modelProps.getProperty( "project.reporting.outputDirectory" ) ); + if (matchesVersionRange("[3.0-alpha-3,)")) { + assertPathEquals(testDir, "target/site", modelProps.getProperty("project.reporting.outputDirectory")); } } - private void assertPathEquals( File basedir, String expected, String actual ) - throws IOException - { - File actualFile = new File( actual ); - assertTrue( "path not absolute: " + actualFile, actualFile.isAbsolute() ); - assertCanonicalFileEquals( new File( basedir, expected ), actualFile ); + private void assertPathEquals(File basedir, String expected, String actual) throws IOException { + File actualFile = new File(actual); + assertTrue("path not absolute: " + actualFile, actualFile.isAbsolute()); + assertCanonicalFileEquals(new File(basedir, expected), actualFile); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3886ExecutionGoalsOrderTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3886ExecutionGoalsOrderTest.java index b15ef45190..ec568d70aa 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3886ExecutionGoalsOrderTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3886ExecutionGoalsOrderTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Arrays; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -34,13 +32,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3886ExecutionGoalsOrderTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3886ExecutionGoalsOrderTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3886ExecutionGoalsOrderTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng3886ExecutionGoalsOrderTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -50,10 +45,8 @@ public class MavenITmng3886ExecutionGoalsOrderTest * @throws Exception in case of failure */ @Test - public void testitWithoutPluginMngt() - throws Exception - { - testitMNG3886( "test-1" ); + public void testitWithoutPluginMngt() throws Exception { + testitMNG3886("test-1"); } /** @@ -63,26 +56,21 @@ public class MavenITmng3886ExecutionGoalsOrderTest * @throws Exception in case of failure */ @Test - public void testitWithPluginMngt() - throws Exception - { - testitMNG3886( "test-2" ); + public void testitWithPluginMngt() throws Exception { + testitMNG3886("test-2"); } - private void testitMNG3886( String project ) - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3886" ); + private void testitMNG3886(String project) throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3886"); - Verifier verifier = newVerifier( new File( testDir, project ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(new File(testDir, project).getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List lines = verifier.loadLines( "target/it.log", "UTF-8" ); - assertEquals( Arrays.asList( new String[] { "test", "----" } ), lines ); + List lines = verifier.loadLines("target/it.log", "UTF-8"); + assertEquals(Arrays.asList(new String[] {"test", "----"}), lines); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3887PluginExecutionOrderTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3887PluginExecutionOrderTest.java index ef13509e29..5e4dca64cb 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3887PluginExecutionOrderTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3887PluginExecutionOrderTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Arrays; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -34,13 +32,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3887PluginExecutionOrderTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3887PluginExecutionOrderTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3887PluginExecutionOrderTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng3887PluginExecutionOrderTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -50,10 +45,8 @@ public class MavenITmng3887PluginExecutionOrderTest * @throws Exception in case of failure */ @Test - public void testitWithoutPluginMngt() - throws Exception - { - testitMNG3887( "test-1" ); + public void testitWithoutPluginMngt() throws Exception { + testitMNG3887("test-1"); } /** @@ -63,26 +56,21 @@ public class MavenITmng3887PluginExecutionOrderTest * @throws Exception in case of failure */ @Test - public void testitWithPluginMngt() - throws Exception - { - testitMNG3887( "test-2" ); + public void testitWithPluginMngt() throws Exception { + testitMNG3887("test-2"); } - private void testitMNG3887( String project ) - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3887" ); + private void testitMNG3887(String project) throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3887"); - Verifier verifier = newVerifier( new File( testDir, project ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(new File(testDir, project).getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List lines = verifier.loadLines( "target/it.log", "UTF-8" ); - assertEquals( Arrays.asList( new String[] { "test", "----" } ), lines ); + List lines = verifier.loadLines("target/it.log", "UTF-8"); + assertEquals(Arrays.asList(new String[] {"test", "----"}), lines); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3890TransitiveDependencyScopeUpdateTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3890TransitiveDependencyScopeUpdateTest.java index a1674cda03..9ad5bb3328 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3890TransitiveDependencyScopeUpdateTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3890TransitiveDependencyScopeUpdateTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; @@ -34,13 +32,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -@Disabled( "won't fix" ) -public class MavenITmng3890TransitiveDependencyScopeUpdateTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng3890TransitiveDependencyScopeUpdateTest() - { - super( ALL_MAVEN_VERSIONS ); +@Disabled("won't fix") +public class MavenITmng3890TransitiveDependencyScopeUpdateTest extends AbstractMavenIntegrationTestCase { + public MavenITmng3890TransitiveDependencyScopeUpdateTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -50,26 +45,23 @@ public class MavenITmng3890TransitiveDependencyScopeUpdateTest * @throws Exception in case of failure */ @Test - public void testitMNG3890() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3890" ); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng3890" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + public void testitMNG3890() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3890"); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng3890"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List artifacts = verifier.loadLines( "target/artifacts.txt", "UTF-8" ); - assertTrue( artifacts.toString(), artifacts.contains( "org.apache.maven.its.mng3890:c:jar:0.1" ) ); - assertTrue( artifacts.toString(), artifacts.contains( "org.apache.maven.its.mng3890:b:jar:0.1" ) ); - assertFalse( artifacts.toString(), artifacts.contains( "org.apache.maven.its.mng3890:a:jar:0.1" ) ); - assertEquals( 2, artifacts.size() ); + List artifacts = verifier.loadLines("target/artifacts.txt", "UTF-8"); + assertTrue(artifacts.toString(), artifacts.contains("org.apache.maven.its.mng3890:c:jar:0.1")); + assertTrue(artifacts.toString(), artifacts.contains("org.apache.maven.its.mng3890:b:jar:0.1")); + assertFalse(artifacts.toString(), artifacts.contains("org.apache.maven.its.mng3890:a:jar:0.1")); + assertEquals(2, artifacts.size()); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3892ReleaseDeploymentTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3892ReleaseDeploymentTest.java index 43f807eba4..f2bc3767b2 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3892ReleaseDeploymentTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3892ReleaseDeploymentTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Locale; import org.apache.maven.shared.utils.io.FileUtils; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -34,13 +32,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3892ReleaseDeploymentTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3892ReleaseDeploymentTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3892ReleaseDeploymentTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng3892ReleaseDeploymentTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -50,57 +45,49 @@ public class MavenITmng3892ReleaseDeploymentTest * @throws Exception in case of failure */ @Test - public void testitMNG3892() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3892" ); + public void testitMNG3892() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3892"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "repo" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng3892" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("repo"); + verifier.deleteArtifacts("org.apache.maven.its.mng3892"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng3892", "test", "1.0", "pom" ); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng3892", "test", "1.0", "jar" ); + verifier.verifyArtifactPresent("org.apache.maven.its.mng3892", "test", "1.0", "pom"); + verifier.verifyArtifactPresent("org.apache.maven.its.mng3892", "test", "1.0", "jar"); String groupDir = "repo/org/apache/maven/its/mng3892/test/"; - verifier.verifyFilePresent( groupDir + "maven-metadata.xml" ); - verifier.verifyFilePresent( groupDir + "maven-metadata.xml.md5" ); - verifier.verifyFilePresent( groupDir + "maven-metadata.xml.sha1" ); - verifier.verifyFilePresent( groupDir + "1.0/test-1.0.pom" ); - verifier.verifyFilePresent( groupDir + "1.0/test-1.0.pom.md5" ); - verifier.verifyFilePresent( groupDir + "1.0/test-1.0.pom.sha1" ); - verifier.verifyFilePresent( groupDir + "1.0/test-1.0.jar" ); - verifier.verifyFilePresent( groupDir + "1.0/test-1.0.jar.md5" ); - verifier.verifyFilePresent( groupDir + "1.0/test-1.0.jar.sha1" ); - verifier.verifyFilePresent( groupDir + "1.0/test-1.0-it.jar" ); - verifier.verifyFilePresent( groupDir + "1.0/test-1.0-it.jar.md5" ); - verifier.verifyFilePresent( groupDir + "1.0/test-1.0-it.jar.sha1" ); + verifier.verifyFilePresent(groupDir + "maven-metadata.xml"); + verifier.verifyFilePresent(groupDir + "maven-metadata.xml.md5"); + verifier.verifyFilePresent(groupDir + "maven-metadata.xml.sha1"); + verifier.verifyFilePresent(groupDir + "1.0/test-1.0.pom"); + verifier.verifyFilePresent(groupDir + "1.0/test-1.0.pom.md5"); + verifier.verifyFilePresent(groupDir + "1.0/test-1.0.pom.sha1"); + verifier.verifyFilePresent(groupDir + "1.0/test-1.0.jar"); + verifier.verifyFilePresent(groupDir + "1.0/test-1.0.jar.md5"); + verifier.verifyFilePresent(groupDir + "1.0/test-1.0.jar.sha1"); + verifier.verifyFilePresent(groupDir + "1.0/test-1.0-it.jar"); + verifier.verifyFilePresent(groupDir + "1.0/test-1.0-it.jar.md5"); + verifier.verifyFilePresent(groupDir + "1.0/test-1.0-it.jar.sha1"); - verify( testDir, groupDir + "1.0/test-1.0.jar.md5", "dd89c30cc71c3cd8a729622243c76770" ); - verify( testDir, groupDir + "1.0/test-1.0.jar.sha1", "0b0717ff89d3cbadc3564270bf8930163753bf71" ); - verify( testDir, groupDir + "1.0/test-1.0-it.jar.md5", "dd89c30cc71c3cd8a729622243c76770" ); - verify( testDir, groupDir + "1.0/test-1.0-it.jar.sha1", "0b0717ff89d3cbadc3564270bf8930163753bf71" ); + verify(testDir, groupDir + "1.0/test-1.0.jar.md5", "dd89c30cc71c3cd8a729622243c76770"); + verify(testDir, groupDir + "1.0/test-1.0.jar.sha1", "0b0717ff89d3cbadc3564270bf8930163753bf71"); + verify(testDir, groupDir + "1.0/test-1.0-it.jar.md5", "dd89c30cc71c3cd8a729622243c76770"); + verify(testDir, groupDir + "1.0/test-1.0-it.jar.sha1", "0b0717ff89d3cbadc3564270bf8930163753bf71"); } - private void verify( File testDir, String file, String checksum ) - throws Exception - { - assertEquals( file, checksum, readChecksum( new File( testDir, file ) ) ); + private void verify(File testDir, String file, String checksum) throws Exception { + assertEquals(file, checksum, readChecksum(new File(testDir, file))); } - private String readChecksum( File checksumFile ) - throws Exception - { - String checksum = FileUtils.fileRead( checksumFile, "UTF-8" ).trim(); - if ( checksum.indexOf( ' ' ) >= 0 ) - { - checksum = checksum.substring( 0, checksum.indexOf( ' ' ) ); + private String readChecksum(File checksumFile) throws Exception { + String checksum = FileUtils.fileRead(checksumFile, "UTF-8").trim(); + if (checksum.indexOf(' ') >= 0) { + checksum = checksum.substring(0, checksum.indexOf(' ')); } - return checksum.toLowerCase( Locale.ENGLISH ); + return checksum.toLowerCase(Locale.ENGLISH); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3899ExtensionInheritanceTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3899ExtensionInheritanceTest.java index 0a68a7daef..23a421261d 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3899ExtensionInheritanceTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3899ExtensionInheritanceTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3899ExtensionInheritanceTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3899ExtensionInheritanceTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3899ExtensionInheritanceTest() - { - super( "(2.0.10,2.1.0-M1),(2.1.0-M1,)" ); + public MavenITmng3899ExtensionInheritanceTest() { + super("(2.0.10,2.1.0-M1),(2.1.0-M1,)"); } /** @@ -48,30 +43,27 @@ public class MavenITmng3899ExtensionInheritanceTest * @throws Exception in case of failure */ @Test - public void testitMNG3899() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3899" ); + public void testitMNG3899() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3899"); - Verifier verifier = newVerifier( new File( testDir, "sub" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng3899" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(new File(testDir, "sub").getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng3899"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/extension.properties" ); - assertEquals( "3", props.getProperty( "project.build.extensions" ) ); - assertEquals( "b", props.getProperty( "project.build.extensions.0.artifactId" ) ); - assertEquals( "0.1", props.getProperty( "project.build.extensions.0.version" ) ); - assertEquals( "a", props.getProperty( "project.build.extensions.1.artifactId" ) ); - assertEquals( "0.2", props.getProperty( "project.build.extensions.1.version" ) ); - assertEquals( "c", props.getProperty( "project.build.extensions.2.artifactId" ) ); - assertEquals( "0.1", props.getProperty( "project.build.extensions.2.version" ) ); + Properties props = verifier.loadProperties("target/extension.properties"); + assertEquals("3", props.getProperty("project.build.extensions")); + assertEquals("b", props.getProperty("project.build.extensions.0.artifactId")); + assertEquals("0.1", props.getProperty("project.build.extensions.0.version")); + assertEquals("a", props.getProperty("project.build.extensions.1.artifactId")); + assertEquals("0.2", props.getProperty("project.build.extensions.1.version")); + assertEquals("c", props.getProperty("project.build.extensions.2.artifactId")); + assertEquals("0.1", props.getProperty("project.build.extensions.2.version")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3900ProfilePropertiesInterpolationTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3900ProfilePropertiesInterpolationTest.java index 0df483ef8f..f7b06eead0 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3900ProfilePropertiesInterpolationTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3900ProfilePropertiesInterpolationTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3900ProfilePropertiesInterpolationTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3900ProfilePropertiesInterpolationTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3900ProfilePropertiesInterpolationTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng3900ProfilePropertiesInterpolationTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -48,23 +43,20 @@ public class MavenITmng3900ProfilePropertiesInterpolationTest * @throws Exception in case of failure */ @Test - public void testitMNG3900() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3900" ); + public void testitMNG3900() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3900"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "-Pinterpolation-profile" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("-Pinterpolation-profile"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/pom.properties" ); - assertEquals( "PASSED", props.getProperty( "project.properties.test" ) ); - assertEquals( "PASSED", props.getProperty( "project.properties.property" ) ); - assertEquals( "http://maven.apache.org/PASSED", props.getProperty( "project.url" ) ); + Properties props = verifier.loadProperties("target/pom.properties"); + assertEquals("PASSED", props.getProperty("project.properties.test")); + assertEquals("PASSED", props.getProperty("project.properties.property")); + assertEquals("http://maven.apache.org/PASSED", props.getProperty("project.url")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3904NestedBuildDirInterpolationTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3904NestedBuildDirInterpolationTest.java index d01f05b8f3..135f1ed6d3 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3904NestedBuildDirInterpolationTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3904NestedBuildDirInterpolationTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3904NestedBuildDirInterpolationTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3904NestedBuildDirInterpolationTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3904NestedBuildDirInterpolationTest() - { - super( "[2.1.0-M1,)" ); + public MavenITmng3904NestedBuildDirInterpolationTest() { + super("[2.1.0-M1,)"); } /** @@ -49,25 +44,22 @@ public class MavenITmng3904NestedBuildDirInterpolationTest * @throws Exception in case of failure */ @Test - public void testitMNG3904() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3904" ); + public void testitMNG3904() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3904"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/pom.properties" ); - assertCanonicalFileEquals( new File( testDir, "target/classes/dir0" ), - new File( props.getProperty( "project.properties.dir0" ) ) ); - assertCanonicalFileEquals( new File( testDir, "src/test/dir1" ), - new File( props.getProperty( "project.properties.dir1" ) ) ); - assertCanonicalFileEquals( new File( testDir, "target/site/dir2" ), - new File( props.getProperty( "project.properties.dir2" ) ) ); + Properties props = verifier.loadProperties("target/pom.properties"); + assertCanonicalFileEquals( + new File(testDir, "target/classes/dir0"), new File(props.getProperty("project.properties.dir0"))); + assertCanonicalFileEquals( + new File(testDir, "src/test/dir1"), new File(props.getProperty("project.properties.dir1"))); + assertCanonicalFileEquals( + new File(testDir, "target/site/dir2"), new File(props.getProperty("project.properties.dir2"))); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3906MergedPluginClassPathOrderingTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3906MergedPluginClassPathOrderingTest.java index 35c541a6ee..5ce9b4438c 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3906MergedPluginClassPathOrderingTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3906MergedPluginClassPathOrderingTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3906MergedPluginClassPathOrderingTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3906MergedPluginClassPathOrderingTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3906MergedPluginClassPathOrderingTest() - { - super( "(2.0.10,2.1.0-M1),(2.1.0-M1,)" ); + public MavenITmng3906MergedPluginClassPathOrderingTest() { + super("(2.0.10,2.1.0-M1),(2.1.0-M1,)"); } /** @@ -48,39 +43,41 @@ public class MavenITmng3906MergedPluginClassPathOrderingTest * @throws Exception in case of failure */ @Test - public void testitMNG3906() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3906" ); + public void testitMNG3906() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3906"); - Verifier verifier = newVerifier( new File( testDir, "sub" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng3906" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(new File(testDir, "sub").getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng3906"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties pclProps = verifier.loadProperties( "target/pcl.properties" ); + Properties pclProps = verifier.loadProperties("target/pcl.properties"); String className = "org.apache.maven.its.mng3906.SomeClass"; - String resName = className.replace( '.', '/' ) + ".class"; + String resName = className.replace('.', '/') + ".class"; - assertEquals( "5", pclProps.getProperty( resName + ".count" ) ); + assertEquals("5", pclProps.getProperty(resName + ".count")); - assertTrue( pclProps.getProperty( resName + ".0" ), - pclProps.getProperty( resName + ".0" ).endsWith( "/c-0.1.jar!/" + resName ) ); - assertTrue( pclProps.getProperty( resName + ".1" ), - pclProps.getProperty( resName + ".1" ).endsWith( "/a-0.2.jar!/" + resName ) ); - assertTrue( pclProps.getProperty( resName + ".2" ), - pclProps.getProperty( resName + ".2" ).endsWith( "/b-0.1.jar!/" + resName ) ); - assertTrue( pclProps.getProperty( resName + ".3" ), - pclProps.getProperty( resName + ".3" ).endsWith( "/e-0.1.jar!/" + resName ) ); - assertTrue( pclProps.getProperty( resName + ".4" ), - pclProps.getProperty( resName + ".4" ).endsWith( "/d-0.1.jar!/" + resName ) ); + assertTrue( + pclProps.getProperty(resName + ".0"), + pclProps.getProperty(resName + ".0").endsWith("/c-0.1.jar!/" + resName)); + assertTrue( + pclProps.getProperty(resName + ".1"), + pclProps.getProperty(resName + ".1").endsWith("/a-0.2.jar!/" + resName)); + assertTrue( + pclProps.getProperty(resName + ".2"), + pclProps.getProperty(resName + ".2").endsWith("/b-0.1.jar!/" + resName)); + assertTrue( + pclProps.getProperty(resName + ".3"), + pclProps.getProperty(resName + ".3").endsWith("/e-0.1.jar!/" + resName)); + assertTrue( + pclProps.getProperty(resName + ".4"), + pclProps.getProperty(resName + ".4").endsWith("/d-0.1.jar!/" + resName)); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3916PluginExecutionInheritanceTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3916PluginExecutionInheritanceTest.java index 090d2695fe..99f0d9013c 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3916PluginExecutionInheritanceTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3916PluginExecutionInheritanceTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,15 +16,15 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Arrays; import java.util.Collections; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -35,13 +33,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3916PluginExecutionInheritanceTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3916PluginExecutionInheritanceTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3916PluginExecutionInheritanceTest() - { - super( "(2.0.4,)" ); + public MavenITmng3916PluginExecutionInheritanceTest() { + super("(2.0.4,)"); } /** @@ -51,23 +46,20 @@ public class MavenITmng3916PluginExecutionInheritanceTest * @throws Exception in case of failure */ @Test - public void testitMNG3916() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3916" ); + public void testitMNG3916() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3916"); - Verifier verifier = newVerifier( new File( testDir, "sub" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(new File(testDir, "sub").getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List executions = verifier.loadLines( "target/exec.log", "UTF-8" ); + List executions = verifier.loadLines("target/exec.log", "UTF-8"); // NOTE: Ordering of executions is another issue (MNG-3887), so ignore/normalize order - Collections.sort( executions ); - List expected = Arrays.asList( new String[] { "child-1", "child-default", "parent-1" } ); - assertEquals( expected, executions ); + Collections.sort(executions); + List expected = Arrays.asList(new String[] {"child-1", "child-default", "parent-1"}); + assertEquals(expected, executions); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3924XmlMarkupInterpolationTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3924XmlMarkupInterpolationTest.java index 2e7ad6ec47..d3194efde5 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3924XmlMarkupInterpolationTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3924XmlMarkupInterpolationTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -34,13 +32,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3924XmlMarkupInterpolationTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3924XmlMarkupInterpolationTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3924XmlMarkupInterpolationTest() - { - super( "[2.1.0-M1,)" ); + public MavenITmng3924XmlMarkupInterpolationTest() { + super("[2.1.0-M1,)"); } /** @@ -49,21 +44,18 @@ public class MavenITmng3924XmlMarkupInterpolationTest * @throws Exception in case of failure */ @Test - public void testitMNG3924() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3924" ); + public void testitMNG3924() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3924"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/xml.properties" ); - assertEquals( "Tom&Jerry", props.getProperty( "project.properties.xmlMarkup" ) ); - assertEquals( "Tom&Jerry", props.getProperty( "project.properties.xmlTest" ) ); + Properties props = verifier.loadProperties("target/xml.properties"); + assertEquals("Tom&Jerry", props.getProperty("project.properties.xmlMarkup")); + assertEquals("Tom&Jerry", props.getProperty("project.properties.xmlTest")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3925MergedPluginExecutionOrderTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3925MergedPluginExecutionOrderTest.java index a9404aeac3..67321063f3 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3925MergedPluginExecutionOrderTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3925MergedPluginExecutionOrderTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Arrays; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -34,13 +32,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3925MergedPluginExecutionOrderTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3925MergedPluginExecutionOrderTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3925MergedPluginExecutionOrderTest() - { - super( "[2.0.5,)" ); + public MavenITmng3925MergedPluginExecutionOrderTest() { + super("[2.0.5,)"); } /** @@ -50,10 +45,8 @@ public class MavenITmng3925MergedPluginExecutionOrderTest * @throws Exception in case of failure */ @Test - public void testitWithoutPluginMngt() - throws Exception - { - testitMNG3925( "test-1" ); + public void testitWithoutPluginMngt() throws Exception { + testitMNG3925("test-1"); } /** @@ -63,28 +56,24 @@ public class MavenITmng3925MergedPluginExecutionOrderTest * @throws Exception in case of failure */ @Test - public void testitWithPluginMngt() - throws Exception - { - testitMNG3925( "test-2" ); + public void testitWithPluginMngt() throws Exception { + testitMNG3925("test-2"); } - private void testitMNG3925( String project ) - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3925" ); + private void testitMNG3925(String project) throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3925"); - Verifier verifier = newVerifier( new File( new File( testDir, project ), "sub" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(new File(new File(testDir, project), "sub").getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List lines = verifier.loadLines( "target/exec.log", "UTF-8" ); + List lines = verifier.loadLines("target/exec.log", "UTF-8"); // Order is parent first and child appended, unless child overrides parent execution via equal id - List expected = Arrays.asList( new String[] { "parent-1", "parent-2", "child-default", "child-1", "child-2" } ); - assertEquals( expected, lines ); + List expected = + Arrays.asList(new String[] {"parent-1", "parent-2", "child-default", "child-1", "child-2"}); + assertEquals(expected, lines); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3927PluginDefaultExecutionConfigTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3927PluginDefaultExecutionConfigTest.java index 745cf7fafe..22c80a4ff4 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3927PluginDefaultExecutionConfigTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3927PluginDefaultExecutionConfigTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3927PluginDefaultExecutionConfigTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3927PluginDefaultExecutionConfigTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3927PluginDefaultExecutionConfigTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng3927PluginDefaultExecutionConfigTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -48,20 +43,17 @@ public class MavenITmng3927PluginDefaultExecutionConfigTest * @throws Exception in case of failure */ @Test - public void testitMNG3927() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3927" ); + public void testitMNG3927() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3927"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "process-resources" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("process-resources"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFileNotPresent( "target/failed.txt" ); - verifier.verifyFilePresent( "target/resources-resources.txt" ); + verifier.verifyFileNotPresent("target/failed.txt"); + verifier.verifyFilePresent("target/resources-resources.txt"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3937MergedPluginExecutionGoalsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3937MergedPluginExecutionGoalsTest.java index 71406c0915..80db3543b2 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3937MergedPluginExecutionGoalsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3937MergedPluginExecutionGoalsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Arrays; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -34,13 +32,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3937MergedPluginExecutionGoalsTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3937MergedPluginExecutionGoalsTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3937MergedPluginExecutionGoalsTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng3937MergedPluginExecutionGoalsTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -50,10 +45,8 @@ public class MavenITmng3937MergedPluginExecutionGoalsTest * @throws Exception in case of failure */ @Test - public void testitWithoutPluginMngt() - throws Exception - { - testitMNG3937( "test-1" ); + public void testitWithoutPluginMngt() throws Exception { + testitMNG3937("test-1"); } /** @@ -63,28 +56,23 @@ public class MavenITmng3937MergedPluginExecutionGoalsTest * @throws Exception in case of failure */ @Test - public void testitWithPluginMngt() - throws Exception - { - testitMNG3937( "test-2" ); + public void testitWithPluginMngt() throws Exception { + testitMNG3937("test-2"); } - private void testitMNG3937( String project ) - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3937" ); + private void testitMNG3937(String project) throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3937"); - Verifier verifier = newVerifier( new File( new File( testDir, project ), "sub" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(new File(new File(testDir, project), "sub").getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List lines = verifier.loadLines( "target/exec.log", "UTF-8" ); + List lines = verifier.loadLines("target/exec.log", "UTF-8"); // Order is child first and parent appended but without duplicate goals - List expected = Arrays.asList( new String[] { "child", "----" } ); - assertEquals( expected, lines ); + List expected = Arrays.asList(new String[] {"child", "----"}); + assertEquals(expected, lines); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3938MergePluginExecutionsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3938MergePluginExecutionsTest.java index aa32801bbc..b81b3e3630 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3938MergePluginExecutionsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3938MergePluginExecutionsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Arrays; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -34,13 +32,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3938MergePluginExecutionsTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3938MergePluginExecutionsTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3938MergePluginExecutionsTest() - { - super( "(2.0.4,)" ); + public MavenITmng3938MergePluginExecutionsTest() { + super("(2.0.4,)"); } /** @@ -51,10 +46,8 @@ public class MavenITmng3938MergePluginExecutionsTest * @throws Exception in case of failure */ @Test - public void testitWithoutPluginMngt() - throws Exception - { - testitMNG3938( "test-1" ); + public void testitWithoutPluginMngt() throws Exception { + testitMNG3938("test-1"); } /** @@ -65,31 +58,26 @@ public class MavenITmng3938MergePluginExecutionsTest * @throws Exception in case of failure */ @Test - public void testitWithPluginMngt() - throws Exception - { - testitMNG3938( "test-2" ); + public void testitWithPluginMngt() throws Exception { + testitMNG3938("test-2"); } - private void testitMNG3938( String project ) - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3938/" + project ); + private void testitMNG3938(String project) throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3938/" + project); - Verifier verifier = newVerifier( new File( testDir, "sub" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(new File(testDir, "sub").getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List lines = verifier.loadLines( "target/default.log", "UTF-8" ); - assertEquals( Arrays.asList( new String[] { "child" } ), lines ); + List lines = verifier.loadLines("target/default.log", "UTF-8"); + assertEquals(Arrays.asList(new String[] {"child"}), lines); - lines = verifier.loadLines( "target/non-default.log", "UTF-8" ); - assertEquals( Arrays.asList( new String[] { "child" } ), lines ); + lines = verifier.loadLines("target/non-default.log", "UTF-8"); + assertEquals(Arrays.asList(new String[] {"child"}), lines); - verifier.verifyFileNotPresent( "target/parent.log" ); + verifier.verifyFileNotPresent("target/parent.log"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3940EnvVarInterpolationTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3940EnvVarInterpolationTest.java index 064a978ae5..f96704f783 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3940EnvVarInterpolationTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3940EnvVarInterpolationTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; import org.apache.maven.shared.utils.Os; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -34,13 +32,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3940EnvVarInterpolationTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3940EnvVarInterpolationTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3940EnvVarInterpolationTest() - { - super( "(2.0.10,2.1.0-M1),(2.1.0-M1,)" ); + public MavenITmng3940EnvVarInterpolationTest() { + super("(2.0.10,2.1.0-M1),(2.1.0-M1,)"); } /** @@ -50,35 +45,28 @@ public class MavenITmng3940EnvVarInterpolationTest * @throws Exception in case of failure */ @Test - public void testitMNG3940() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3940" ); + public void testitMNG3940() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3940"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); /* * NOTE: The POM is using MAVEN_MNG_3940 to reference the var (just as one would refer to PATH). On Windows, * this must resolve case-insensitively so we use different character casing for the variable here. */ - if ( Os.isFamily( Os.FAMILY_WINDOWS ) ) - { - verifier.setEnvironmentVariable( "Maven_mng_3940", "PASSED" ); - } - else - { - verifier.setEnvironmentVariable( "MAVEN_MNG_3940", "PASSED" ); + if (Os.isFamily(Os.FAMILY_WINDOWS)) { + verifier.setEnvironmentVariable("Maven_mng_3940", "PASSED"); + } else { + verifier.setEnvironmentVariable("MAVEN_MNG_3940", "PASSED"); } - - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/PASSED.properties" ); - Properties props = verifier.loadProperties( "target/PASSED.properties" ); - assertEquals( "PASSED", props.getProperty( "project.properties.envTest" ) ); + verifier.verifyFilePresent("target/PASSED.properties"); + Properties props = verifier.loadProperties("target/PASSED.properties"); + assertEquals("PASSED", props.getProperty("project.properties.envTest")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3941ExecutionProjectRestrictedToForkingMojoTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3941ExecutionProjectRestrictedToForkingMojoTest.java index 62787208bb..1930d8b6ff 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3941ExecutionProjectRestrictedToForkingMojoTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3941ExecutionProjectRestrictedToForkingMojoTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng3941ExecutionProjectRestrictedToForkingMojoTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3941ExecutionProjectRestrictedToForkingMojoTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3941ExecutionProjectRestrictedToForkingMojoTest() - { - super( "[3.0-alpha-3,)" ); + public MavenITmng3941ExecutionProjectRestrictedToForkingMojoTest() { + super("[3.0-alpha-3,)"); } /** @@ -49,20 +44,17 @@ public class MavenITmng3941ExecutionProjectRestrictedToForkingMojoTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3941" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3941"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "initialize" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("initialize"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/fork.properties" ); - assertEquals( "test-0.1", props.getProperty( "executedProject.build.finalName" ) ); + Properties props = verifier.loadProperties("target/fork.properties"); + assertEquals("test-0.1", props.getProperty("executedProject.build.finalName")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3943PluginExecutionInheritanceTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3943PluginExecutionInheritanceTest.java index d0ea3e2829..00a761d08f 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3943PluginExecutionInheritanceTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3943PluginExecutionInheritanceTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,15 +16,15 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Arrays; import java.util.Collections; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -35,13 +33,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3943PluginExecutionInheritanceTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3943PluginExecutionInheritanceTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3943PluginExecutionInheritanceTest() - { - super( "(2.0.4,)" ); + public MavenITmng3943PluginExecutionInheritanceTest() { + super("(2.0.4,)"); } /** @@ -51,23 +46,20 @@ public class MavenITmng3943PluginExecutionInheritanceTest * @throws Exception in case of failure */ @Test - public void testitMNG3943() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3943" ); + public void testitMNG3943() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3943"); - Verifier verifier = newVerifier( new File( testDir, "sub" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(new File(testDir, "sub").getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List executions = verifier.loadLines( "target/exec.log", "UTF-8" ); + List executions = verifier.loadLines("target/exec.log", "UTF-8"); // NOTE: Ordering of executions is another issue (MNG-3887), so ignore/normalize order - Collections.sort( executions ); - List expected = Arrays.asList( new String[] { "child-1", "child-default", "parent-1" } ); - assertEquals( expected, executions ); + Collections.sort(executions); + List expected = Arrays.asList(new String[] {"child-1", "child-default", "parent-1"}); + assertEquals(expected, executions); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3944BasedirInterpolationTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3944BasedirInterpolationTest.java index 7b0071efbd..e8ce918c41 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3944BasedirInterpolationTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3944BasedirInterpolationTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3944BasedirInterpolationTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3944BasedirInterpolationTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3944BasedirInterpolationTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng3944BasedirInterpolationTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -48,24 +43,21 @@ public class MavenITmng3944BasedirInterpolationTest * @throws Exception in case of failure */ @Test - public void testitMNG3944() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3944" ); + public void testitMNG3944() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3944"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "-f" ); - verifier.addCliArgument( "pom-with-unusual-name.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("-f"); + verifier.addCliArgument("pom-with-unusual-name.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/basedir.properties" ); - Properties props = verifier.loadProperties( "target/basedir.properties" ); - assertCanonicalFileEquals( testDir, new File( props.getProperty( "project.properties.prop0" ) ) ); - assertCanonicalFileEquals( testDir, new File( props.getProperty( "project.properties.prop1" ) ) ); + verifier.verifyFilePresent("target/basedir.properties"); + Properties props = verifier.loadProperties("target/basedir.properties"); + assertCanonicalFileEquals(testDir, new File(props.getProperty("project.properties.prop0"))); + assertCanonicalFileEquals(testDir, new File(props.getProperty("project.properties.prop1"))); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3947PluginDefaultExecutionConfigTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3947PluginDefaultExecutionConfigTest.java index 7d86707c2d..4e2ba32fd5 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3947PluginDefaultExecutionConfigTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3947PluginDefaultExecutionConfigTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3947PluginDefaultExecutionConfigTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3947PluginDefaultExecutionConfigTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3947PluginDefaultExecutionConfigTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng3947PluginDefaultExecutionConfigTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -48,20 +43,17 @@ public class MavenITmng3947PluginDefaultExecutionConfigTest * @throws Exception in case of failure */ @Test - public void testitMNG3947() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3947" ); + public void testitMNG3947() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3947"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "org.apache.maven.plugins:maven-resources-plugin:resources" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("org.apache.maven.plugins:maven-resources-plugin:resources"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFileNotPresent( "target/failed.txt" ); - verifier.verifyFilePresent( "target/resources-resources.txt" ); + verifier.verifyFileNotPresent("target/failed.txt"); + verifier.verifyFilePresent("target/resources-resources.txt"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3948ParentResolutionFromProfileReposTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3948ParentResolutionFromProfileReposTest.java index 542fd6a8fb..e8c6bec716 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3948ParentResolutionFromProfileReposTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3948ParentResolutionFromProfileReposTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3948ParentResolutionFromProfileReposTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3948ParentResolutionFromProfileReposTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3948ParentResolutionFromProfileReposTest() - { - super( "(2.0.10,2.1.0-M1),(2.1.0-M1,)" ); + public MavenITmng3948ParentResolutionFromProfileReposTest() { + super("(2.0.10,2.1.0-M1),(2.1.0-M1,)"); } /** @@ -47,22 +42,19 @@ public class MavenITmng3948ParentResolutionFromProfileReposTest * @throws Exception in case of failure */ @Test - public void testitFromPom() - throws Exception - { - requiresMavenVersion( "[2.0,3.0-alpha-1),[3.0-beta-1,)" ); + public void testitFromPom() throws Exception { + requiresMavenVersion("[2.0,3.0-alpha-1),[3.0-beta-1,)"); - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3948/test-2" ); + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3948/test-2"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng3948" ); - verifier.filterFile( "pom.xml", "pom.xml", "UTF-8" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng3948"); + verifier.filterFile("pom.xml", "pom.xml", "UTF-8"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng3948", "parent", "0.2", "pom" ); + verifier.verifyArtifactPresent("org.apache.maven.its.mng3948", "parent", "0.2", "pom"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3951AbsolutePathsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3951AbsolutePathsTest.java index 2c66671296..058dd59c43 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3951AbsolutePathsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3951AbsolutePathsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3951AbsolutePathsTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3951AbsolutePathsTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3951AbsolutePathsTest() - { - super( "(2.0.10,2.1.0-M1),(2.1.0-M1,)" ); + public MavenITmng3951AbsolutePathsTest() { + super("(2.0.10,2.1.0-M1),(2.1.0-M1,)"); } /** @@ -49,46 +44,42 @@ public class MavenITmng3951AbsolutePathsTest * @throws Exception in case of failure */ @Test - public void testitMNG3951() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3951" ); + public void testitMNG3951() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3951"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); /* * Cut off anything before the first file separator from the local repo path. This is harmless on a Unix-like * filesystem but will make the path drive-relative on Windows so we can check how Maven handles it. */ - String repoDir = new File( verifier.getLocalRepository() ).getAbsolutePath(); - if ( getRoot( new File( repoDir ) ).equals( getRoot( testDir ) ) ) - { + String repoDir = new File(verifier.getLocalRepository()).getAbsolutePath(); + if (getRoot(new File(repoDir)).equals(getRoot(testDir))) { // NOTE: We can only test the local repo if it resides on the same drive as the test - verifier.setLocalRepo( repoDir.substring( repoDir.indexOf( File.separator ) ) ); + verifier.setLocalRepo(repoDir.substring(repoDir.indexOf(File.separator))); } - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/path.properties" ); - Properties props = verifier.loadProperties( "target/path.properties" ); + verifier.verifyFilePresent("target/path.properties"); + Properties props = verifier.loadProperties("target/path.properties"); - assertCanonicalFileEquals( new File( testDir, "tmp" ).getAbsoluteFile(), new File( props.getProperty( "fileParams.0" ) ) ); - assertCanonicalFileEquals( new File( getRoot( testDir ), "tmp" ).getAbsoluteFile(), new File( props.getProperty( "fileParams.1" ) ) ); - assertCanonicalFileEquals( new File( repoDir ), new File( props.getProperty( "stringParams.0" ) ) ); + assertCanonicalFileEquals( + new File(testDir, "tmp").getAbsoluteFile(), new File(props.getProperty("fileParams.0"))); + assertCanonicalFileEquals( + new File(getRoot(testDir), "tmp").getAbsoluteFile(), new File(props.getProperty("fileParams.1"))); + assertCanonicalFileEquals(new File(repoDir), new File(props.getProperty("stringParams.0"))); } - private static File getRoot( File path ) - { + private static File getRoot(File path) { File root = path; - for ( File dir = path; dir != null; dir = dir.getParentFile() ) - { + for (File dir = path; dir != null; dir = dir.getParentFile()) { root = dir; } return root; } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3953AuthenticatedDeploymentTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3953AuthenticatedDeploymentTest.java index 72390b8669..bb53d856cc 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3953AuthenticatedDeploymentTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3953AuthenticatedDeploymentTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,15 +16,15 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.eclipse.jetty.security.ConstraintMapping; import org.eclipse.jetty.security.ConstraintSecurityHandler; import org.eclipse.jetty.security.HashLoginService; @@ -51,87 +49,73 @@ import static org.eclipse.jetty.util.security.Constraint.__BASIC_AUTH; * @author Benjamin Bentmann * */ -public class MavenITmng3953AuthenticatedDeploymentTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3953AuthenticatedDeploymentTest extends AbstractMavenIntegrationTestCase { private Server server; private int port; private volatile boolean deployed; - public MavenITmng3953AuthenticatedDeploymentTest() - { - super( "(2.0.1,)" ); + public MavenITmng3953AuthenticatedDeploymentTest() { + super("(2.0.1,)"); } @BeforeEach - protected void setUp() - throws Exception - { - Handler repoHandler = new AbstractHandler() - { + protected void setUp() throws Exception { + Handler repoHandler = new AbstractHandler() { @Override - public void handle( String target, Request baseRequest, HttpServletRequest request, - HttpServletResponse response ) - { - System.out.println( "Handling " + request.getMethod() + " " + request.getRequestURL() ); + public void handle( + String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) { + System.out.println("Handling " + request.getMethod() + " " + request.getRequestURL()); - if ( "PUT".equalsIgnoreCase( request.getMethod() ) ) - { - response.setStatus( HttpServletResponse.SC_OK ); + if ("PUT".equalsIgnoreCase(request.getMethod())) { + response.setStatus(HttpServletResponse.SC_OK); deployed = true; - } - else - { - response.setStatus( HttpServletResponse.SC_NOT_FOUND ); + } else { + response.setStatus(HttpServletResponse.SC_NOT_FOUND); } - ( (Request) request ).setHandled( true ); + ((Request) request).setHandled(true); } }; Constraint constraint = new Constraint(); - constraint.setName( Constraint.__BASIC_AUTH ); - constraint.setRoles( new String[] { "deployer" } ); - constraint.setAuthenticate( true ); + constraint.setName(Constraint.__BASIC_AUTH); + constraint.setRoles(new String[] {"deployer"}); + constraint.setAuthenticate(true); ConstraintMapping constraintMapping = new ConstraintMapping(); - constraintMapping.setConstraint( constraint ); - constraintMapping.setPathSpec( "/*" ); + constraintMapping.setConstraint(constraint); + constraintMapping.setPathSpec("/*"); - HashLoginService userRealm = new HashLoginService( "TestRealm" ); + HashLoginService userRealm = new HashLoginService("TestRealm"); UserStore userStore = new UserStore(); - userStore.addUser( "testuser", new Password( "testtest" ), new String[] { "deployer" } ); - userRealm.setUserStore( userStore ); + userStore.addUser("testuser", new Password("testtest"), new String[] {"deployer"}); + userRealm.setUserStore(userStore); - server = new Server( 0 ); + server = new Server(0); ConstraintSecurityHandler securityHandler = new ConstraintSecurityHandler(); - securityHandler.setLoginService( userRealm ); - securityHandler.setAuthMethod( __BASIC_AUTH ); - securityHandler.setConstraintMappings( new ConstraintMapping[] { constraintMapping } ); + securityHandler.setLoginService(userRealm); + securityHandler.setAuthMethod(__BASIC_AUTH); + securityHandler.setConstraintMappings(new ConstraintMapping[] {constraintMapping}); HandlerList handlerList = new HandlerList(); - handlerList.addHandler( securityHandler ); - handlerList.addHandler( repoHandler ); + handlerList.addHandler(securityHandler); + handlerList.addHandler(repoHandler); - server.setHandler( handlerList ); + server.setHandler(handlerList); server.start(); - if ( server.isFailed() ) - { - fail( "Couldn't bind the server socket to a free port!" ); + if (server.isFailed()) { + fail("Couldn't bind the server socket to a free port!"); } - port = ( (NetworkConnector) server.getConnectors()[0] ).getLocalPort(); - System.out.println( "Bound server socket to the port " + port ); + port = ((NetworkConnector) server.getConnectors()[0]).getLocalPort(); + System.out.println("Bound server socket to the port " + port); deployed = false; } @AfterEach - protected void tearDown() - throws Exception - { - if ( server != null ) - { + protected void tearDown() throws Exception { + if (server != null) { server.stop(); server.join(); } @@ -143,10 +127,8 @@ public class MavenITmng3953AuthenticatedDeploymentTest * @throws Exception in case of failure */ @Test - public void testitRelease() - throws Exception - { - testitMNG3953( "release" ); + public void testitRelease() throws Exception { + testitMNG3953("release"); } /** @@ -155,27 +137,22 @@ public class MavenITmng3953AuthenticatedDeploymentTest * @throws Exception in case of failure */ @Test - public void testitSnapshot() - throws Exception - { - testitMNG3953( "snapshot" ); + public void testitSnapshot() throws Exception { + testitMNG3953("snapshot"); } - private void testitMNG3953( String project ) - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3953/" + project ); + private void testitMNG3953(String project) throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3953/" + project); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "-DdeploymentPort=" + port ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("-DdeploymentPort=" + port); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - assertTrue( deployed ); + assertTrue(deployed); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3955EffectiveSettingsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3955EffectiveSettingsTest.java index 708687fedb..79b6f2a294 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3955EffectiveSettingsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3955EffectiveSettingsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3955EffectiveSettingsTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3955EffectiveSettingsTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3955EffectiveSettingsTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng3955EffectiveSettingsTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -49,26 +44,24 @@ public class MavenITmng3955EffectiveSettingsTest * @throws Exception in case of failure */ @Test - public void testitMNG3955() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3955" ); + public void testitMNG3955() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3955"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "--offline" ); - verifier.addCliArgument( "--batch-mode" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("--offline"); + verifier.addCliArgument("--batch-mode"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/settings.properties" ); - assertEquals( "true", props.getProperty( "settings.offline" ) ); - assertEquals( "false", props.getProperty( "settings.interactiveMode" ) ); - assertEquals( new File( verifier.getLocalRepository() ).getAbsoluteFile(), - new File( props.getProperty( "settings.localRepository" ) ).getAbsoluteFile() ); + Properties props = verifier.loadProperties("target/settings.properties"); + assertEquals("true", props.getProperty("settings.offline")); + assertEquals("false", props.getProperty("settings.interactiveMode")); + assertEquals( + new File(verifier.getLocalRepository()).getAbsoluteFile(), + new File(props.getProperty("settings.localRepository")).getAbsoluteFile()); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3970DepResolutionFromProfileReposTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3970DepResolutionFromProfileReposTest.java index 43141db828..491fa5901f 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3970DepResolutionFromProfileReposTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3970DepResolutionFromProfileReposTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3970DepResolutionFromProfileReposTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3970DepResolutionFromProfileReposTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3970DepResolutionFromProfileReposTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng3970DepResolutionFromProfileReposTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -47,22 +42,20 @@ public class MavenITmng3970DepResolutionFromProfileReposTest * @throws Exception in case of failure */ @Test - public void testitFromPom() - throws Exception - { - requiresMavenVersion( "[2.0,3.0-alpha-1),[3.0-beta-1,)" ); + public void testitFromPom() throws Exception { + requiresMavenVersion("[2.0,3.0-alpha-1),[3.0-beta-1,)"); - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3970/test-2" ); + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3970/test-2"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng3970" ); - verifier.filterFile( "pom.xml", "pom.xml", "UTF-8" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng3970"); + verifier.filterFile("pom.xml", "pom.xml", "UTF-8"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng3970", "a", "0.1", "jar" ); + verifier.verifyArtifactPresent("org.apache.maven.its.mng3970", "a", "0.1", "jar"); } /** @@ -71,22 +64,19 @@ public class MavenITmng3970DepResolutionFromProfileReposTest * @throws Exception in case of failure */ @Test - public void testitFromSettings() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3970/test-3" ); + public void testitFromSettings() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3970/test-3"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng3970" ); - verifier.filterFile( "settings.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng3970"); + verifier.filterFile("settings.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng3970", "a", "0.1", "jar" ); + verifier.verifyArtifactPresent("org.apache.maven.its.mng3970", "a", "0.1", "jar"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3974MirrorOrderingTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3974MirrorOrderingTest.java index 39fef68999..f2d0a23bc0 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3974MirrorOrderingTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3974MirrorOrderingTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3974MirrorOrderingTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3974MirrorOrderingTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3974MirrorOrderingTest() - { - super( "(2.0.9,2.1.0-M1),(2.1.0-M1,3.0-alpha-1),(3.0-alpha-1,)" ); + public MavenITmng3974MirrorOrderingTest() { + super("(2.0.9,2.1.0-M1),(2.1.0-M1,3.0-alpha-1),(3.0-alpha-1,)"); } /** @@ -48,23 +43,20 @@ public class MavenITmng3974MirrorOrderingTest * @throws Exception in case of failure */ @Test - public void testitFirstMatchWins() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3974" ); + public void testitFirstMatchWins() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3974"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng3974" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng3974"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng3974", "a", "0.1", "jar" ); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng3974", "b", "0.1", "jar" ); + verifier.verifyArtifactPresent("org.apache.maven.its.mng3974", "a", "0.1", "jar"); + verifier.verifyArtifactPresent("org.apache.maven.its.mng3974", "b", "0.1", "jar"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3979ElementJoinTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3979ElementJoinTest.java index c389837d69..e952811392 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3979ElementJoinTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3979ElementJoinTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3979ElementJoinTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3979ElementJoinTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3979ElementJoinTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng3979ElementJoinTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -48,18 +43,15 @@ public class MavenITmng3979ElementJoinTest * @throws Exception in case of failure */ @Test - public void testitMNG3979() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3979" ); + public void testitMNG3979() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3979"); - testDir = new File( testDir, "sub" ); + testDir = new File(testDir, "sub"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3983PluginResolutionFromProfileReposTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3983PluginResolutionFromProfileReposTest.java index fd2696c25b..8410fcdcb3 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3983PluginResolutionFromProfileReposTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3983PluginResolutionFromProfileReposTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3983PluginResolutionFromProfileReposTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3983PluginResolutionFromProfileReposTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3983PluginResolutionFromProfileReposTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng3983PluginResolutionFromProfileReposTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -47,24 +42,22 @@ public class MavenITmng3983PluginResolutionFromProfileReposTest * @throws Exception in case of failure */ @Test - public void testitFromPom() - throws Exception - { - requiresMavenVersion( "[2.0,3.0-alpha-1),[3.0-alpha-3,)" ); + public void testitFromPom() throws Exception { + requiresMavenVersion("[2.0,3.0-alpha-1),[3.0-alpha-3,)"); - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3983/test-1" ); + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3983/test-1"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setForkJvm( true ); // Don't lock up plugin files in class loader within current JVM - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng3983" ); - verifier.filterFile( "pom.xml", "pom.xml", "UTF-8" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setForkJvm(true); // Don't lock up plugin files in class loader within current JVM + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng3983"); + verifier.filterFile("pom.xml", "pom.xml", "UTF-8"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng3983", "p", "0.1", "jar" ); + verifier.verifyArtifactPresent("org.apache.maven.its.mng3983", "p", "0.1", "jar"); } /** @@ -73,24 +66,21 @@ public class MavenITmng3983PluginResolutionFromProfileReposTest * @throws Exception in case of failure */ @Test - public void testitFromSettings() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3983/test-3" ); + public void testitFromSettings() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3983/test-3"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setForkJvm( true ); // Don't lock up plugin files in class loader within current JVM - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng3983" ); - verifier.filterFile( "settings.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setForkJvm(true); // Don't lock up plugin files in class loader within current JVM + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng3983"); + verifier.filterFile("settings.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng3983", "p", "0.1", "jar" ); + verifier.verifyArtifactPresent("org.apache.maven.its.mng3983", "p", "0.1", "jar"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3991ValidDependencyScopeTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3991ValidDependencyScopeTest.java index c6095e462d..874408471b 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3991ValidDependencyScopeTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3991ValidDependencyScopeTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,14 +30,11 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng3991ValidDependencyScopeTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3991ValidDependencyScopeTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3991ValidDependencyScopeTest() - { + public MavenITmng3991ValidDependencyScopeTest() { // TODO: One day, we should be able to error out but this requires to consider extensions and their use cases - super( "[4.0,)" ); + super("[4.0,)"); } /** @@ -48,25 +43,19 @@ public class MavenITmng3991ValidDependencyScopeTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3991" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3991"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - try - { - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + try { + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - fail( "Invalid dependency scope did not cause validation error" ); - } - catch ( VerificationException e ) - { + fail("Invalid dependency scope did not cause validation error"); + } catch (VerificationException e) { // expected } } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3998PluginExecutionConfigTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3998PluginExecutionConfigTest.java index 4fdf1fbcfd..7cec97435c 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3998PluginExecutionConfigTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3998PluginExecutionConfigTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,15 +16,15 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Arrays; import java.util.Collections; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -35,13 +33,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng3998PluginExecutionConfigTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng3998PluginExecutionConfigTest extends AbstractMavenIntegrationTestCase { - public MavenITmng3998PluginExecutionConfigTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng3998PluginExecutionConfigTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -50,23 +45,20 @@ public class MavenITmng3998PluginExecutionConfigTest * @throws Exception in case of failure */ @Test - public void testitMNG3998() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3998" ); + public void testitMNG3998() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3998"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List executions = verifier.loadLines( "target/exec.log", "UTF-8" ); + List executions = verifier.loadLines("target/exec.log", "UTF-8"); // NOTE: Ordering of executions is another issue (MNG-3887), so ignore/normalize order - Collections.sort( executions ); - List expected = Arrays.asList( new String[] { "exec-1", "exec-2" } ); - assertEquals( expected, executions ); + Collections.sort(executions); + List expected = Arrays.asList(new String[] {"exec-1", "exec-2"}); + assertEquals(expected, executions); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4000MultiPluginExecutionsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4000MultiPluginExecutionsTest.java index a36b8dadc2..9c742df4b9 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4000MultiPluginExecutionsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4000MultiPluginExecutionsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Arrays; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -34,13 +32,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng4000MultiPluginExecutionsTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4000MultiPluginExecutionsTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4000MultiPluginExecutionsTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng4000MultiPluginExecutionsTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -50,21 +45,19 @@ public class MavenITmng4000MultiPluginExecutionsTest * @throws Exception in case of failure */ @Test - public void testitWithoutPluginMngt() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4000/test-1" ); + public void testitWithoutPluginMngt() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4000/test-1"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List executions = verifier.loadLines( "target/exec.log", "UTF-8" ); - List expected = Arrays.asList( new String[] { "exec", "exec" } ); - assertEquals( expected, executions ); + List executions = verifier.loadLines("target/exec.log", "UTF-8"); + List expected = Arrays.asList(new String[] {"exec", "exec"}); + assertEquals(expected, executions); } /** @@ -74,21 +67,18 @@ public class MavenITmng4000MultiPluginExecutionsTest * @throws Exception in case of failure */ @Test - public void testitWithPluginMngt() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4000/test-2" ); + public void testitWithPluginMngt() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4000/test-2"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List executions = verifier.loadLines( "target/exec.log", "UTF-8" ); - List expected = Arrays.asList( new String[] { "exec", "exec" } ); - assertEquals( expected, executions ); + List executions = verifier.loadLines("target/exec.log", "UTF-8"); + List expected = Arrays.asList(new String[] {"exec", "exec"}); + assertEquals(expected, executions); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4005UniqueDependencyKeyTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4005UniqueDependencyKeyTest.java index 4713707520..ebff7e8f8d 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4005UniqueDependencyKeyTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4005UniqueDependencyKeyTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4005UniqueDependencyKeyTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4005UniqueDependencyKeyTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4005UniqueDependencyKeyTest() - { - super( "[3.0-beta-1,)" ); + public MavenITmng4005UniqueDependencyKeyTest() { + super("[3.0-beta-1,)"); } /** @@ -48,10 +43,8 @@ public class MavenITmng4005UniqueDependencyKeyTest * @throws Exception in case of failure */ @Test - public void testitDependency() - throws Exception - { - test( "dep" ); + public void testitDependency() throws Exception { + test("dep"); } /** @@ -60,10 +53,8 @@ public class MavenITmng4005UniqueDependencyKeyTest * @throws Exception in case of failure */ @Test - public void testitManagedDependency() - throws Exception - { - test( "man-dep" ); + public void testitManagedDependency() throws Exception { + test("man-dep"); } /** @@ -72,10 +63,8 @@ public class MavenITmng4005UniqueDependencyKeyTest * @throws Exception in case of failure */ @Test - public void testitProfileDependency() - throws Exception - { - test( "profile-dep" ); + public void testitProfileDependency() throws Exception { + test("profile-dep"); } /** @@ -84,50 +73,38 @@ public class MavenITmng4005UniqueDependencyKeyTest * @throws Exception in case of failure */ @Test - public void testitProfileManagedDependency() - throws Exception - { - test( "profile-man-dep" ); + public void testitProfileManagedDependency() throws Exception { + test("profile-man-dep"); } - private void test( String project ) - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4005/" + project ); + private void test(String project) throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4005/" + project); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); try { - verifier.addCliArgument( "validate" ); + verifier.addCliArgument("validate"); verifier.execute(); - } - catch ( VerificationException e ) - { + } catch (VerificationException e) { // expected with Maven 4+ } String logLevel; - if ( matchesVersionRange( "(,4.0.0-alpha-1)" ) ) - { + if (matchesVersionRange("(,4.0.0-alpha-1)")) { logLevel = "WARNING"; - } - else - { + } else { logLevel = "ERROR"; } - List lines = verifier.loadLines( verifier.getLogFileName(), "UTF-8" ); + List lines = verifier.loadLines(verifier.getLogFileName(), "UTF-8"); boolean foundMessage = false; - for ( String line : lines ) - { - if ( line.startsWith( "[" + logLevel + "]" ) && line.indexOf( "must be unique: junit:junit:jar" ) > 0 ) - { + for (String line : lines) { + if (line.startsWith("[" + logLevel + "]") && line.indexOf("must be unique: junit:junit:jar") > 0) { foundMessage = true; } } - assertTrue( "Duplicate dependency message wasn't generated.", foundMessage ); + assertTrue("Duplicate dependency message wasn't generated.", foundMessage); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4007PlatformFileSeparatorTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4007PlatformFileSeparatorTest.java index 3b27c29962..b4347761d5 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4007PlatformFileSeparatorTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4007PlatformFileSeparatorTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng4007PlatformFileSeparatorTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4007PlatformFileSeparatorTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4007PlatformFileSeparatorTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng4007PlatformFileSeparatorTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -48,56 +43,51 @@ public class MavenITmng4007PlatformFileSeparatorTest * @throws Exception in case of failure */ @Test - public void testitMNG4007() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4007" ); + public void testitMNG4007() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4007"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties modelProps = verifier.loadProperties( "target/model.properties" ); + Properties modelProps = verifier.loadProperties("target/model.properties"); - assertPath( modelProps.getProperty( "project.build.directory" ) ); + assertPath(modelProps.getProperty("project.build.directory")); - assertPath( modelProps.getProperty( "project.build.outputDirectory" ) ); + assertPath(modelProps.getProperty("project.build.outputDirectory")); - assertPath( modelProps.getProperty( "project.build.testOutputDirectory" ) ); + assertPath(modelProps.getProperty("project.build.testOutputDirectory")); - assertPath( modelProps.getProperty( "project.build.sourceDirectory" ) ); - assertPath( modelProps.getProperty( "project.compileSourceRoots.0" ) ); + assertPath(modelProps.getProperty("project.build.sourceDirectory")); + assertPath(modelProps.getProperty("project.compileSourceRoots.0")); - assertPath( modelProps.getProperty( "project.build.testSourceDirectory" ) ); - assertPath( modelProps.getProperty( "project.testCompileSourceRoots.0" ) ); + assertPath(modelProps.getProperty("project.build.testSourceDirectory")); + assertPath(modelProps.getProperty("project.testCompileSourceRoots.0")); - assertPath( modelProps.getProperty( "project.build.resources.0.directory" ) ); + assertPath(modelProps.getProperty("project.build.resources.0.directory")); - assertPath( modelProps.getProperty( "project.build.testResources.0.directory" ) ); + assertPath(modelProps.getProperty("project.build.testResources.0.directory")); - assertPath( modelProps.getProperty( "project.build.filters.0" ) ); + assertPath(modelProps.getProperty("project.build.filters.0")); /* * NOTE: The script source directory is deliberately excluded from the checks due to MNG-3741. */ // MNG-3877 - if ( matchesVersionRange( "[3.0-alpha-3,)" ) ) - { - assertPath( modelProps.getProperty( "project.reporting.outputDirectory" ) ); + if (matchesVersionRange("[3.0-alpha-3,)")) { + assertPath(modelProps.getProperty("project.reporting.outputDirectory")); } } - private void assertPath( String actual ) - { + private void assertPath(String actual) { /* * NOTE: Whether the path is absolute is another issue (MNG-3877), we are only interested in the proper * file separator here. */ - assertEquals( new File( actual ).getPath(), actual ); + assertEquals(new File(actual).getPath(), actual); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4008MergedFilterOrderTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4008MergedFilterOrderTest.java index 211603b26d..74d371bbca 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4008MergedFilterOrderTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4008MergedFilterOrderTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng4008MergedFilterOrderTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4008MergedFilterOrderTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4008MergedFilterOrderTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng4008MergedFilterOrderTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -48,29 +43,26 @@ public class MavenITmng4008MergedFilterOrderTest * @throws Exception in case of failure */ @Test - public void testitMNG4008() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4008" ); + public void testitMNG4008() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4008"); - Verifier verifier = newVerifier( new File( testDir, "sub" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(new File(testDir, "sub").getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties modelProps = verifier.loadProperties( "target/model.properties" ); + Properties modelProps = verifier.loadProperties("target/model.properties"); - assertEquals( "7", modelProps.getProperty( "project.build.filters" ) ); + assertEquals("7", modelProps.getProperty("project.build.filters")); - assertTrue( modelProps.getProperty( "project.build.filters.0" ).endsWith( "child-a.properties" ) ); - assertTrue( modelProps.getProperty( "project.build.filters.1" ).endsWith( "child-c.properties" ) ); - assertTrue( modelProps.getProperty( "project.build.filters.2" ).endsWith( "child-b.properties" ) ); - assertTrue( modelProps.getProperty( "project.build.filters.3" ).endsWith( "child-d.properties" ) ); - assertTrue( modelProps.getProperty( "project.build.filters.4" ).endsWith( "parent-c.properties" ) ); - assertTrue( modelProps.getProperty( "project.build.filters.5" ).endsWith( "parent-b.properties" ) ); - assertTrue( modelProps.getProperty( "project.build.filters.6" ).endsWith( "parent-d.properties" ) ); + assertTrue(modelProps.getProperty("project.build.filters.0").endsWith("child-a.properties")); + assertTrue(modelProps.getProperty("project.build.filters.1").endsWith("child-c.properties")); + assertTrue(modelProps.getProperty("project.build.filters.2").endsWith("child-b.properties")); + assertTrue(modelProps.getProperty("project.build.filters.3").endsWith("child-d.properties")); + assertTrue(modelProps.getProperty("project.build.filters.4").endsWith("parent-c.properties")); + assertTrue(modelProps.getProperty("project.build.filters.5").endsWith("parent-b.properties")); + assertTrue(modelProps.getProperty("project.build.filters.6").endsWith("parent-d.properties")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4009InheritProfileEffectsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4009InheritProfileEffectsTest.java index 45790888ab..d2e48e4daa 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4009InheritProfileEffectsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4009InheritProfileEffectsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng4009InheritProfileEffectsTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4009InheritProfileEffectsTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4009InheritProfileEffectsTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng4009InheritProfileEffectsTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -48,22 +43,19 @@ public class MavenITmng4009InheritProfileEffectsTest * @throws Exception in case of failure */ @Test - public void testitMNG4009() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4009" ); + public void testitMNG4009() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4009"); - Verifier verifier = newVerifier( new File( testDir, "sub" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "-Pparent-profile" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(new File(testDir, "sub").getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("-Pparent-profile"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/profile.properties" ); + Properties props = verifier.loadProperties("target/profile.properties"); - assertEquals( "PASSED", props.getProperty( "project.properties.parentProfileProperty" ) ); + assertEquals("PASSED", props.getProperty("project.properties.parentProfileProperty")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4016PrefixedPropertyInterpolationTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4016PrefixedPropertyInterpolationTest.java index d3066bd789..108427c547 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4016PrefixedPropertyInterpolationTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4016PrefixedPropertyInterpolationTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng4016PrefixedPropertyInterpolationTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4016PrefixedPropertyInterpolationTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4016PrefixedPropertyInterpolationTest() - { - super( "(2.1.0-M1,)" ); + public MavenITmng4016PrefixedPropertyInterpolationTest() { + super("(2.1.0-M1,)"); } /** @@ -49,23 +44,20 @@ public class MavenITmng4016PrefixedPropertyInterpolationTest * @throws Exception in case of failure */ @Test - public void testitMNG4016() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4016" ); + public void testitMNG4016() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4016"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/model.properties" ); - Properties props = verifier.loadProperties( "target/model.properties" ); - assertEquals( "PASSED-1", props.getProperty( "project.properties.projectProperty" ) ); - assertEquals( "PASSED-2", props.getProperty( "project.properties.pomProperty" ) ); - assertEquals( "PASSED-3", props.getProperty( "project.properties.envProperty" ) ); + verifier.verifyFilePresent("target/model.properties"); + Properties props = verifier.loadProperties("target/model.properties"); + assertEquals("PASSED-1", props.getProperty("project.properties.projectProperty")); + assertEquals("PASSED-2", props.getProperty("project.properties.pomProperty")); + assertEquals("PASSED-3", props.getProperty("project.properties.envProperty")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4022IdempotentPluginConfigMergingTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4022IdempotentPluginConfigMergingTest.java index 061e6ef586..6d80de8c6b 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4022IdempotentPluginConfigMergingTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4022IdempotentPluginConfigMergingTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4022IdempotentPluginConfigMergingTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4022IdempotentPluginConfigMergingTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4022IdempotentPluginConfigMergingTest() - { - super( "[3.0-beta-1,)" ); + public MavenITmng4022IdempotentPluginConfigMergingTest() { + super("[3.0-beta-1,)"); } /** @@ -48,26 +43,23 @@ public class MavenITmng4022IdempotentPluginConfigMergingTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4022" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4022"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "-Pmng4022a,mng4022b" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("-Pmng4022a,mng4022b"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/config.properties" ); - assertEquals( "5", props.getProperty( "stringParams" ) ); - assertEquals( "", props.getProperty( "stringParams.0", "" ) ); - assertEquals( "one", props.getProperty( "stringParams.1", "" ) ); - assertEquals( "", props.getProperty( "stringParams.2", "" ) ); - assertEquals( "two", props.getProperty( "stringParams.3", "" ) ); - assertEquals( "", props.getProperty( "stringParams.4", "" ) ); + Properties props = verifier.loadProperties("target/config.properties"); + assertEquals("5", props.getProperty("stringParams")); + assertEquals("", props.getProperty("stringParams.0", "")); + assertEquals("one", props.getProperty("stringParams.1", "")); + assertEquals("", props.getProperty("stringParams.2", "")); + assertEquals("two", props.getProperty("stringParams.3", "")); + assertEquals("", props.getProperty("stringParams.4", "")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4023ParentProfileOneTimeInjectionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4023ParentProfileOneTimeInjectionTest.java index 5c2660bb91..70bd23f823 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4023ParentProfileOneTimeInjectionTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4023ParentProfileOneTimeInjectionTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng4023ParentProfileOneTimeInjectionTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4023ParentProfileOneTimeInjectionTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4023ParentProfileOneTimeInjectionTest() - { - super( "[2.0.11,2.1.0-M1),[2.1.0-M2,)" ); + public MavenITmng4023ParentProfileOneTimeInjectionTest() { + super("[2.0.11,2.1.0-M1),[2.1.0-M2,)"); } /** @@ -50,22 +45,19 @@ public class MavenITmng4023ParentProfileOneTimeInjectionTest * @throws Exception in case of failure */ @Test - public void testitMNG4023() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4023" ); + public void testitMNG4023() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4023"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "sub/target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("sub/target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "sub/target/config.properties" ); - assertEquals( "1", props.getProperty( "stringParams" ) ); - assertEquals( "test", props.getProperty( "stringParams.0" ) ); - assertNull( props.getProperty( "stringParams.1" ) ); + Properties props = verifier.loadProperties("sub/target/config.properties"); + assertEquals("1", props.getProperty("stringParams")); + assertEquals("test", props.getProperty("stringParams.0")); + assertNull(props.getProperty("stringParams.1")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4026ReactorDependenciesOrderTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4026ReactorDependenciesOrderTest.java index ea08aeb534..55c9edcef1 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4026ReactorDependenciesOrderTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4026ReactorDependenciesOrderTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,14 +31,11 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng4026ReactorDependenciesOrderTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4026ReactorDependenciesOrderTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4026ReactorDependenciesOrderTest() - { + public MavenITmng4026ReactorDependenciesOrderTest() { // This feature depends on MNG-1412 - super( "(2.0.8,)" ); + super("(2.0.8,)"); } /** @@ -50,28 +45,25 @@ public class MavenITmng4026ReactorDependenciesOrderTest * @throws Exception in case of failure */ @Test - public void testitMNG4026() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4026" ); + public void testitMNG4026() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4026"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "consumer/target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("consumer/target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List classpath1 = verifier.loadLines( "consumer/target/classpath-1.txt", "UTF-8" ); - assertEquals( 5, classpath1.size() ); - assertEquals( "consumer/classes", classpath1.get( 0 ) ); - assertEquals( "dep-1/pom.xml", classpath1.get( 1 ) ); - assertEquals( "dep-3/pom.xml", classpath1.get( 2 ) ); - assertEquals( "dep-2/pom.xml", classpath1.get( 3 ) ); - assertEquals( "dep-4/pom.xml", classpath1.get( 4 ) ); + List classpath1 = verifier.loadLines("consumer/target/classpath-1.txt", "UTF-8"); + assertEquals(5, classpath1.size()); + assertEquals("consumer/classes", classpath1.get(0)); + assertEquals("dep-1/pom.xml", classpath1.get(1)); + assertEquals("dep-3/pom.xml", classpath1.get(2)); + assertEquals("dep-2/pom.xml", classpath1.get(3)); + assertEquals("dep-4/pom.xml", classpath1.get(4)); - List classpath2 = verifier.loadLines( "consumer/target/classpath-2.txt", "UTF-8" ); - assertEquals( classpath1, classpath2 ); + List classpath2 = verifier.loadLines("consumer/target/classpath-2.txt", "UTF-8"); + assertEquals(classpath1, classpath2); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4034ManagedProfileDependencyTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4034ManagedProfileDependencyTest.java index 069d62163e..e83adbc1a1 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4034ManagedProfileDependencyTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4034ManagedProfileDependencyTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,15 +16,15 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Arrays; import java.util.Collections; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -35,13 +33,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng4034ManagedProfileDependencyTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4034ManagedProfileDependencyTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4034ManagedProfileDependencyTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng4034ManagedProfileDependencyTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -51,23 +46,20 @@ public class MavenITmng4034ManagedProfileDependencyTest * @throws Exception in case of failure */ @Test - public void testitMNG4034() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4034" ); + public void testitMNG4034() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4034"); - Verifier verifier = newVerifier( new File( testDir, "sub" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(new File(testDir, "sub").getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List artifacts = verifier.loadLines( "target/compile.txt", "UTF-8" ); - assertEquals( Arrays.asList( new String[0] ), artifacts ); + List artifacts = verifier.loadLines("target/compile.txt", "UTF-8"); + assertEquals(Arrays.asList(new String[0]), artifacts); - artifacts = verifier.loadLines( "target/runtime.txt", "UTF-8" ); - assertEquals( Collections.singletonList( "org.apache.maven.its:maven-core-it-support:jar:1.3" ), artifacts ); + artifacts = verifier.loadLines("target/runtime.txt", "UTF-8"); + assertEquals(Collections.singletonList("org.apache.maven.its:maven-core-it-support:jar:1.3"), artifacts); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4036ParentResolutionFromSettingsRepoTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4036ParentResolutionFromSettingsRepoTest.java index 2d50a407ee..89071fbf39 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4036ParentResolutionFromSettingsRepoTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4036ParentResolutionFromSettingsRepoTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4036ParentResolutionFromSettingsRepoTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4036ParentResolutionFromSettingsRepoTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4036ParentResolutionFromSettingsRepoTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng4036ParentResolutionFromSettingsRepoTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -46,22 +41,19 @@ public class MavenITmng4036ParentResolutionFromSettingsRepoTest * @throws Exception in case of failure */ @Test - public void testitDefaultLayout() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4036/default" ); + public void testitDefaultLayout() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4036/default"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.filterFile( "settings.xml", "settings.xml", "UTF-8" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4036" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.filterFile("settings.xml", "settings.xml", "UTF-8"); + verifier.deleteArtifacts("org.apache.maven.its.mng4036"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng4036", "parent", "0.2", "pom" ); + verifier.verifyArtifactPresent("org.apache.maven.its.mng4036", "parent", "0.2", "pom"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4040ProfileInjectedModulesTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4040ProfileInjectedModulesTest.java index c5174db0e7..61452e89c4 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4040ProfileInjectedModulesTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4040ProfileInjectedModulesTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4040ProfileInjectedModulesTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4040ProfileInjectedModulesTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4040ProfileInjectedModulesTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng4040ProfileInjectedModulesTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -46,17 +41,14 @@ public class MavenITmng4040ProfileInjectedModulesTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4040" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4040"); - Verifier verifier = newVerifier( new File( testDir, "sub" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(new File(testDir, "sub").getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4048VersionRangeReactorResolutionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4048VersionRangeReactorResolutionTest.java index 083206871e..ba4a0932ae 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4048VersionRangeReactorResolutionTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4048VersionRangeReactorResolutionTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4048VersionRangeReactorResolutionTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4048VersionRangeReactorResolutionTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4048VersionRangeReactorResolutionTest() - { - super( "[3.0-alpha-3,)" ); + public MavenITmng4048VersionRangeReactorResolutionTest() { + super("[3.0-alpha-3,)"); } /** @@ -47,21 +42,18 @@ public class MavenITmng4048VersionRangeReactorResolutionTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4048" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4048"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "sub-2/target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4048" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("sub-2/target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4048"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List artifacts = verifier.loadLines( "sub-2/target/compile.txt", "UTF-8" ); - assertTrue( artifacts.toString(), artifacts.contains( "org.apache.maven.its.mng4048:sub-1:jar:1.1-SNAPSHOT" ) ); + List artifacts = verifier.loadLines("sub-2/target/compile.txt", "UTF-8"); + assertTrue(artifacts.toString(), artifacts.contains("org.apache.maven.its.mng4048:sub-1:jar:1.1-SNAPSHOT")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4052ReactorAwareImportScopeTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4052ReactorAwareImportScopeTest.java index dacc99ef31..69fa365d28 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4052ReactorAwareImportScopeTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4052ReactorAwareImportScopeTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4052ReactorAwareImportScopeTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4052ReactorAwareImportScopeTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4052ReactorAwareImportScopeTest() - { - super( "[3.0-alpha-3,)" ); + public MavenITmng4052ReactorAwareImportScopeTest() { + super("[3.0-alpha-3,)"); } /** @@ -49,16 +44,13 @@ public class MavenITmng4052ReactorAwareImportScopeTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4052" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4052"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4053PluginConfigAttributesTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4053PluginConfigAttributesTest.java index c460f66e2a..885c084d9d 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4053PluginConfigAttributesTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4053PluginConfigAttributesTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4053PluginConfigAttributesTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4053PluginConfigAttributesTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4053PluginConfigAttributesTest() - { - super( "[2.0.3,)" ); + public MavenITmng4053PluginConfigAttributesTest() { + super("[2.0.3,)"); } /** @@ -48,10 +43,8 @@ public class MavenITmng4053PluginConfigAttributesTest * @throws Exception in case of failure */ @Test - public void testitWithoutPluginMngt() - throws Exception - { - testit( "test-1" ); + public void testitWithoutPluginMngt() throws Exception { + testit("test-1"); } /** @@ -61,10 +54,8 @@ public class MavenITmng4053PluginConfigAttributesTest * @throws Exception in case of failure */ @Test - public void testitWithPluginMngt() - throws Exception - { - testit( "test-2" ); + public void testitWithPluginMngt() throws Exception { + testit("test-2"); } /** @@ -74,34 +65,29 @@ public class MavenITmng4053PluginConfigAttributesTest * @throws Exception in case of failure */ @Test - public void testitWithPluginMngtAndProfile() - throws Exception - { - testit( "test-3" ); + public void testitWithPluginMngtAndProfile() throws Exception { + testit("test-3"); } - private void testit( String test ) - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4053/" + test ); + private void testit(String test) throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4053/" + test); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/config.properties" ); + Properties props = verifier.loadProperties("target/config.properties"); - assertEquals( "src", props.getProperty( "domParam.children.copy.0.attributes.todir" ) ); - assertEquals( "true", props.getProperty( "domParam.children.copy.0.attributes.overwrite" ) ); - assertEquals( "2", props.getProperty( "domParam.children.copy.0.attributes" ) ); + assertEquals("src", props.getProperty("domParam.children.copy.0.attributes.todir")); + assertEquals("true", props.getProperty("domParam.children.copy.0.attributes.overwrite")); + assertEquals("2", props.getProperty("domParam.children.copy.0.attributes")); - assertEquals( "target", props.getProperty( "domParam.children.copy.0.children.fileset.0.attributes.dir" ) ); - assertNull( props.getProperty( "domParam.children.copy.0.children.fileset.0.attributes.todir" ) ); - assertNull( props.getProperty( "domParam.children.copy.0.children.fileset.0.attributes.overwrite" ) ); - assertEquals( "1", props.getProperty( "domParam.children.copy.0.children.fileset.0.attributes" ) ); + assertEquals("target", props.getProperty("domParam.children.copy.0.children.fileset.0.attributes.dir")); + assertNull(props.getProperty("domParam.children.copy.0.children.fileset.0.attributes.todir")); + assertNull(props.getProperty("domParam.children.copy.0.children.fileset.0.attributes.overwrite")); + assertEquals("1", props.getProperty("domParam.children.copy.0.children.fileset.0.attributes")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4056ClassifierBasedDepResolutionFromReactorTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4056ClassifierBasedDepResolutionFromReactorTest.java index e23fa250a0..5ffa82b311 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4056ClassifierBasedDepResolutionFromReactorTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4056ClassifierBasedDepResolutionFromReactorTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4056ClassifierBasedDepResolutionFromReactorTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4056ClassifierBasedDepResolutionFromReactorTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4056ClassifierBasedDepResolutionFromReactorTest() - { - super( "[2.1.0,)" ); + public MavenITmng4056ClassifierBasedDepResolutionFromReactorTest() { + super("[2.1.0,)"); } /** @@ -48,50 +43,47 @@ public class MavenITmng4056ClassifierBasedDepResolutionFromReactorTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4056" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4056"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "consumer/target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4056" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("consumer/target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4056"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List artifacts = verifier.loadLines( "consumer/target/artifacts.txt", "UTF-8" ); - if ( matchesVersionRange( "[3.0-alpha-3,)" ) ) - { + List artifacts = verifier.loadLines("consumer/target/artifacts.txt", "UTF-8"); + if (matchesVersionRange("[3.0-alpha-3,)")) { // artifact type unchanged to match type as declared in dependency - assertTrue( artifacts.toString(), - artifacts.contains( "org.apache.maven.its.mng4056:producer:jar:tests:0.1" ) ); - assertTrue( artifacts.toString(), - artifacts.contains( "org.apache.maven.its.mng4056:producer:jar:sources:0.1" ) ); - assertTrue( artifacts.toString(), - artifacts.contains( "org.apache.maven.its.mng4056:producer:jar:javadoc:0.1" ) ); - assertTrue( artifacts.toString(), - artifacts.contains( "org.apache.maven.its.mng4056:producer:jar:client:0.1" ) ); - } - else - { + assertTrue(artifacts.toString(), artifacts.contains("org.apache.maven.its.mng4056:producer:jar:tests:0.1")); + assertTrue( + artifacts.toString(), artifacts.contains("org.apache.maven.its.mng4056:producer:jar:sources:0.1")); + assertTrue( + artifacts.toString(), artifacts.contains("org.apache.maven.its.mng4056:producer:jar:javadoc:0.1")); + assertTrue( + artifacts.toString(), artifacts.contains("org.apache.maven.its.mng4056:producer:jar:client:0.1")); + } else { // artifact type updated to match type of active artifact - assertTrue( artifacts.toString(), - artifacts.contains( "org.apache.maven.its.mng4056:producer:test-jar:tests:0.1" ) ); - assertTrue( artifacts.toString(), - artifacts.contains( "org.apache.maven.its.mng4056:producer:java-source:sources:0.1" ) ); - assertTrue( artifacts.toString(), - artifacts.contains( "org.apache.maven.its.mng4056:producer:javadoc:javadoc:0.1" ) ); - assertTrue( artifacts.toString(), - artifacts.contains( "org.apache.maven.its.mng4056:producer:ejb-client:client:0.1" ) ); + assertTrue( + artifacts.toString(), + artifacts.contains("org.apache.maven.its.mng4056:producer:test-jar:tests:0.1")); + assertTrue( + artifacts.toString(), + artifacts.contains("org.apache.maven.its.mng4056:producer:java-source:sources:0.1")); + assertTrue( + artifacts.toString(), + artifacts.contains("org.apache.maven.its.mng4056:producer:javadoc:javadoc:0.1")); + assertTrue( + artifacts.toString(), + artifacts.contains("org.apache.maven.its.mng4056:producer:ejb-client:client:0.1")); } - List classpath = verifier.loadLines( "consumer/target/compile.txt", "UTF-8" ); - assertTrue( classpath.toString(), classpath.contains( "producer/test.jar" ) ); - assertTrue( classpath.toString(), classpath.contains( "producer/client.jar" ) ); + List classpath = verifier.loadLines("consumer/target/compile.txt", "UTF-8"); + assertTrue(classpath.toString(), classpath.contains("producer/test.jar")); + assertTrue(classpath.toString(), classpath.contains("producer/client.jar")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4068AuthenticatedMirrorTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4068AuthenticatedMirrorTest.java index 441099edd7..4811de54fa 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4068AuthenticatedMirrorTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4068AuthenticatedMirrorTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.HashMap; import java.util.Map; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.eclipse.jetty.security.ConstraintMapping; import org.eclipse.jetty.security.ConstraintSecurityHandler; import org.eclipse.jetty.security.HashLoginService; @@ -49,9 +47,7 @@ import static org.eclipse.jetty.util.security.Constraint.__BASIC_AUTH; * @author Benjamin Bentmann * */ -public class MavenITmng4068AuthenticatedMirrorTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4068AuthenticatedMirrorTest extends AbstractMavenIntegrationTestCase { private File testDir; @@ -59,61 +55,54 @@ public class MavenITmng4068AuthenticatedMirrorTest private int port; - public MavenITmng4068AuthenticatedMirrorTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng4068AuthenticatedMirrorTest() { + super(ALL_MAVEN_VERSIONS); } @BeforeEach - protected void setUp() - throws Exception - { - testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4068" ); + protected void setUp() throws Exception { + testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4068"); Constraint constraint = new Constraint(); - constraint.setName( Constraint.__BASIC_AUTH ); - constraint.setRoles( new String[] { "user" } ); - constraint.setAuthenticate( true ); + constraint.setName(Constraint.__BASIC_AUTH); + constraint.setRoles(new String[] {"user"}); + constraint.setAuthenticate(true); ConstraintMapping constraintMapping = new ConstraintMapping(); - constraintMapping.setConstraint( constraint ); - constraintMapping.setPathSpec( "/*" ); + constraintMapping.setConstraint(constraint); + constraintMapping.setPathSpec("/*"); - HashLoginService userRealm = new HashLoginService( "TestRealm" ); + HashLoginService userRealm = new HashLoginService("TestRealm"); UserStore userStore = new UserStore(); - userStore.addUser( "testuser", new Password( "testtest" ), new String[] { "user" } ); - userRealm.setUserStore( userStore ); + userStore.addUser("testuser", new Password("testtest"), new String[] {"user"}); + userRealm.setUserStore(userStore); - server = new Server( 0 ); + server = new Server(0); ConstraintSecurityHandler securityHandler = new ConstraintSecurityHandler(); - securityHandler.setLoginService( userRealm ); - securityHandler.setAuthMethod( __BASIC_AUTH ); - securityHandler.setConstraintMappings( new ConstraintMapping[] { constraintMapping } ); + securityHandler.setLoginService(userRealm); + securityHandler.setAuthMethod(__BASIC_AUTH); + securityHandler.setConstraintMappings(new ConstraintMapping[] {constraintMapping}); ResourceHandler repoHandler = new ResourceHandler(); - repoHandler.setResourceBase( new File( testDir, "repo" ).getAbsolutePath() ); + repoHandler.setResourceBase(new File(testDir, "repo").getAbsolutePath()); HandlerList handlerList = new HandlerList(); - handlerList.addHandler( securityHandler ); - handlerList.addHandler( repoHandler ); - handlerList.addHandler( new DefaultHandler() ); + handlerList.addHandler(securityHandler); + handlerList.addHandler(repoHandler); + handlerList.addHandler(new DefaultHandler()); - server.setHandler( handlerList ); + server.setHandler(handlerList); server.start(); - if ( server.isFailed() ) - { - fail( "Couldn't bind the server socket to a free port!" ); + if (server.isFailed()) { + fail("Couldn't bind the server socket to a free port!"); } - port = ( (NetworkConnector) server.getConnectors()[0] ).getLocalPort(); - System.out.println( "Bound server socket to the port " + port ); + port = ((NetworkConnector) server.getConnectors()[0]).getLocalPort(); + System.out.println("Bound server socket to the port " + port); } @AfterEach - protected void tearDown() - throws Exception - { - if ( server != null ) - { + protected void tearDown() throws Exception { + if (server != null) { server.stop(); server.join(); } @@ -126,24 +115,21 @@ public class MavenITmng4068AuthenticatedMirrorTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { + public void testit() throws Exception { Map filterProps = new HashMap<>(); - filterProps.put( "@mirrorPort@", Integer.toString( port ) ); + filterProps.put("@mirrorPort@", Integer.toString(port)); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4068" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8", filterProps); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng4068"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng4068", "a", "0.1", "jar" ); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng4068", "b", "0.1-SNAPSHOT", "jar" ); + verifier.verifyArtifactPresent("org.apache.maven.its.mng4068", "a", "0.1", "jar"); + verifier.verifyArtifactPresent("org.apache.maven.its.mng4068", "b", "0.1-SNAPSHOT", "jar"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4070WhitespaceTrimmingTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4070WhitespaceTrimmingTest.java index c1e8608f3d..fe495ea9c1 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4070WhitespaceTrimmingTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4070WhitespaceTrimmingTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Collections; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4070WhitespaceTrimmingTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4070WhitespaceTrimmingTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4070WhitespaceTrimmingTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng4070WhitespaceTrimmingTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -48,24 +43,21 @@ public class MavenITmng4070WhitespaceTrimmingTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4070" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4070"); - Verifier verifier = newVerifier( new File( testDir, "sub" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4070" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(new File(testDir, "sub").getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4070"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List artifacts = verifier.loadLines( "target/artifacts.txt", "UTF-8" ); - assertEquals( Collections.singletonList( "org.apache.maven.its.mng4070:a:jar:0.1" ), artifacts ); + List artifacts = verifier.loadLines("target/artifacts.txt", "UTF-8"); + assertEquals(Collections.singletonList("org.apache.maven.its.mng4070:a:jar:0.1"), artifacts); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4072InactiveProfileReposTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4072InactiveProfileReposTest.java index d1338791f4..d72e4746f3 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4072InactiveProfileReposTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4072InactiveProfileReposTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4072InactiveProfileReposTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4072InactiveProfileReposTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4072InactiveProfileReposTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng4072InactiveProfileReposTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -46,30 +41,24 @@ public class MavenITmng4072InactiveProfileReposTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4072" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4072"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4072" ); - verifier.filterFile( "pom-template.xml", "pom.xml", "UTF-8" ); - verifier.filterFile( "profiles-template.xml", "profiles.xml", "UTF-8" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - try - { - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng4072"); + verifier.filterFile("pom-template.xml", "pom.xml", "UTF-8"); + verifier.filterFile("profiles-template.xml", "profiles.xml", "UTF-8"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + try { + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - fail( "Dependency resolution succeeded although all profiles are inactive" ); - } - catch ( Exception e ) - { + fail("Dependency resolution succeeded although all profiles are inactive"); + } catch (Exception e) { // expected, all profiles are inactive, hence the repos inaccessible } } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4087PercentEncodedFileUrlTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4087PercentEncodedFileUrlTest.java index 39c563c37c..4297696299 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4087PercentEncodedFileUrlTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4087PercentEncodedFileUrlTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4087PercentEncodedFileUrlTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4087PercentEncodedFileUrlTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4087PercentEncodedFileUrlTest() - { - super( "[2.1.0,)" ); + public MavenITmng4087PercentEncodedFileUrlTest() { + super("[2.1.0,)"); } /** @@ -46,22 +41,19 @@ public class MavenITmng4087PercentEncodedFileUrlTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4087" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4087"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4087" ); - verifier.filterFile( "pom-template.xml", "pom.xml", "UTF-8" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4087"); + verifier.filterFile("pom-template.xml", "pom.xml", "UTF-8"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFileNotPresent( "target/%72%65%70%6F" ); - verifier.verifyFilePresent( "target/repo" ); + verifier.verifyFileNotPresent("target/%72%65%70%6F"); + verifier.verifyFilePresent("target/repo"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4091BadPluginDescriptorTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4091BadPluginDescriptorTest.java index 40a13f86c6..4a1c21bf94 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4091BadPluginDescriptorTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4091BadPluginDescriptorTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,83 +16,70 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; import java.util.List; import java.util.Properties; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** * This is a test set for MNG-4091: * Bad plugin descriptor error handling */ -public class MavenITmng4091BadPluginDescriptorTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4091BadPluginDescriptorTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4091BadPluginDescriptorTest() - { - super( "[2.1.0,)" ); // only test in 2.1.0+ + public MavenITmng4091BadPluginDescriptorTest() { + super("[2.1.0,)"); // only test in 2.1.0+ } @Test - public void testitMNG4091_InvalidDescriptor() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4091/invalid" ); + public void testitMNG4091_InvalidDescriptor() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4091/invalid"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); - try - { - verifier.addCliArgument( "validate" ); + try { + verifier.addCliArgument("validate"); verifier.execute(); - fail( "should throw an error during execution." ); - } - catch ( VerificationException e ) - { + fail("should throw an error during execution."); + } catch (VerificationException e) { // expected...it'd be nice if we could get the specifics of the exception right here... } - List logFile = verifier.loadFile( verifier.getBasedir(), verifier.getLogFileName(), false ); + List logFile = verifier.loadFile(verifier.getBasedir(), verifier.getLogFileName(), false); String msg = "Plugin's descriptor contains the wrong version: 2.0-SNAPSHOT"; boolean foundMessage = false; - for ( String line : logFile ) - { - if ( line.contains( msg ) ) - { + for (String line : logFile) { + if (line.contains(msg)) { foundMessage = true; break; } } - assertTrue( "User-friendly message was not found in output.", foundMessage ); + assertTrue("User-friendly message was not found in output.", foundMessage); } @Test - public void testitMNG4091_PluginDependency() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4091/plugin-dependency" ); + public void testitMNG4091_PluginDependency() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4091/plugin-dependency"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); - verifier.addCliArgument( "validate" ); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/plugin-dependency.properties" ); - assertTrue( props.isEmpty() ); + Properties props = verifier.loadProperties("target/plugin-dependency.properties"); + assertTrue(props.isEmpty()); } } - diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4102InheritedPropertyInterpolationTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4102InheritedPropertyInterpolationTest.java index 22b4681103..0d0525ecc3 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4102InheritedPropertyInterpolationTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4102InheritedPropertyInterpolationTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng4102InheritedPropertyInterpolationTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4102InheritedPropertyInterpolationTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4102InheritedPropertyInterpolationTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng4102InheritedPropertyInterpolationTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -50,10 +45,8 @@ public class MavenITmng4102InheritedPropertyInterpolationTest * @throws Exception in case of failure */ @Test - public void testitNoProfiles() - throws Exception - { - testit( "no-profile" ); + public void testitNoProfiles() throws Exception { + testit("no-profile"); } /** @@ -65,27 +58,22 @@ public class MavenITmng4102InheritedPropertyInterpolationTest * @throws Exception in case of failure */ @Test - public void testitActiveProfiles() - throws Exception - { - testit( "active-profile" ); + public void testitActiveProfiles() throws Exception { + testit("active-profile"); } - private void testit( String project ) - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4102/" + project ); + private void testit(String project) throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4102/" + project); - Verifier verifier = newVerifier( new File( testDir, "sub" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(new File(testDir, "sub").getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/pom.properties" ); - assertEquals( "CHILD", props.getProperty( "project.properties.overridden" ) ); - assertEquals( "CHILD", props.getProperty( "project.properties.interpolated" ) ); + Properties props = verifier.loadProperties("target/pom.properties"); + assertEquals("CHILD", props.getProperty("project.properties.overridden")); + assertEquals("CHILD", props.getProperty("project.properties.interpolated")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4106InterpolationUsesDominantProfileTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4106InterpolationUsesDominantProfileTest.java index 679f16be80..61998ee37c 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4106InterpolationUsesDominantProfileTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4106InterpolationUsesDominantProfileTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng4106InterpolationUsesDominantProfileTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4106InterpolationUsesDominantProfileTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4106InterpolationUsesDominantProfileTest() - { - super( "[2.0.5,)" ); + public MavenITmng4106InterpolationUsesDominantProfileTest() { + super("[2.0.5,)"); } /** @@ -50,41 +45,34 @@ public class MavenITmng4106InterpolationUsesDominantProfileTest * @throws Exception in case of failure */ @Test - public void testitMNG4106() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4106" ); + public void testitMNG4106() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4106"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - if ( matchesVersionRange( "[4.0.0-alpha-1,)" ) ) - { - verifier.addCliArgument( "-Ppom-a,pom-b,settings-a,settings-b" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + if (matchesVersionRange("[4.0.0-alpha-1,)")) { + verifier.addCliArgument("-Ppom-a,pom-b,settings-a,settings-b"); + } else { + verifier.addCliArgument("-Ppom-a,pom-b,profiles-a,profiles-b,settings-a,settings-b"); } - else - { - verifier.addCliArgument( "-Ppom-a,pom-b,profiles-a,profiles-b,settings-a,settings-b" ); - } - verifier.addCliArgument( "validate" ); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/pom.properties" ); + Properties props = verifier.loadProperties("target/pom.properties"); - assertEquals( "b", props.getProperty( "project.properties.pomProperty" ) ); - assertEquals( "b", props.getProperty( "project.properties.pom" ) ); + assertEquals("b", props.getProperty("project.properties.pomProperty")); + assertEquals("b", props.getProperty("project.properties.pom")); - assertEquals( "b", props.getProperty( "project.properties.settingsProperty" ) ); - assertEquals( "b", props.getProperty( "project.properties.settings" ) ); + assertEquals("b", props.getProperty("project.properties.settingsProperty")); + assertEquals("b", props.getProperty("project.properties.settings")); - if ( matchesVersionRange( "(,3.0-alpha-1)" ) ) - { + if (matchesVersionRange("(,3.0-alpha-1)")) { // MNG-4060, profiles.xml support dropped - assertEquals( "b", props.getProperty( "project.properties.profilesProperty" ) ); - assertEquals( "b", props.getProperty( "project.properties.profiles" ) ); + assertEquals("b", props.getProperty("project.properties.profilesProperty")); + assertEquals("b", props.getProperty("project.properties.profiles")); } } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4107InterpolationUsesDominantProfileSourceTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4107InterpolationUsesDominantProfileSourceTest.java index 846a08802c..0faa06f34c 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4107InterpolationUsesDominantProfileSourceTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4107InterpolationUsesDominantProfileSourceTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng4107InterpolationUsesDominantProfileSourceTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4107InterpolationUsesDominantProfileSourceTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4107InterpolationUsesDominantProfileSourceTest() - { - super( "[2.0.5,)" ); + public MavenITmng4107InterpolationUsesDominantProfileSourceTest() { + super("[2.0.5,)"); } /** @@ -50,35 +45,31 @@ public class MavenITmng4107InterpolationUsesDominantProfileSourceTest * @throws Exception in case of failure */ @Test - public void testitMNG4107() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4107" ); + public void testitMNG4107() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4107"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/pom.properties" ); + Properties props = verifier.loadProperties("target/pom.properties"); - assertEquals( "applied", props.getProperty( "project.properties.pomProfile" ) ); - assertEquals( "applied", props.getProperty( "project.properties.settingsProfile" ) ); - assertEquals( "settings", props.getProperty( "project.properties.pomVsSettings" ) ); - assertEquals( "settings", props.getProperty( "project.properties.pomVsSettingsInterpolated" ) ); + assertEquals("applied", props.getProperty("project.properties.pomProfile")); + assertEquals("applied", props.getProperty("project.properties.settingsProfile")); + assertEquals("settings", props.getProperty("project.properties.pomVsSettings")); + assertEquals("settings", props.getProperty("project.properties.pomVsSettingsInterpolated")); - if ( matchesVersionRange( "(,3.0-alpha-1)" ) ) - { + if (matchesVersionRange("(,3.0-alpha-1)")) { // MNG-4060, profiles.xml support dropped - assertEquals( "applied", props.getProperty( "project.properties.profilesProfile" ) ); - assertEquals( "profiles", props.getProperty( "project.properties.pomVsProfiles" ) ); - assertEquals( "profiles", props.getProperty( "project.properties.pomVsProfilesInterpolated" ) ); - assertEquals( "settings", props.getProperty( "project.properties.profilesVsSettings" ) ); - assertEquals( "settings", props.getProperty( "project.properties.profilesVsSettingsInterpolated" ) ); + assertEquals("applied", props.getProperty("project.properties.profilesProfile")); + assertEquals("profiles", props.getProperty("project.properties.pomVsProfiles")); + assertEquals("profiles", props.getProperty("project.properties.pomVsProfilesInterpolated")); + assertEquals("settings", props.getProperty("project.properties.profilesVsSettings")); + assertEquals("settings", props.getProperty("project.properties.profilesVsSettingsInterpolated")); } } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4112MavenVersionPropertyTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4112MavenVersionPropertyTest.java index 4fa2d7df6e..9c0aa1f62d 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4112MavenVersionPropertyTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4112MavenVersionPropertyTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,22 +16,19 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; -public class MavenITmng4112MavenVersionPropertyTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4112MavenVersionPropertyTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4112MavenVersionPropertyTest() - { - super( "(3.0.3,)" ); + public MavenITmng4112MavenVersionPropertyTest() { + super("(3.0.3,)"); } /** @@ -42,27 +37,24 @@ public class MavenITmng4112MavenVersionPropertyTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4112" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4112"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); - Properties props = verifier.loadProperties( "target/pom.properties" ); + Properties props = verifier.loadProperties("target/pom.properties"); - String testMavenVersion = props.getProperty( "project.properties.simpleVersion", "" ); - assertFalse( testMavenVersion, testMavenVersion.contains( "$" ) ); - assertTrue( testMavenVersion, testMavenVersion.matches( "[0-9]+\\.[0-9]+.*" ) ); + String testMavenVersion = props.getProperty("project.properties.simpleVersion", ""); + assertFalse(testMavenVersion, testMavenVersion.contains("$")); + assertTrue(testMavenVersion, testMavenVersion.matches("[0-9]+\\.[0-9]+.*")); - String testMavenBuildVersion = props.getProperty( "project.properties.fullVersion", "" ); - assertTrue( testMavenBuildVersion, testMavenBuildVersion.contains( testMavenVersion ) ); + String testMavenBuildVersion = props.getProperty("project.properties.fullVersion", ""); + assertTrue(testMavenBuildVersion, testMavenBuildVersion.contains(testMavenVersion)); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4116UndecodedUrlsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4116UndecodedUrlsTest.java index cb0e159f94..3ac3626489 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4116UndecodedUrlsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4116UndecodedUrlsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng4116UndecodedUrlsTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4116UndecodedUrlsTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4116UndecodedUrlsTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng4116UndecodedUrlsTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -48,41 +43,36 @@ public class MavenITmng4116UndecodedUrlsTest * @throws Exception in case of failure */ @Test - public void testitMNG4116() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4116" ); + public void testitMNG4116() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4116"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/pom.properties" ); + Properties props = verifier.loadProperties("target/pom.properties"); - assertEquals( "http://maven.apache.org/spacy%20path", - props.getProperty( "project.url" ) ); + assertEquals("http://maven.apache.org/spacy%20path", props.getProperty("project.url")); - assertEquals( "http://svn.apache.org/viewvc/spacy%20path", - props.getProperty( "project.scm.url" ) ); - assertEquals( "scm:svn:svn+ssh://svn.apache.org/spacy%20path", - props.getProperty( "project.scm.connection" ) ); - assertEquals( "scm:svn:svn+ssh://svn.apache.org/spacy%20path", - props.getProperty( "project.scm.developerConnection" ) ); + assertEquals("http://svn.apache.org/viewvc/spacy%20path", props.getProperty("project.scm.url")); + assertEquals("scm:svn:svn+ssh://svn.apache.org/spacy%20path", props.getProperty("project.scm.connection")); + assertEquals( + "scm:svn:svn+ssh://svn.apache.org/spacy%20path", props.getProperty("project.scm.developerConnection")); - assertEquals( "http://ci.apache.org/spacy%20path", - props.getProperty( "project.ciManagement.url" ) ); + assertEquals("http://ci.apache.org/spacy%20path", props.getProperty("project.ciManagement.url")); - assertEquals( "http://issues.apache.org/spacy%20path", - props.getProperty( "project.issueManagement.url" ) ); + assertEquals("http://issues.apache.org/spacy%20path", props.getProperty("project.issueManagement.url")); - assertEquals( "scm:svn:svn+ssh://dist.apache.org/spacy%20path", - props.getProperty( "project.distributionManagement.repository.url" ) ); - assertEquals( "scm:svn:svn+ssh://snap.apache.org/spacy%20path", - props.getProperty( "project.distributionManagement.snapshotRepository.url" ) ); - assertEquals( "scm:svn:svn+ssh://site.apache.org/spacy%20path", - props.getProperty( "project.distributionManagement.site.url" ) ); + assertEquals( + "scm:svn:svn+ssh://dist.apache.org/spacy%20path", + props.getProperty("project.distributionManagement.repository.url")); + assertEquals( + "scm:svn:svn+ssh://snap.apache.org/spacy%20path", + props.getProperty("project.distributionManagement.snapshotRepository.url")); + assertEquals( + "scm:svn:svn+ssh://site.apache.org/spacy%20path", + props.getProperty("project.distributionManagement.site.url")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4129PluginExecutionInheritanceTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4129PluginExecutionInheritanceTest.java index 0f03e50728..daaec472e4 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4129PluginExecutionInheritanceTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4129PluginExecutionInheritanceTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,15 +16,15 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Arrays; import java.util.Collections; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -35,13 +33,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng4129PluginExecutionInheritanceTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4129PluginExecutionInheritanceTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4129PluginExecutionInheritanceTest() - { - super( "[3.0-alpha-3,)" ); + public MavenITmng4129PluginExecutionInheritanceTest() { + super("[3.0-alpha-3,)"); } /** @@ -50,29 +45,26 @@ public class MavenITmng4129PluginExecutionInheritanceTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4129" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4129"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteDirectory( "child-1/target" ); - verifier.deleteDirectory( "child-2/target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteDirectory("child-1/target"); + verifier.deleteDirectory("child-2/target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List executions = verifier.loadLines( "target/executions.txt", "UTF-8" ); - Collections.sort( executions ); - assertEquals( Arrays.asList( new String[] { "inherited-execution", "non-inherited-execution" } ), executions ); + List executions = verifier.loadLines("target/executions.txt", "UTF-8"); + Collections.sort(executions); + assertEquals(Arrays.asList(new String[] {"inherited-execution", "non-inherited-execution"}), executions); - List executions1 = verifier.loadLines( "child-1/target/executions.txt", "UTF-8" ); - assertEquals( Collections.singletonList( "inherited-execution" ), executions1 ); + List executions1 = verifier.loadLines("child-1/target/executions.txt", "UTF-8"); + assertEquals(Collections.singletonList("inherited-execution"), executions1); - List executions2 = verifier.loadLines( "child-2/target/executions.txt", "UTF-8" ); - assertEquals( Collections.singletonList( "inherited-execution" ), executions2 ); + List executions2 = verifier.loadLines("child-2/target/executions.txt", "UTF-8"); + assertEquals(Collections.singletonList("inherited-execution"), executions2); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4150VersionRangeTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4150VersionRangeTest.java index fb41ee61d6..69e7f92218 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4150VersionRangeTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4150VersionRangeTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Collection; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,12 +31,9 @@ import org.junit.jupiter.api.Test; * @author Brett Porter * */ -public class MavenITmng4150VersionRangeTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng4150VersionRangeTest() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenITmng4150VersionRangeTest extends AbstractMavenIntegrationTestCase { + public MavenITmng4150VersionRangeTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -47,28 +42,25 @@ public class MavenITmng4150VersionRangeTest * @throws Exception in case of failure */ @Test - public void testitMNG4150() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4150" ); + public void testitMNG4150() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4150"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4150" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4150"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Collection artifacts = verifier.loadLines( "target/artifacts.txt", "UTF-8" ); - assertEquals( 4, artifacts.size() ); - assertTrue( artifacts.toString(), artifacts.contains( "org.apache.maven.its.mng4150:a:jar:1.1" ) ); - assertTrue( artifacts.toString(), artifacts.contains( "org.apache.maven.its.mng4150:b:jar:1.0" ) ); - assertTrue( artifacts.toString(), artifacts.contains( "org.apache.maven.its.mng4150:c:jar:3.8" ) ); - assertTrue( artifacts.toString(), artifacts.contains( "org.apache.maven.its.mng4150:d:jar:2.1.1" ) ); + Collection artifacts = verifier.loadLines("target/artifacts.txt", "UTF-8"); + assertEquals(4, artifacts.size()); + assertTrue(artifacts.toString(), artifacts.contains("org.apache.maven.its.mng4150:a:jar:1.1")); + assertTrue(artifacts.toString(), artifacts.contains("org.apache.maven.its.mng4150:b:jar:1.0")); + assertTrue(artifacts.toString(), artifacts.contains("org.apache.maven.its.mng4150:c:jar:3.8")); + assertTrue(artifacts.toString(), artifacts.contains("org.apache.maven.its.mng4150:d:jar:2.1.1")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4162ReportingMigrationTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4162ReportingMigrationTest.java index bfaebed425..db55f250a0 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4162ReportingMigrationTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4162ReportingMigrationTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4162ReportingMigrationTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4162ReportingMigrationTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4162ReportingMigrationTest() - { - super( "[3.0-beta-1,4.0.0-alpha-2]" ); + public MavenITmng4162ReportingMigrationTest() { + super("[3.0-beta-1,4.0.0-alpha-2]"); } /** @@ -48,34 +43,45 @@ public class MavenITmng4162ReportingMigrationTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4162" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4162"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); String p = "project.build.plugins.0.executions.0.configuration.children."; - Properties props = verifier.loadProperties( "target/site.properties" ); - assertTrue( props.getProperty( p + "outputDirectory.0.value" ).endsWith( "other-site" ) ); - assertEquals( "maven-surefire-report-plugin", - props.getProperty( p + "reportPlugins.0.children.reportPlugin.0.children.artifactId.0.value" ) ); - assertEquals( "maven-project-info-reports-plugin", - props.getProperty( p + "reportPlugins.0.children.reportPlugin.1.children.artifactId.0.value" ) ); - assertEquals( "report", - props.getProperty( p + "reportPlugins.0.children.reportPlugin.0.children.reportSets.0.children.reportSet.0.children.reports.0.children.report.0.value" ) ); - assertEquals( "report-only", - props.getProperty( p + "reportPlugins.0.children.reportPlugin.0.children.reportSets.0.children.reportSet.1.children.reports.0.children.report.0.value" ) ); - assertEquals( "true", - props.getProperty( p + "reportPlugins.0.children.reportPlugin.0.children.reportSets.0.children.reportSet.0.children.configuration.0.children.skipTests.0.value" ) ); - assertEquals( "false", - props.getProperty( p + "reportPlugins.0.children.reportPlugin.0.children.reportSets.0.children.reportSet.1.children.configuration.0.children.skipTests.0.value" ) ); + Properties props = verifier.loadProperties("target/site.properties"); + assertTrue(props.getProperty(p + "outputDirectory.0.value").endsWith("other-site")); + assertEquals( + "maven-surefire-report-plugin", + props.getProperty(p + "reportPlugins.0.children.reportPlugin.0.children.artifactId.0.value")); + assertEquals( + "maven-project-info-reports-plugin", + props.getProperty(p + "reportPlugins.0.children.reportPlugin.1.children.artifactId.0.value")); + assertEquals( + "report", + props.getProperty( + p + + "reportPlugins.0.children.reportPlugin.0.children.reportSets.0.children.reportSet.0.children.reports.0.children.report.0.value")); + assertEquals( + "report-only", + props.getProperty( + p + + "reportPlugins.0.children.reportPlugin.0.children.reportSets.0.children.reportSet.1.children.reports.0.children.report.0.value")); + assertEquals( + "true", + props.getProperty( + p + + "reportPlugins.0.children.reportPlugin.0.children.reportSets.0.children.reportSet.0.children.configuration.0.children.skipTests.0.value")); + assertEquals( + "false", + props.getProperty( + p + + "reportPlugins.0.children.reportPlugin.0.children.reportSets.0.children.reportSet.1.children.configuration.0.children.skipTests.0.value")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4166HideCoreCommonsCliTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4166HideCoreCommonsCliTest.java index 7e5af01a66..fd27b1c23d 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4166HideCoreCommonsCliTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4166HideCoreCommonsCliTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng4166HideCoreCommonsCliTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4166HideCoreCommonsCliTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4166HideCoreCommonsCliTest() - { - super( "[2.2.0,)" ); + public MavenITmng4166HideCoreCommonsCliTest() { + super("[2.2.0,)"); } /** @@ -49,25 +44,22 @@ public class MavenITmng4166HideCoreCommonsCliTest * @throws Exception in case of failure */ @Test - public void testitMNG4166() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4166" ); + public void testitMNG4166() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4166"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifact( "commons-cli", "commons-cli", "0.1.4166", "jar" ); - verifier.deleteArtifact( "commons-cli", "commons-cli", "0.1.4166", "pom" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifact("commons-cli", "commons-cli", "0.1.4166", "jar"); + verifier.deleteArtifact("commons-cli", "commons-cli", "0.1.4166", "pom"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/class.properties" ); - assertNotNull( props.getProperty( "org.apache.maven.its.mng4166.CoreIt" ) ); + Properties props = verifier.loadProperties("target/class.properties"); + assertNotNull(props.getProperty("org.apache.maven.its.mng4166.CoreIt")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4172EmptyDependencySetTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4172EmptyDependencySetTest.java index 766f9f0934..98766b407c 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4172EmptyDependencySetTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4172EmptyDependencySetTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.ArrayList; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4172EmptyDependencySetTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4172EmptyDependencySetTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4172EmptyDependencySetTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng4172EmptyDependencySetTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -48,20 +43,17 @@ public class MavenITmng4172EmptyDependencySetTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4172" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4172"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List artifacts = verifier.loadLines( "target/artifacts.txt", "UTF-8" ); - assertEquals( new ArrayList(), artifacts ); + List artifacts = verifier.loadLines("target/artifacts.txt", "UTF-8"); + assertEquals(new ArrayList(), artifacts); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4180PerDependencyExclusionsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4180PerDependencyExclusionsTest.java index 186138554c..db708216d9 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4180PerDependencyExclusionsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4180PerDependencyExclusionsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,15 +16,15 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -34,13 +32,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4180PerDependencyExclusionsTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4180PerDependencyExclusionsTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4180PerDependencyExclusionsTest() - { - super( "[2.0.5,)" ); + public MavenITmng4180PerDependencyExclusionsTest() { + super("[2.0.5,)"); } /** @@ -50,31 +45,28 @@ public class MavenITmng4180PerDependencyExclusionsTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4180" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4180"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4180" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4180"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List artifacts = verifier.loadLines( "target/artifacts.txt", "UTF-8" ); - Collections.sort( artifacts ); + List artifacts = verifier.loadLines("target/artifacts.txt", "UTF-8"); + Collections.sort(artifacts); List expected = new ArrayList<>(); - expected.add( "org.apache.maven.its.mng4180:a:jar:0.1" ); - expected.add( "org.apache.maven.its.mng4180:b:jar:0.1" ); - expected.add( "org.apache.maven.its.mng4180:c:jar:0.1" ); + expected.add("org.apache.maven.its.mng4180:a:jar:0.1"); + expected.add("org.apache.maven.its.mng4180:b:jar:0.1"); + expected.add("org.apache.maven.its.mng4180:c:jar:0.1"); - assertEquals( expected, artifacts ); + assertEquals(expected, artifacts); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4189UniqueVersionSnapshotTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4189UniqueVersionSnapshotTest.java index 4f88d31a45..3efa29ade4 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4189UniqueVersionSnapshotTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4189UniqueVersionSnapshotTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,68 +31,62 @@ import org.junit.jupiter.api.Test; * * @author Maria Odea Ching */ -public class MavenITmng4189UniqueVersionSnapshotTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4189UniqueVersionSnapshotTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4189UniqueVersionSnapshotTest() - { - super( "[2.2.1,),[3.0-alpha-3,)" ); + public MavenITmng4189UniqueVersionSnapshotTest() { + super("[2.2.1,),[3.0-alpha-3,)"); } @Test - public void testit() - throws Exception - { - final File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4189" ); + public void testit() throws Exception { + final File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4189"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4189" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.deleteArtifacts("org.apache.maven.its.mng4189"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); // depend on org.apache.maven.its.mng4189:dep:1.0-20090608.090416-1:jar - verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.setLogFileName( "log-1.txt" ); - verifier.addCliArgument( "validate" ); + verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.setLogFileName("log-1.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties checksums = verifier.loadProperties( "target/checksum.properties" ); - assertEquals( "da2e54f69a9ba120f9211c476029f049967d840c", checksums.getProperty( "dep-1.0-SNAPSHOT.jar" ) ); + Properties checksums = verifier.loadProperties("target/checksum.properties"); + assertEquals("da2e54f69a9ba120f9211c476029f049967d840c", checksums.getProperty("dep-1.0-SNAPSHOT.jar")); // depend on org.apache.maven.its.mng4189:dep:1.0-20090608.090416-2:jar - verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "-f" ); - verifier.addCliArgument( "dependent-on-newer-timestamp-pom.xml" ); - verifier.setLogFileName( "log-2.txt" ); - verifier.addCliArgument( "validate" ); + verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("-f"); + verifier.addCliArgument("dependent-on-newer-timestamp-pom.xml"); + verifier.setLogFileName("log-2.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - checksums = verifier.loadProperties( "target/checksum.properties" ); - assertEquals( "835979c28041014c5fd55daa15302d92976924a7", checksums.getProperty( "dep-1.0-SNAPSHOT.jar" ) ); + checksums = verifier.loadProperties("target/checksum.properties"); + assertEquals("835979c28041014c5fd55daa15302d92976924a7", checksums.getProperty("dep-1.0-SNAPSHOT.jar")); // revert back to org.apache.maven.its.mng4189:dep:1.0-20090608.090416-1:jar - verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.setLogFileName( "log-3.txt" ); - verifier.addCliArgument( "validate" ); + verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.setLogFileName("log-3.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - checksums = verifier.loadProperties( "target/checksum.properties" ); - assertEquals( "da2e54f69a9ba120f9211c476029f049967d840c", checksums.getProperty( "dep-1.0-SNAPSHOT.jar" ) ); + checksums = verifier.loadProperties("target/checksum.properties"); + assertEquals("da2e54f69a9ba120f9211c476029f049967d840c", checksums.getProperty("dep-1.0-SNAPSHOT.jar")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4190MirrorRepoMergingTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4190MirrorRepoMergingTest.java index 529cb92f45..c20c4af719 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4190MirrorRepoMergingTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4190MirrorRepoMergingTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,9 +16,7 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.ArrayList; @@ -28,6 +24,8 @@ import java.util.Collections; import java.util.List; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -35,13 +33,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4190MirrorRepoMergingTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4190MirrorRepoMergingTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4190MirrorRepoMergingTest() - { - super( "[3.0-alpha-3,)" ); + public MavenITmng4190MirrorRepoMergingTest() { + super("[3.0-alpha-3,)"); } /** @@ -52,41 +47,38 @@ public class MavenITmng4190MirrorRepoMergingTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4190" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4190"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4190" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4190"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List artifacts = verifier.loadLines( "target/artifacts.txt", "UTF-8" ); - Collections.sort( artifacts ); + List artifacts = verifier.loadLines("target/artifacts.txt", "UTF-8"); + Collections.sort(artifacts); List expected = new ArrayList<>(); - expected.add( "org.apache.maven.its.mng4190:a:jar:0.1" ); - expected.add( "org.apache.maven.its.mng4190:b:jar:0.1-SNAPSHOT" ); + expected.add("org.apache.maven.its.mng4190:a:jar:0.1"); + expected.add("org.apache.maven.its.mng4190:b:jar:0.1-SNAPSHOT"); - assertEquals( expected, artifacts ); + assertEquals(expected, artifacts); - Properties props = verifier.loadProperties( "target/repo.properties" ); - assertEquals( "1", props.getProperty( "project.remoteArtifactRepositories" ) ); + Properties props = verifier.loadProperties("target/repo.properties"); + assertEquals("1", props.getProperty("project.remoteArtifactRepositories")); - assertEquals( "true", props.getProperty( "project.remoteArtifactRepositories.0.releases.enabled" ) ); - assertEquals( "ignore", props.getProperty( "project.remoteArtifactRepositories.0.releases.checksumPolicy" ) ); - assertEquals( "daily", props.getProperty( "project.remoteArtifactRepositories.0.releases.updatePolicy" ) ); + assertEquals("true", props.getProperty("project.remoteArtifactRepositories.0.releases.enabled")); + assertEquals("ignore", props.getProperty("project.remoteArtifactRepositories.0.releases.checksumPolicy")); + assertEquals("daily", props.getProperty("project.remoteArtifactRepositories.0.releases.updatePolicy")); - assertEquals( "true", props.getProperty( "project.remoteArtifactRepositories.0.snapshots.enabled" ) ); - assertEquals( "ignore", props.getProperty( "project.remoteArtifactRepositories.0.snapshots.checksumPolicy" ) ); - assertEquals( "always", props.getProperty( "project.remoteArtifactRepositories.0.snapshots.updatePolicy" ) ); + assertEquals("true", props.getProperty("project.remoteArtifactRepositories.0.snapshots.enabled")); + assertEquals("ignore", props.getProperty("project.remoteArtifactRepositories.0.snapshots.checksumPolicy")); + assertEquals("always", props.getProperty("project.remoteArtifactRepositories.0.snapshots.updatePolicy")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4193UniqueRepoIdTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4193UniqueRepoIdTest.java index 7f2cedceff..1105a2767c 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4193UniqueRepoIdTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4193UniqueRepoIdTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4193UniqueRepoIdTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4193UniqueRepoIdTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4193UniqueRepoIdTest() - { - super( "[3.0-alpha-3,)" ); + public MavenITmng4193UniqueRepoIdTest() { + super("[3.0-alpha-3,)"); } /** @@ -47,25 +42,19 @@ public class MavenITmng4193UniqueRepoIdTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4193" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4193"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - try - { - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + try { + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - fail( "Duplicate repository ids did not cause validation error" ); - } - catch ( VerificationException e ) - { + fail("Duplicate repository ids did not cause validation error"); + } catch (VerificationException e) { // expected } } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4196ExclusionOnPluginDepTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4196ExclusionOnPluginDepTest.java index c7eff12d30..17f892761b 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4196ExclusionOnPluginDepTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4196ExclusionOnPluginDepTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author John Casey * */ -public class MavenITmng4196ExclusionOnPluginDepTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4196ExclusionOnPluginDepTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4196ExclusionOnPluginDepTest() - { - super( "[2.0.9,)" ); + public MavenITmng4196ExclusionOnPluginDepTest() { + super("[2.0.9,)"); } /** @@ -48,26 +43,23 @@ public class MavenITmng4196ExclusionOnPluginDepTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4196" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4196"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties pclProps = verifier.loadProperties( "target/pcl.properties" ); - assertNull( pclProps.getProperty( "org.apache.maven.plugin.coreit.ClassA" ) ); - assertNotNull( pclProps.getProperty( "org.apache.maven.plugin.coreit.ClassB" ) ); - assertNull( pclProps.getProperty( "org/apache/maven/plugin/coreit/a.properties" ) ); - assertNotNull( pclProps.getProperty( "org/apache/maven/plugin/coreit/b.properties" ) ); + Properties pclProps = verifier.loadProperties("target/pcl.properties"); + assertNull(pclProps.getProperty("org.apache.maven.plugin.coreit.ClassA")); + assertNotNull(pclProps.getProperty("org.apache.maven.plugin.coreit.ClassB")); + assertNull(pclProps.getProperty("org/apache/maven/plugin/coreit/a.properties")); + assertNotNull(pclProps.getProperty("org/apache/maven/plugin/coreit/b.properties")); - Properties tcclProps = verifier.loadProperties( "target/tccl.properties" ); - assertEquals( pclProps, tcclProps ); + Properties tcclProps = verifier.loadProperties("target/tccl.properties"); + assertEquals(pclProps, tcclProps); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4199CompileMeetsRuntimeScopeTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4199CompileMeetsRuntimeScopeTest.java index b2bbed9436..365f61a672 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4199CompileMeetsRuntimeScopeTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4199CompileMeetsRuntimeScopeTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,17 +31,14 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng4199CompileMeetsRuntimeScopeTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4199CompileMeetsRuntimeScopeTest extends AbstractMavenIntegrationTestCase { /* * NOTE: Class path ordering is another issue (MNG-1412), so we merely check set containment here. */ - public MavenITmng4199CompileMeetsRuntimeScopeTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng4199CompileMeetsRuntimeScopeTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -54,50 +49,57 @@ public class MavenITmng4199CompileMeetsRuntimeScopeTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4199" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4199"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4199" ); - verifier.filterFile( "pom-template.xml", "pom.xml", "UTF-8" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4199"); + verifier.filterFile("pom-template.xml", "pom.xml", "UTF-8"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List compileArtifacts = verifier.loadLines( "target/compile-artifacts.txt", "UTF-8" ); - assertTrue( compileArtifacts.toString(), compileArtifacts.contains( "org.apache.maven.its.mng4199:system:jar:0.1" ) ); - assertTrue( compileArtifacts.toString(), compileArtifacts.contains( "org.apache.maven.its.mng4199:provided:jar:0.1" ) ); - assertTrue( compileArtifacts.toString(), compileArtifacts.contains( "org.apache.maven.its.mng4199:compile:jar:0.1" ) ); - assertFalse( compileArtifacts.toString(), compileArtifacts.contains( "org.apache.maven.its.mng4199:runtime:jar:0.1" ) ); - assertEquals( 3, compileArtifacts.size() ); + List compileArtifacts = verifier.loadLines("target/compile-artifacts.txt", "UTF-8"); + assertTrue( + compileArtifacts.toString(), compileArtifacts.contains("org.apache.maven.its.mng4199:system:jar:0.1")); + assertTrue( + compileArtifacts.toString(), + compileArtifacts.contains("org.apache.maven.its.mng4199:provided:jar:0.1")); + assertTrue( + compileArtifacts.toString(), compileArtifacts.contains("org.apache.maven.its.mng4199:compile:jar:0.1")); + assertFalse( + compileArtifacts.toString(), compileArtifacts.contains("org.apache.maven.its.mng4199:runtime:jar:0.1")); + assertEquals(3, compileArtifacts.size()); - List compileClassPath = verifier.loadLines( "target/compile-cp.txt", "UTF-8" ); - assertTrue( compileClassPath.toString(), compileClassPath.contains( "system-0.1.jar" ) ); - assertTrue( compileClassPath.toString(), compileClassPath.contains( "provided-0.1.jar" ) ); - assertTrue( compileClassPath.toString(), compileClassPath.contains( "compile-0.1.jar" ) ); - assertFalse( compileClassPath.toString(), compileClassPath.contains( "runtime-0.1.jar" ) ); - assertEquals( 4, compileClassPath.size() ); + List compileClassPath = verifier.loadLines("target/compile-cp.txt", "UTF-8"); + assertTrue(compileClassPath.toString(), compileClassPath.contains("system-0.1.jar")); + assertTrue(compileClassPath.toString(), compileClassPath.contains("provided-0.1.jar")); + assertTrue(compileClassPath.toString(), compileClassPath.contains("compile-0.1.jar")); + assertFalse(compileClassPath.toString(), compileClassPath.contains("runtime-0.1.jar")); + assertEquals(4, compileClassPath.size()); - List runtimeArtifacts = verifier.loadLines( "target/runtime-artifacts.txt", "UTF-8" ); - assertFalse( runtimeArtifacts.toString(), runtimeArtifacts.contains( "org.apache.maven.its.mng4199:system:jar:0.1" ) ); - assertFalse( runtimeArtifacts.toString(), runtimeArtifacts.contains( "org.apache.maven.its.mng4199:provided:jar:0.1" ) ); - assertTrue( runtimeArtifacts.toString(), runtimeArtifacts.contains( "org.apache.maven.its.mng4199:compile:jar:0.1" ) ); - assertTrue( runtimeArtifacts.toString(), runtimeArtifacts.contains( "org.apache.maven.its.mng4199:runtime:jar:0.1" ) ); - assertEquals( 2, runtimeArtifacts.size() ); + List runtimeArtifacts = verifier.loadLines("target/runtime-artifacts.txt", "UTF-8"); + assertFalse( + runtimeArtifacts.toString(), runtimeArtifacts.contains("org.apache.maven.its.mng4199:system:jar:0.1")); + assertFalse( + runtimeArtifacts.toString(), + runtimeArtifacts.contains("org.apache.maven.its.mng4199:provided:jar:0.1")); + assertTrue( + runtimeArtifacts.toString(), runtimeArtifacts.contains("org.apache.maven.its.mng4199:compile:jar:0.1")); + assertTrue( + runtimeArtifacts.toString(), runtimeArtifacts.contains("org.apache.maven.its.mng4199:runtime:jar:0.1")); + assertEquals(2, runtimeArtifacts.size()); - List runtimeClassPath = verifier.loadLines( "target/runtime-cp.txt", "UTF-8" ); - assertFalse( runtimeClassPath.toString(), runtimeClassPath.contains( "system-0.1.jar" ) ); - assertFalse( runtimeClassPath.toString(), runtimeClassPath.contains( "provided-0.1.jar" ) ); - assertTrue( runtimeClassPath.toString(), runtimeClassPath.contains( "compile-0.1.jar" ) ); - assertTrue( runtimeClassPath.toString(), runtimeClassPath.contains( "runtime-0.1.jar" ) ); - assertEquals( 3, runtimeClassPath.size() ); + List runtimeClassPath = verifier.loadLines("target/runtime-cp.txt", "UTF-8"); + assertFalse(runtimeClassPath.toString(), runtimeClassPath.contains("system-0.1.jar")); + assertFalse(runtimeClassPath.toString(), runtimeClassPath.contains("provided-0.1.jar")); + assertTrue(runtimeClassPath.toString(), runtimeClassPath.contains("compile-0.1.jar")); + assertTrue(runtimeClassPath.toString(), runtimeClassPath.contains("runtime-0.1.jar")); + assertEquals(3, runtimeClassPath.size()); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4203TransitiveDependencyExclusionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4203TransitiveDependencyExclusionTest.java index 27a491661c..494e8f21b8 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4203TransitiveDependencyExclusionTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4203TransitiveDependencyExclusionTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,15 +16,15 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -34,13 +32,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4203TransitiveDependencyExclusionTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4203TransitiveDependencyExclusionTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4203TransitiveDependencyExclusionTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng4203TransitiveDependencyExclusionTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -49,33 +44,30 @@ public class MavenITmng4203TransitiveDependencyExclusionTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4203" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4203"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4203" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4203"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List artifacts = verifier.loadLines( "target/artifacts.txt", "UTF-8" ); - Collections.sort( artifacts ); + List artifacts = verifier.loadLines("target/artifacts.txt", "UTF-8"); + Collections.sort(artifacts); List expected = new ArrayList<>(); - expected.add( "org.apache.maven.its.mng4203:b:jar:0.1" ); - expected.add( "org.apache.maven.its.mng4203:c:jar:0.1" ); + expected.add("org.apache.maven.its.mng4203:b:jar:0.1"); + expected.add("org.apache.maven.its.mng4203:c:jar:0.1"); - assertEquals( expected, artifacts ); + assertEquals(expected, artifacts); - verifier.verifyArtifactNotPresent( "org.apache.maven.its.mng4203", "a", "0.1", "pom" ); - verifier.verifyArtifactNotPresent( "org.apache.maven.its.mng4203", "a", "0.1", "jar" ); + verifier.verifyArtifactNotPresent("org.apache.maven.its.mng4203", "a", "0.1", "pom"); + verifier.verifyArtifactNotPresent("org.apache.maven.its.mng4203", "a", "0.1", "jar"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4207PluginWithLog4JTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4207PluginWithLog4JTest.java index e61b9b50dd..0ba2ee0097 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4207PluginWithLog4JTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4207PluginWithLog4JTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * * @author John Casey */ -public class MavenITmng4207PluginWithLog4JTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4207PluginWithLog4JTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4207PluginWithLog4JTest() - { - super( "[2.0.3,)" ); + public MavenITmng4207PluginWithLog4JTest() { + super("[2.0.3,)"); } /** @@ -47,19 +42,16 @@ public class MavenITmng4207PluginWithLog4JTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4207" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4207"); - Verifier verifier = newVerifier( testDir.getAbsolutePath(), "remote" ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4207" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "initialize" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath(), "remote"); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng4207"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("initialize"); verifier.execute(); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4208InterpolationPrefersCliOverProjectPropsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4208InterpolationPrefersCliOverProjectPropsTest.java index 4a7465ea9b..0e01d707a0 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4208InterpolationPrefersCliOverProjectPropsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4208InterpolationPrefersCliOverProjectPropsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4208InterpolationPrefersCliOverProjectPropsTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4208InterpolationPrefersCliOverProjectPropsTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4208InterpolationPrefersCliOverProjectPropsTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng4208InterpolationPrefersCliOverProjectPropsTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -47,21 +42,18 @@ public class MavenITmng4208InterpolationPrefersCliOverProjectPropsTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4208" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4208"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "-DtestProperty=PASSED" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("-DtestProperty=PASSED"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/pom.properties" ); - assertEquals( "PASSED", props.getProperty( "project.properties.interpolatedProperty" ) ); + Properties props = verifier.loadProperties("target/pom.properties"); + assertEquals("PASSED", props.getProperty("project.properties.interpolatedProperty")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4214MirroredParentSearchReposTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4214MirroredParentSearchReposTest.java index 516ce04755..8816f951bd 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4214MirroredParentSearchReposTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4214MirroredParentSearchReposTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4214MirroredParentSearchReposTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4214MirroredParentSearchReposTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4214MirroredParentSearchReposTest() - { - super( "[2.0.5,)" ); + public MavenITmng4214MirroredParentSearchReposTest() { + super("[2.0.5,)"); } /** @@ -48,23 +43,20 @@ public class MavenITmng4214MirroredParentSearchReposTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4214" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4214"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4214" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4214"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng4214", "parent", "0.1", "pom" ); + verifier.verifyArtifactPresent("org.apache.maven.its.mng4214", "parent", "0.1", "pom"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4231SnapshotUpdatePolicyTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4231SnapshotUpdatePolicyTest.java index c85ca66fbb..b5323a2af0 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4231SnapshotUpdatePolicyTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4231SnapshotUpdatePolicyTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Map; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4231SnapshotUpdatePolicyTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4231SnapshotUpdatePolicyTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4231SnapshotUpdatePolicyTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng4231SnapshotUpdatePolicyTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -48,39 +43,36 @@ public class MavenITmng4231SnapshotUpdatePolicyTest * @throws Exception in case of failure */ @Test - public void testitAlways() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4231" ); + public void testitAlways() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4231"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4231" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng4231"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); Map filterProps = verifier.newDefaultFilterMap(); - filterProps.put( "@updates@", "always" ); + filterProps.put("@updates@", "always"); - filterProps.put( "@repo@", "repo-1" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps ); - verifier.setLogFileName( "log-always-1.txt" ); - verifier.addCliArgument( "validate" ); + filterProps.put("@repo@", "repo-1"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8", filterProps); + verifier.setLogFileName("log-always-1.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - filterProps.put( "@repo@", "repo-2" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps ); - verifier.setLogFileName( "log-always-2.txt" ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + filterProps.put("@repo@", "repo-2"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8", filterProps); + verifier.setLogFileName("log-always-2.txt"); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - - Properties checksums = verifier.loadProperties( "target/checksum.properties" ); - assertChecksum( "db3f17644e813af768ae6e82a6d0a2f29aef8988", "a-0.1-SNAPSHOT.jar", checksums ); - assertChecksum( "5e3265f3ed55e8b217ff9db444fd8d888962a990", "b-0.1-SNAPSHOT.jar", checksums ); + Properties checksums = verifier.loadProperties("target/checksum.properties"); + assertChecksum("db3f17644e813af768ae6e82a6d0a2f29aef8988", "a-0.1-SNAPSHOT.jar", checksums); + assertChecksum("5e3265f3ed55e8b217ff9db444fd8d888962a990", "b-0.1-SNAPSHOT.jar", checksums); } /** @@ -89,44 +81,39 @@ public class MavenITmng4231SnapshotUpdatePolicyTest * @throws Exception in case of failure */ @Test - public void testitNever() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4231" ); + public void testitNever() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4231"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4231" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng4231"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); Map filterProps = verifier.newDefaultFilterMap(); - filterProps.put( "@updates@", "never" ); + filterProps.put("@updates@", "never"); - filterProps.put( "@repo@", "repo-1" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps ); - verifier.setLogFileName( "log-never-1.txt" ); - verifier.addCliArgument( "validate" ); + filterProps.put("@repo@", "repo-1"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8", filterProps); + verifier.setLogFileName("log-never-1.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - filterProps.put( "@repo@", "repo-2" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps ); - verifier.setLogFileName( "log-never-2.txt" ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + filterProps.put("@repo@", "repo-2"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8", filterProps); + verifier.setLogFileName("log-never-2.txt"); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - - Properties checksums = verifier.loadProperties( "target/checksum.properties" ); - assertChecksum( "ec6c9ea65766cc272df0ee26076240d6a93047d5", "a-0.1-SNAPSHOT.jar", checksums ); - assertChecksum( "", "b-0.1-SNAPSHOT.jar", checksums ); + Properties checksums = verifier.loadProperties("target/checksum.properties"); + assertChecksum("ec6c9ea65766cc272df0ee26076240d6a93047d5", "a-0.1-SNAPSHOT.jar", checksums); + assertChecksum("", "b-0.1-SNAPSHOT.jar", checksums); } - private void assertChecksum( String checksum, String jar, Properties checksums ) - { - assertEquals( checksum, checksums.getProperty( jar, "" ).toLowerCase( java.util.Locale.ENGLISH ) ); + private void assertChecksum(String checksum, String jar, Properties checksums) { + assertEquals(checksum, checksums.getProperty(jar, "").toLowerCase(java.util.Locale.ENGLISH)); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4233ReactorResolutionForManuallyCreatedArtifactTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4233ReactorResolutionForManuallyCreatedArtifactTest.java index 2a587b07c0..cc7fddfa99 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4233ReactorResolutionForManuallyCreatedArtifactTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4233ReactorResolutionForManuallyCreatedArtifactTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4233ReactorResolutionForManuallyCreatedArtifactTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4233ReactorResolutionForManuallyCreatedArtifactTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4233ReactorResolutionForManuallyCreatedArtifactTest() - { - super( "[3.0-alpha-3,)" ); + public MavenITmng4233ReactorResolutionForManuallyCreatedArtifactTest() { + super("[3.0-alpha-3,)"); } /** @@ -50,21 +45,20 @@ public class MavenITmng4233ReactorResolutionForManuallyCreatedArtifactTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4233" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4233"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "consumer/target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("consumer/target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "consumer/target/artifact.properties" ); - assertEquals( new File( testDir.getCanonicalFile(), "producer/pom.xml" ), new File( - props.getProperty( "org.apache.maven.its.mng4233:producer:jar:1.0-SNAPSHOT" ) ).getCanonicalFile() ); + Properties props = verifier.loadProperties("consumer/target/artifact.properties"); + assertEquals( + new File(testDir.getCanonicalFile(), "producer/pom.xml"), + new File(props.getProperty("org.apache.maven.its.mng4233:producer:jar:1.0-SNAPSHOT")) + .getCanonicalFile()); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4235HttpAuthDeploymentChecksumsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4235HttpAuthDeploymentChecksumsTest.java index c750f2d682..2cc2e4f310 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4235HttpAuthDeploymentChecksumsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4235HttpAuthDeploymentChecksumsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,9 +16,7 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; @@ -35,6 +31,8 @@ import java.util.Map; import java.util.concurrent.ConcurrentLinkedDeque; import org.apache.maven.it.utils.DeployedResource; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.codehaus.plexus.util.StringUtils; import org.eclipse.jetty.security.ConstraintMapping; import org.eclipse.jetty.security.ConstraintSecurityHandler; @@ -62,9 +60,7 @@ import static org.eclipse.jetty.util.security.Constraint.__BASIC_AUTH; * @author Benjamin Bentmann * */ -public class MavenITmng4235HttpAuthDeploymentChecksumsTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4235HttpAuthDeploymentChecksumsTest extends AbstractMavenIntegrationTestCase { private File testDir; private Server server; @@ -73,60 +69,53 @@ public class MavenITmng4235HttpAuthDeploymentChecksumsTest private final RepoHandler repoHandler = new RepoHandler(); - public MavenITmng4235HttpAuthDeploymentChecksumsTest() - { - super( "[2.0.5,2.2.0),(2.2.0,)" ); + public MavenITmng4235HttpAuthDeploymentChecksumsTest() { + super("[2.0.5,2.2.0),(2.2.0,)"); } @BeforeEach - protected void setUp() - throws Exception - { - testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4235" ); + protected void setUp() throws Exception { + testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4235"); - repoHandler.setResourceBase( testDir.getAbsolutePath() ); + repoHandler.setResourceBase(testDir.getAbsolutePath()); Constraint constraint = new Constraint(); - constraint.setName( Constraint.__BASIC_AUTH ); - constraint.setRoles( new String[]{ "deployer" } ); - constraint.setAuthenticate( true ); + constraint.setName(Constraint.__BASIC_AUTH); + constraint.setRoles(new String[] {"deployer"}); + constraint.setAuthenticate(true); ConstraintMapping constraintMapping = new ConstraintMapping(); - constraintMapping.setConstraint( constraint ); - constraintMapping.setPathSpec( "/*" ); + constraintMapping.setConstraint(constraint); + constraintMapping.setPathSpec("/*"); - HashLoginService userRealm = new HashLoginService( "TestRealm" ); + HashLoginService userRealm = new HashLoginService("TestRealm"); UserStore userStore = new UserStore(); - userStore.addUser( "testuser", new Password( "testpass" ), new String[] { "deployer" } ); - userRealm.setUserStore( userStore ); + userStore.addUser("testuser", new Password("testpass"), new String[] {"deployer"}); + userRealm.setUserStore(userStore); ConstraintSecurityHandler securityHandler = new ConstraintSecurityHandler(); - securityHandler.setLoginService( userRealm ); - securityHandler.setAuthMethod( __BASIC_AUTH ); - securityHandler.setConstraintMappings( new ConstraintMapping[] { constraintMapping } ); + securityHandler.setLoginService(userRealm); + securityHandler.setAuthMethod(__BASIC_AUTH); + securityHandler.setConstraintMappings(new ConstraintMapping[] {constraintMapping}); HandlerList handlerList = new HandlerList(); - handlerList.addHandler( securityHandler ); - handlerList.addHandler( repoHandler ); - handlerList.addHandler( new DefaultHandler() ); + handlerList.addHandler(securityHandler); + handlerList.addHandler(repoHandler); + handlerList.addHandler(new DefaultHandler()); - server = new Server( 0 ); - server.setHandler( handlerList ); + server = new Server(0); + server.setHandler(handlerList); server.start(); - if ( server.isFailed() ) - { - fail( "Couldn't bind the server socket to a free port!" ); + if (server.isFailed()) { + fail("Couldn't bind the server socket to a free port!"); } - port = ( (NetworkConnector) server.getConnectors()[0] ).getLocalPort(); - System.out.println( "Bound server socket to the port " + port ); + port = ((NetworkConnector) server.getConnectors()[0]).getLocalPort(); + System.out.println("Bound server socket to the port " + port); } @AfterEach - protected void tearDown() - throws Exception - { - if ( server != null ) - { + protected void tearDown() throws Exception { + if (server != null) { server.stop(); server.join(); } @@ -141,93 +130,80 @@ public class MavenITmng4235HttpAuthDeploymentChecksumsTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { + public void testit() throws Exception { Map filterProps = new HashMap<>(); - filterProps.put( "@port@", Integer.toString( port ) ); + filterProps.put("@port@", Integer.toString(port)); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.filterFile( "pom-template.xml", "pom.xml", "UTF-8", filterProps ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4235" ); - verifier.deleteDirectory( "repo" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.filterFile("pom-template.xml", "pom.xml", "UTF-8", filterProps); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng4235"); + verifier.deleteDirectory("repo"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - assertHash( verifier, "repo/org/apache/maven/its/mng4235/test/0.1/test-0.1.jar", ".sha1", "SHA-1" ); - assertHash( verifier, "repo/org/apache/maven/its/mng4235/test/0.1/test-0.1.jar", ".md5", "MD5" ); + assertHash(verifier, "repo/org/apache/maven/its/mng4235/test/0.1/test-0.1.jar", ".sha1", "SHA-1"); + assertHash(verifier, "repo/org/apache/maven/its/mng4235/test/0.1/test-0.1.jar", ".md5", "MD5"); - assertHash( verifier, "repo/org/apache/maven/its/mng4235/test/0.1/test-0.1.pom", ".sha1", "SHA-1" ); - assertHash( verifier, "repo/org/apache/maven/its/mng4235/test/0.1/test-0.1.pom", ".md5", "MD5" ); + assertHash(verifier, "repo/org/apache/maven/its/mng4235/test/0.1/test-0.1.pom", ".sha1", "SHA-1"); + assertHash(verifier, "repo/org/apache/maven/its/mng4235/test/0.1/test-0.1.pom", ".md5", "MD5"); - assertHash( verifier, "repo/org/apache/maven/its/mng4235/test/maven-metadata.xml", ".sha1", "SHA-1" ); - assertHash( verifier, "repo/org/apache/maven/its/mng4235/test/maven-metadata.xml", ".md5", "MD5" ); + assertHash(verifier, "repo/org/apache/maven/its/mng4235/test/maven-metadata.xml", ".sha1", "SHA-1"); + assertHash(verifier, "repo/org/apache/maven/its/mng4235/test/maven-metadata.xml", ".md5", "MD5"); - for ( DeployedResource deployedResource : repoHandler.deployedResources ) - { - if ( StringUtils.equalsIgnoreCase( "chunked", deployedResource.transferEncoding ) ) - { - fail( "deployedResource " + deployedResource - + " use chunked transfert encoding some http server doesn't support that" ); + for (DeployedResource deployedResource : repoHandler.deployedResources) { + if (StringUtils.equalsIgnoreCase("chunked", deployedResource.transferEncoding)) { + fail("deployedResource " + deployedResource + + " use chunked transfert encoding some http server doesn't support that"); } } } - private void assertHash( Verifier verifier, String dataFile, String hashExt, String algo ) - throws Exception - { - String actualHash = ItUtils.calcHash( new File( verifier.getBasedir(), dataFile ), algo ); + private void assertHash(Verifier verifier, String dataFile, String hashExt, String algo) throws Exception { + String actualHash = ItUtils.calcHash(new File(verifier.getBasedir(), dataFile), algo); - String expectedHash = verifier.loadLines( dataFile + hashExt, "UTF-8" ).get( 0 ).trim(); + String expectedHash = + verifier.loadLines(dataFile + hashExt, "UTF-8").get(0).trim(); - assertTrue( "expected=" + expectedHash + ", actual=" + actualHash, - expectedHash.equalsIgnoreCase( actualHash ) ); + assertTrue("expected=" + expectedHash + ", actual=" + actualHash, expectedHash.equalsIgnoreCase(actualHash)); } - private static class RepoHandler - extends ResourceHandler - { + private static class RepoHandler extends ResourceHandler { private final Deque deployedResources = new ConcurrentLinkedDeque<>(); @Override public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) - throws IOException, ServletException - { - System.out.println( request.getMethod() + " " + request.getRequestURI() ); + throws IOException, ServletException { + System.out.println(request.getMethod() + " " + request.getRequestURI()); - if ( "PUT".equals( request.getMethod() ) ) - { - Resource resource = getResource( request.getPathInfo() ); + if ("PUT".equals(request.getMethod())) { + Resource resource = getResource(request.getPathInfo()); // NOTE: This can get called concurrently but File.mkdirs() isn't thread-safe in all JREs File dir = resource.getFile().getParentFile(); - for ( int i = 0; i < 10 && !dir.exists(); i++ ) - { + for (int i = 0; i < 10 && !dir.exists(); i++) { dir.mkdirs(); } - Files.copy( request.getInputStream(), resource.getFile().toPath(), REPLACE_EXISTING ); + Files.copy(request.getInputStream(), resource.getFile().toPath(), REPLACE_EXISTING); DeployedResource deployedResource = new DeployedResource(); deployedResource.httpMethod = request.getMethod(); deployedResource.requestUri = request.getRequestURI(); - deployedResource.transferEncoding = request.getHeader( "Transfer-Encoding" ); - deployedResource.contentLength = request.getHeader( "Content-Length" ); + deployedResource.transferEncoding = request.getHeader("Transfer-Encoding"); + deployedResource.contentLength = request.getHeader("Content-Length"); - deployedResources.add( deployedResource ); + deployedResources.add(deployedResource); - response.setStatus( HttpServletResponse.SC_NO_CONTENT ); + response.setStatus(HttpServletResponse.SC_NO_CONTENT); - ( (Request) request ).setHandled( true ); - } - else - { - super.handle( target, baseRequest, request, response ); + ((Request) request).setHandled(true); + } else { + super.handle(target, baseRequest, request, response); } } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4238ArtifactHandlerExtensionUsageTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4238ArtifactHandlerExtensionUsageTest.java index 4789e86f68..c91c43047a 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4238ArtifactHandlerExtensionUsageTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4238ArtifactHandlerExtensionUsageTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; import java.io.IOException; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -34,9 +32,7 @@ import org.junit.jupiter.api.Test; * @author John Casey * */ -public class MavenITmng4238ArtifactHandlerExtensionUsageTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4238ArtifactHandlerExtensionUsageTest extends AbstractMavenIntegrationTestCase { private static final String GID = "org.apache.maven.its.mng4238"; private static final String AID = "mng-4238"; @@ -44,22 +40,19 @@ public class MavenITmng4238ArtifactHandlerExtensionUsageTest private static final String TYPE = "jar"; private static final String BAD_TYPE = "coreit"; - public MavenITmng4238ArtifactHandlerExtensionUsageTest() - { - super( "(2.2.0,)" ); + public MavenITmng4238ArtifactHandlerExtensionUsageTest() { + super("(2.2.0,)"); } @Test - public void testProjectPackagingUsage() - throws IOException, VerificationException - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4238" ); + public void testProjectPackagingUsage() throws IOException, VerificationException { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4238"); - Verifier verifier = newVerifier( testDir.getAbsolutePath(), "remote" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath(), "remote"); - verifier.deleteArtifacts( GID ); + verifier.deleteArtifacts(GID); - verifier.addCliArgument( "install" ); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); @@ -67,13 +60,13 @@ public class MavenITmng4238ArtifactHandlerExtensionUsageTest // Now, if everything worked, we have a .pom and a .jar in the local repo. // IF IT DIDN'T, we have a .pom and a .coreit in the local repo... - String path = verifier.getArtifactPath( GID, AID, VERSION, TYPE ); - assertTrue( path + " should have been installed.", new File( path ).exists() ); + String path = verifier.getArtifactPath(GID, AID, VERSION, TYPE); + assertTrue(path + " should have been installed.", new File(path).exists()); - path = verifier.getArtifactPath( GID, AID, VERSION, "pom" ); - assertTrue( path + " should have been installed.", new File( path ).exists() ); + path = verifier.getArtifactPath(GID, AID, VERSION, "pom"); + assertTrue(path + " should have been installed.", new File(path).exists()); - path = verifier.getArtifactPath( GID, AID, VERSION, BAD_TYPE ); - assertFalse( path + " should NOT have been installed.", new File( path ).exists() ); + path = verifier.getArtifactPath(GID, AID, VERSION, BAD_TYPE); + assertFalse(path + " should NOT have been installed.", new File(path).exists()); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4262MakeLikeReactorDottedPath370Test.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4262MakeLikeReactorDottedPath370Test.java index 0785e25d56..50c19153ea 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4262MakeLikeReactorDottedPath370Test.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4262MakeLikeReactorDottedPath370Test.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,20 +29,15 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4262MakeLikeReactorDottedPath370Test - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4262MakeLikeReactorDottedPath370Test extends AbstractMavenIntegrationTestCase { - public MavenITmng4262MakeLikeReactorDottedPath370Test() - { - super( "[4.0.0-alpha-1,)" ); + public MavenITmng4262MakeLikeReactorDottedPath370Test() { + super("[4.0.0-alpha-1,)"); } - private void clean( Verifier verifier ) - throws Exception - { - verifier.deleteDirectory( "target" ); - verifier.deleteDirectory( "../sub-a/target" ); + private void clean(Verifier verifier) throws Exception { + verifier.deleteDirectory("target"); + verifier.deleteDirectory("../sub-a/target"); } /** @@ -53,23 +46,21 @@ public class MavenITmng4262MakeLikeReactorDottedPath370Test * @throws Exception in case of failure */ @Test - public void testitMakeRoot() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4262" ); + public void testitMakeRoot() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4262"); - Verifier verifier = newVerifier( new File( testDir, "parent" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - clean( verifier ); - verifier.addCliArgument( "-pl" ); - verifier.addCliArgument( "." ); - verifier.setLogFileName( "log-root.txt" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(new File(testDir, "parent").getAbsolutePath()); + verifier.setAutoclean(false); + clean(verifier); + verifier.addCliArgument("-pl"); + verifier.addCliArgument("."); + verifier.setLogFileName("log-root.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/touch.txt" ); - verifier.verifyFilePresent( "../sub-a/target/touch.txt" ); + verifier.verifyFilePresent("target/touch.txt"); + verifier.verifyFilePresent("../sub-a/target/touch.txt"); } /** @@ -78,23 +69,20 @@ public class MavenITmng4262MakeLikeReactorDottedPath370Test * @throws Exception in case of failure */ @Test - public void testitMakeModule() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4262" ); + public void testitMakeModule() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4262"); - Verifier verifier = newVerifier( new File( testDir, "parent" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - clean( verifier ); - verifier.addCliArgument( "-pl" ); - verifier.addCliArgument( "../sub-a" ); - verifier.setLogFileName( "log-module.txt" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(new File(testDir, "parent").getAbsolutePath()); + verifier.setAutoclean(false); + clean(verifier); + verifier.addCliArgument("-pl"); + verifier.addCliArgument("../sub-a"); + verifier.setLogFileName("log-module.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFileNotPresent( "target/touch.txt" ); - verifier.verifyFilePresent( "../sub-a/target/touch.txt" ); + verifier.verifyFileNotPresent("target/touch.txt"); + verifier.verifyFilePresent("../sub-a/target/touch.txt"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4262MakeLikeReactorDottedPathTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4262MakeLikeReactorDottedPathTest.java index 754ee9087f..e6448d9497 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4262MakeLikeReactorDottedPathTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4262MakeLikeReactorDottedPathTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,20 +29,15 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4262MakeLikeReactorDottedPathTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4262MakeLikeReactorDottedPathTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4262MakeLikeReactorDottedPathTest() - { - super( "[3.0-alpha-3,4.0.0-alpha-1)" ); + public MavenITmng4262MakeLikeReactorDottedPathTest() { + super("[3.0-alpha-3,4.0.0-alpha-1)"); } - private void clean( Verifier verifier ) - throws Exception - { - verifier.deleteDirectory( "target" ); - verifier.deleteDirectory( "../sub-a/target" ); + private void clean(Verifier verifier) throws Exception { + verifier.deleteDirectory("target"); + verifier.deleteDirectory("../sub-a/target"); } /** @@ -53,23 +46,21 @@ public class MavenITmng4262MakeLikeReactorDottedPathTest * @throws Exception in case of failure */ @Test - public void testitMakeRoot() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4262" ); + public void testitMakeRoot() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4262"); - Verifier verifier = newVerifier( new File( testDir, "parent" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - clean( verifier ); - verifier.addCliArgument( "-pl" ); - verifier.addCliArgument( "." ); - verifier.setLogFileName( "log-root.txt" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(new File(testDir, "parent").getAbsolutePath()); + verifier.setAutoclean(false); + clean(verifier); + verifier.addCliArgument("-pl"); + verifier.addCliArgument("."); + verifier.setLogFileName("log-root.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/touch.txt" ); - verifier.verifyFileNotPresent( "../sub-a/target/touch.txt" ); + verifier.verifyFilePresent("target/touch.txt"); + verifier.verifyFileNotPresent("../sub-a/target/touch.txt"); } /** @@ -78,23 +69,20 @@ public class MavenITmng4262MakeLikeReactorDottedPathTest * @throws Exception in case of failure */ @Test - public void testitMakeModule() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4262" ); + public void testitMakeModule() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4262"); - Verifier verifier = newVerifier( new File( testDir, "parent" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - clean( verifier ); - verifier.addCliArgument( "-pl" ); - verifier.addCliArgument( "../sub-a" ); - verifier.setLogFileName( "log-module.txt" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(new File(testDir, "parent").getAbsolutePath()); + verifier.setAutoclean(false); + clean(verifier); + verifier.addCliArgument("-pl"); + verifier.addCliArgument("../sub-a"); + verifier.setLogFileName("log-module.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFileNotPresent( "target/touch.txt" ); - verifier.verifyFilePresent( "../sub-a/target/touch.txt" ); + verifier.verifyFileNotPresent("target/touch.txt"); + verifier.verifyFilePresent("../sub-a/target/touch.txt"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4269BadReactorResolutionFromOutDirTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4269BadReactorResolutionFromOutDirTest.java index 0ce6c84ce0..6d884d64d9 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4269BadReactorResolutionFromOutDirTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4269BadReactorResolutionFromOutDirTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * * @author Brian Fox */ -public class MavenITmng4269BadReactorResolutionFromOutDirTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4269BadReactorResolutionFromOutDirTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4269BadReactorResolutionFromOutDirTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng4269BadReactorResolutionFromOutDirTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -50,25 +45,22 @@ public class MavenITmng4269BadReactorResolutionFromOutDirTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4269" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4269"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); // NOTE: It's a crucial prerequisite to create the output directory, i.e. the bad choice - new File( testDir, "target/classes" ).mkdirs(); - verifier.deleteArtifacts( "org.apache.maven.its.mng4269" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); + new File(testDir, "target/classes").mkdirs(); + verifier.deleteArtifacts("org.apache.maven.its.mng4269"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); // This should use the previous installation/deployment from the repo, not the invalid output directory - verifier.addCliArgument( "org.apache.maven.its.mng4269:maven-mng4269-plugin:0.1:touch" ); + verifier.addCliArgument("org.apache.maven.its.mng4269:maven-mng4269-plugin:0.1:touch"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/touch.txt" ); + verifier.verifyFilePresent("target/touch.txt"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4270ArtifactHandlersFromPluginDepsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4270ArtifactHandlersFromPluginDepsTest.java index 8f445c7c25..7af19e1c50 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4270ArtifactHandlersFromPluginDepsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4270ArtifactHandlersFromPluginDepsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; import java.io.IOException; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -34,9 +32,7 @@ import org.junit.jupiter.api.Test; * @author John Casey * */ -public class MavenITmng4270ArtifactHandlersFromPluginDepsTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4270ArtifactHandlersFromPluginDepsTest extends AbstractMavenIntegrationTestCase { private static final String GID = "org.apache.maven.its.mng4270"; @@ -46,22 +42,19 @@ public class MavenITmng4270ArtifactHandlersFromPluginDepsTest private static final String BAD_TYPE = "coreit"; - public MavenITmng4270ArtifactHandlersFromPluginDepsTest() - { - super( "(2.2.0,)" ); + public MavenITmng4270ArtifactHandlersFromPluginDepsTest() { + super("(2.2.0,)"); } @Test - public void testProjectPackagingUsage() - throws IOException, VerificationException - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/" + AID ); + public void testProjectPackagingUsage() throws IOException, VerificationException { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/" + AID); - Verifier verifier = newVerifier( testDir.getAbsolutePath(), "remote" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath(), "remote"); - verifier.deleteArtifacts( GID ); + verifier.deleteArtifacts(GID); - verifier.addCliArgument( "install" ); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); @@ -69,13 +62,13 @@ public class MavenITmng4270ArtifactHandlersFromPluginDepsTest // Now, if everything worked, we have .pom and a .jar in the local repo. // IF IT DIDN'T, we have a .pom and a .coreit in the local repo... - String path = verifier.getArtifactPath( GID, AID, VERSION, TYPE ); - assertTrue( path + " should have been installed.", new File( path ).exists() ); + String path = verifier.getArtifactPath(GID, AID, VERSION, TYPE); + assertTrue(path + " should have been installed.", new File(path).exists()); - path = verifier.getArtifactPath( GID, AID, VERSION, "pom" ); - assertTrue( path + " should have been installed.", new File( path ).exists() ); + path = verifier.getArtifactPath(GID, AID, VERSION, "pom"); + assertTrue(path + " should have been installed.", new File(path).exists()); - path = verifier.getArtifactPath( GID, AID, VERSION, BAD_TYPE ); - assertFalse( path + " should NOT have been installed.", new File( path ).exists() ); + path = verifier.getArtifactPath(GID, AID, VERSION, BAD_TYPE); + assertFalse(path + " should NOT have been installed.", new File(path).exists()); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4273RestrictedCoreRealmAccessForPluginTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4273RestrictedCoreRealmAccessForPluginTest.java index f1ec399bc5..f2632bab1a 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4273RestrictedCoreRealmAccessForPluginTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4273RestrictedCoreRealmAccessForPluginTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4273RestrictedCoreRealmAccessForPluginTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4273RestrictedCoreRealmAccessForPluginTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4273RestrictedCoreRealmAccessForPluginTest() - { - super( "[2.0.6,)" ); + public MavenITmng4273RestrictedCoreRealmAccessForPluginTest() { + super("[2.0.6,)"); } /** @@ -50,31 +45,25 @@ public class MavenITmng4273RestrictedCoreRealmAccessForPluginTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4273" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4273"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/class.properties" ); + Properties props = verifier.loadProperties("target/class.properties"); - assertNull( props.getProperty( "org.codehaus.plexus.util.FileUtils$FilterWrapper" ) ); + assertNull(props.getProperty("org.codehaus.plexus.util.FileUtils$FilterWrapper")); - try - { + try { // some IBM JRE's ship with Xerces (xml.jar) so a plugin can load this class from the bootstrap loader - ClassLoader.getSystemClassLoader().loadClass( "org.apache.xerces.util.ParserConfigurationSettings" ); - } - catch ( ClassNotFoundException e ) - { + ClassLoader.getSystemClassLoader().loadClass("org.apache.xerces.util.ParserConfigurationSettings"); + } catch (ClassNotFoundException e) { // not provided by JRE, and must not be provided by Maven's core realm either - assertNull( props.getProperty( "org.apache.xerces.util.ParserConfigurationSettings" ) ); + assertNull(props.getProperty("org.apache.xerces.util.ParserConfigurationSettings")); } } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4274PluginRealmArtifactsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4274PluginRealmArtifactsTest.java index 09e3e032ee..24336f7c64 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4274PluginRealmArtifactsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4274PluginRealmArtifactsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4274PluginRealmArtifactsTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4274PluginRealmArtifactsTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4274PluginRealmArtifactsTest() - { - super( "[3.0-alpha-3,)" ); + public MavenITmng4274PluginRealmArtifactsTest() { + super("[3.0-alpha-3,)"); } /** @@ -49,27 +44,24 @@ public class MavenITmng4274PluginRealmArtifactsTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4274" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4274"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifact( "org.apache.maven", "maven-core", "2.0.4274", "jar" ); - verifier.deleteArtifact( "org.apache.maven", "maven-core", "2.0.4274", "pom" ); - verifier.deleteArtifact( "org.codehaus.plexus", "plexus-utils", "1.1.4274", "jar" ); - verifier.deleteArtifact( "org.codehaus.plexus", "plexus-utils", "1.1.4274", "pom" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifact("org.apache.maven", "maven-core", "2.0.4274", "jar"); + verifier.deleteArtifact("org.apache.maven", "maven-core", "2.0.4274", "pom"); + verifier.deleteArtifact("org.codehaus.plexus", "plexus-utils", "1.1.4274", "jar"); + verifier.deleteArtifact("org.codehaus.plexus", "plexus-utils", "1.1.4274", "pom"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/class.properties" ); - assertNotNull( props.getProperty( "org.apache.maven.its.mng4274.CoreIt" ) ); + Properties props = verifier.loadProperties("target/class.properties"); + assertNotNull(props.getProperty("org.apache.maven.its.mng4274.CoreIt")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4275RelocationWarningTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4275RelocationWarningTest.java index 27511de5de..185ca523da 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4275RelocationWarningTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4275RelocationWarningTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author John Casey */ -public class MavenITmng4275RelocationWarningTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4275RelocationWarningTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4275RelocationWarningTest() - { - super( "[2.0,2.0.9),[2.2.1,3.0-alpha-1),[3.0-alpha-3,)" ); + public MavenITmng4275RelocationWarningTest() { + super("[2.0,2.0.9),[2.2.1,3.0-alpha-1),[3.0-alpha-3,)"); } /** @@ -47,46 +42,38 @@ public class MavenITmng4275RelocationWarningTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4275" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4275"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4275" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4275"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List lines = verifier.loadFile( new File( testDir, verifier.getLogFileName() ), false ); + List lines = verifier.loadFile(new File(testDir, verifier.getLogFileName()), false); boolean foundWarning = false; - for ( String line : lines ) - { - if ( foundWarning ) - { - assertTrue( "Relocation target should have been logged right after warning.", line.contains( - "This artifact has been relocated to org.apache.maven.its.mng4275:relocated:1" ) ); + for (String line : lines) { + if (foundWarning) { + assertTrue( + "Relocation target should have been logged right after warning.", + line.contains("This artifact has been relocated to org.apache.maven.its.mng4275:relocated:1")); break; - } - else if ( line.startsWith( "[WARNING] While downloading org.apache.maven.its.mng4275:relocation:1" ) ) - { + } else if (line.startsWith("[WARNING] While downloading org.apache.maven.its.mng4275:relocation:1")) { foundWarning = true; - } - else if ( line.matches( - "\\[WARNING\\].* org.apache.maven.its.mng4275:relocation:jar:1 .* org.apache.maven.its" - + ".mng4275:relocated:jar:1.*" ) ) - { + } else if (line.matches( + "\\[WARNING\\].* org.apache.maven.its.mng4275:relocation:jar:1 .* org.apache.maven.its" + + ".mng4275:relocated:jar:1.*")) { foundWarning = true; break; } } - assertTrue( "Relocation warning should haven been logged.", foundWarning ); + assertTrue("Relocation warning should haven been logged.", foundWarning); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4276WrongTransitivePlexusUtilsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4276WrongTransitivePlexusUtilsTest.java index 85d9a19d56..9f8abe45da 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4276WrongTransitivePlexusUtilsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4276WrongTransitivePlexusUtilsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4276WrongTransitivePlexusUtilsTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4276WrongTransitivePlexusUtilsTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4276WrongTransitivePlexusUtilsTest() - { - super( "[3.0-alpha-3,)" ); + public MavenITmng4276WrongTransitivePlexusUtilsTest() { + super("[3.0-alpha-3,)"); } /** @@ -48,26 +43,23 @@ public class MavenITmng4276WrongTransitivePlexusUtilsTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4276" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4276"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4276" ); - verifier.deleteArtifact( "org.codehaus.plexus", "plexus-utils", "1.1.4276", "jar" ); - verifier.deleteArtifact( "org.codehaus.plexus", "plexus-utils", "1.1.4276", "pom" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4276"); + verifier.deleteArtifact("org.codehaus.plexus", "plexus-utils", "1.1.4276", "jar"); + verifier.deleteArtifact("org.codehaus.plexus", "plexus-utils", "1.1.4276", "pom"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/class.properties" ); - assertNotNull( props.getProperty( "org.apache.maven.its.mng4276.CoreIt" ) ); + Properties props = verifier.loadProperties("target/class.properties"); + assertNotNull(props.getProperty("org.apache.maven.its.mng4276.CoreIt")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4281PreferLocalSnapshotTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4281PreferLocalSnapshotTest.java index 10dd775799..d9864f0451 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4281PreferLocalSnapshotTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4281PreferLocalSnapshotTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4281PreferLocalSnapshotTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4281PreferLocalSnapshotTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4281PreferLocalSnapshotTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng4281PreferLocalSnapshotTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -47,40 +42,36 @@ public class MavenITmng4281PreferLocalSnapshotTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { + public void testit() throws Exception { // NOTE: It's crucial to build the two projects in isolation to disable reactor resolution - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4281" ); + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4281"); - Verifier verifier = newVerifier( new File( testDir, "dependency" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4281" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(new File(testDir, "dependency").getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng4281"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng4281", "dependency", "0.1-SNAPSHOT", "jar" ); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng4281", "dependency", "0.1-SNAPSHOT", "pom" ); + verifier.verifyArtifactPresent("org.apache.maven.its.mng4281", "dependency", "0.1-SNAPSHOT", "jar"); + verifier.verifyArtifactPresent("org.apache.maven.its.mng4281", "dependency", "0.1-SNAPSHOT", "pom"); - verifier = newVerifier( new File( testDir, "project" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "validate" ); + verifier = newVerifier(new File(testDir, "project").getAbsolutePath()); + verifier.setAutoclean(false); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties checksums = verifier.loadProperties( "target/checksum.properties" ); - assertChecksum( "7c564b3fbeda6db61b62c35e58a8ef672e712400", checksums ); + Properties checksums = verifier.loadProperties("target/checksum.properties"); + assertChecksum("7c564b3fbeda6db61b62c35e58a8ef672e712400", checksums); } - private void assertChecksum( String checksum, Properties checksums ) - { - String actual = checksums.getProperty( "dependency-0.1-SNAPSHOT.jar" ); - assertEquals( checksum, actual.toLowerCase( java.util.Locale.ENGLISH ) ); + private void assertChecksum(String checksum, Properties checksums) { + String actual = checksums.getProperty("dependency-0.1-SNAPSHOT.jar"); + assertEquals(checksum, actual.toLowerCase(java.util.Locale.ENGLISH)); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4283ParentPomPackagingTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4283ParentPomPackagingTest.java index 96b5ff769e..d1a4a2b0cf 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4283ParentPomPackagingTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4283ParentPomPackagingTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4283ParentPomPackagingTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4283ParentPomPackagingTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4283ParentPomPackagingTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng4283ParentPomPackagingTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -47,24 +42,18 @@ public class MavenITmng4283ParentPomPackagingTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4283" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4283"); - Verifier verifier = newVerifier( new File( testDir, "sub" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - try - { - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(new File(testDir, "sub").getAbsolutePath()); + verifier.setAutoclean(false); + try { + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - fail( "Invalid packaging of parent POM did not fail the build." ); - } - catch ( VerificationException e ) - { + fail("Invalid packaging of parent POM did not fail the build."); + } catch (VerificationException e) { // expected } } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4291MojoRequiresOnlineModeTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4291MojoRequiresOnlineModeTest.java index 8e3c466fc3..775105d2ed 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4291MojoRequiresOnlineModeTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4291MojoRequiresOnlineModeTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4291MojoRequiresOnlineModeTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4291MojoRequiresOnlineModeTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4291MojoRequiresOnlineModeTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng4291MojoRequiresOnlineModeTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -48,25 +43,20 @@ public class MavenITmng4291MojoRequiresOnlineModeTest * @throws Exception in case of failure */ @Test - public void testitDirectInvocation() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4291" ); + public void testitDirectInvocation() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4291"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.setLogFileName( "log-direct.txt" ); - verifier.addCliArgument( "--offline" ); - try - { - verifier.addCliArgument( "org.apache.maven.its.plugins:maven-it-plugin-online:2.1-SNAPSHOT:touch" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.setLogFileName("log-direct.txt"); + verifier.addCliArgument("--offline"); + try { + verifier.addCliArgument("org.apache.maven.its.plugins:maven-it-plugin-online:2.1-SNAPSHOT:touch"); verifier.execute(); verifier.verifyErrorFreeLog(); - fail( "Request to execute online mojo during offline mode did not fail the build." ); - } - catch ( VerificationException e ) - { + fail("Request to execute online mojo during offline mode did not fail the build."); + } catch (VerificationException e) { // expected } } @@ -78,21 +68,18 @@ public class MavenITmng4291MojoRequiresOnlineModeTest * @throws Exception in case of failure */ @Test - public void testitLifecycleInvocation() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4291" ); + public void testitLifecycleInvocation() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4291"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.setLogFileName( "log-lifecycle.txt" ); - verifier.addCliArgument( "--offline" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.setLogFileName("log-lifecycle.txt"); + verifier.addCliArgument("--offline"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFileNotPresent( "target/touch.txt" ); + verifier.verifyFileNotPresent("target/touch.txt"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4292EnumTypeMojoParametersTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4292EnumTypeMojoParametersTest.java index 0a41c748cd..a4c8f56b49 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4292EnumTypeMojoParametersTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4292EnumTypeMojoParametersTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4292EnumTypeMojoParametersTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4292EnumTypeMojoParametersTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4292EnumTypeMojoParametersTest() - { - super( "[3.0-alpha-3,)" ); + public MavenITmng4292EnumTypeMojoParametersTest() { + super("[3.0-alpha-3,)"); } /** @@ -47,21 +42,18 @@ public class MavenITmng4292EnumTypeMojoParametersTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4292" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4292"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/config.properties" ); - assertEquals( "HALF_EVEN", props.getProperty( "listParam.0" ) ); - assertEquals( "RUNNABLE", props.getProperty( "listParam.1" ) ); + Properties props = verifier.loadProperties("target/config.properties"); + assertEquals("HALF_EVEN", props.getProperty("listParam.0")); + assertEquals("RUNNABLE", props.getProperty("listParam.1")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4293RequiresCompilePlusRuntimeScopeTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4293RequiresCompilePlusRuntimeScopeTest.java index 876b9e3c51..00b98b49f3 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4293RequiresCompilePlusRuntimeScopeTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4293RequiresCompilePlusRuntimeScopeTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,17 +30,14 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4293RequiresCompilePlusRuntimeScopeTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4293RequiresCompilePlusRuntimeScopeTest extends AbstractMavenIntegrationTestCase { /* * NOTE: Class path ordering is another issue (MNG-1412), so we merely check set containment here. */ - public MavenITmng4293RequiresCompilePlusRuntimeScopeTest() - { - super( "[3.0-alpha-3,)" ); + public MavenITmng4293RequiresCompilePlusRuntimeScopeTest() { + super("[3.0-alpha-3,)"); } /** @@ -51,33 +46,30 @@ public class MavenITmng4293RequiresCompilePlusRuntimeScopeTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4293" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4293"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4293" ); - verifier.filterFile( "pom-template.xml", "pom.xml", "UTF-8" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4293"); + verifier.filterFile("pom-template.xml", "pom.xml", "UTF-8"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List compileClassPath = verifier.loadLines( "target/compile-cp.txt", "UTF-8" ); - assertTrue( compileClassPath.toString(), compileClassPath.contains( "system-0.1.jar" ) ); - assertTrue( compileClassPath.toString(), compileClassPath.contains( "provided-0.1.jar" ) ); - assertTrue( compileClassPath.toString(), compileClassPath.contains( "compile-0.1.jar" ) ); - assertFalse( compileClassPath.toString(), compileClassPath.contains( "test-0.1.jar" ) ); + List compileClassPath = verifier.loadLines("target/compile-cp.txt", "UTF-8"); + assertTrue(compileClassPath.toString(), compileClassPath.contains("system-0.1.jar")); + assertTrue(compileClassPath.toString(), compileClassPath.contains("provided-0.1.jar")); + assertTrue(compileClassPath.toString(), compileClassPath.contains("compile-0.1.jar")); + assertFalse(compileClassPath.toString(), compileClassPath.contains("test-0.1.jar")); - List runtimeClassPath = verifier.loadLines( "target/runtime-cp.txt", "UTF-8" ); - assertTrue( runtimeClassPath.toString(), runtimeClassPath.contains( "compile-0.1.jar" ) ); - assertTrue( runtimeClassPath.toString(), runtimeClassPath.contains( "runtime-0.1.jar" ) ); - assertFalse( runtimeClassPath.toString(), runtimeClassPath.contains( "test-0.1.jar" ) ); + List runtimeClassPath = verifier.loadLines("target/runtime-cp.txt", "UTF-8"); + assertTrue(runtimeClassPath.toString(), runtimeClassPath.contains("compile-0.1.jar")); + assertTrue(runtimeClassPath.toString(), runtimeClassPath.contains("runtime-0.1.jar")); + assertFalse(runtimeClassPath.toString(), runtimeClassPath.contains("test-0.1.jar")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4304ProjectDependencyArtifactsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4304ProjectDependencyArtifactsTest.java index 4c8d6f7484..120b775a61 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4304ProjectDependencyArtifactsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4304ProjectDependencyArtifactsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4304ProjectDependencyArtifactsTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4304ProjectDependencyArtifactsTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4304ProjectDependencyArtifactsTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng4304ProjectDependencyArtifactsTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -48,21 +43,18 @@ public class MavenITmng4304ProjectDependencyArtifactsTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4304" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4304"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List artifacts = verifier.loadLines( "target/artifacts.txt", "UTF-8" ); - assertTrue( artifacts.toString(), artifacts.contains( "org.apache.maven.its:maven-core-it-support:jar:1.4" ) ); - assertEquals( 1, artifacts.size() ); + List artifacts = verifier.loadLines("target/artifacts.txt", "UTF-8"); + assertTrue(artifacts.toString(), artifacts.contains("org.apache.maven.its:maven-core-it-support:jar:1.4")); + assertEquals(1, artifacts.size()); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4305LocalRepoBasedirTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4305LocalRepoBasedirTest.java index 819bdde1f7..64e08c9427 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4305LocalRepoBasedirTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4305LocalRepoBasedirTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4305LocalRepoBasedirTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4305LocalRepoBasedirTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4305LocalRepoBasedirTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng4305LocalRepoBasedirTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -48,23 +43,20 @@ public class MavenITmng4305LocalRepoBasedirTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4305" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4305"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/basedir.properties" ); + Properties props = verifier.loadProperties("target/basedir.properties"); // NOTE: This deliberately compares the paths on the String level, not via File.equals() - assertEquals( new File( verifier.getLocalRepository() ).getAbsolutePath(), - props.getProperty( "localRepositoryBasedir" ) ); + assertEquals( + new File(verifier.getLocalRepository()).getAbsolutePath(), props.getProperty("localRepositoryBasedir")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4309StrictChecksumValidationForMetadataTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4309StrictChecksumValidationForMetadataTest.java index 32bcc4b00a..ef62c11d5a 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4309StrictChecksumValidationForMetadataTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4309StrictChecksumValidationForMetadataTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; import org.apache.maven.shared.utils.io.FileUtils; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4309StrictChecksumValidationForMetadataTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4309StrictChecksumValidationForMetadataTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4309StrictChecksumValidationForMetadataTest() - { - super( "[3.0-beta-3,)" ); + public MavenITmng4309StrictChecksumValidationForMetadataTest() { + super("[3.0-beta-3,)"); } /** @@ -49,28 +44,22 @@ public class MavenITmng4309StrictChecksumValidationForMetadataTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4309" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4309"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4309" ); - FileUtils.copyDirectoryStructure( new File( testDir, "repo" ), new File( testDir, "target/repo" ) ); - verifier.addCliArgument( "--strict-checksums" ); - try - { - verifier.addCliArgument( "validate" ); - verifier.execute(); - verifier.verifyErrorFreeLog(); - fail( "Checksum mismatch for metadata did not fail the build despite strict mode" ); - } - catch ( VerificationException e ) - { + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4309"); + FileUtils.copyDirectoryStructure(new File(testDir, "repo"), new File(testDir, "target/repo")); + verifier.addCliArgument("--strict-checksums"); + try { + verifier.addCliArgument("validate"); + verifier.execute(); + verifier.verifyErrorFreeLog(); + fail("Checksum mismatch for metadata did not fail the build despite strict mode"); + } catch (VerificationException e) { // expected } } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4312TypeAwarePluginParameterExpressionInjectionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4312TypeAwarePluginParameterExpressionInjectionTest.java index 8481dd5bc8..cdc0c7c41d 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4312TypeAwarePluginParameterExpressionInjectionTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4312TypeAwarePluginParameterExpressionInjectionTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4312TypeAwarePluginParameterExpressionInjectionTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4312TypeAwarePluginParameterExpressionInjectionTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4312TypeAwarePluginParameterExpressionInjectionTest() - { - super( "[3.0-alpha-3,)" ); + public MavenITmng4312TypeAwarePluginParameterExpressionInjectionTest() { + super("[3.0-alpha-3,)"); } /** @@ -49,23 +44,20 @@ public class MavenITmng4312TypeAwarePluginParameterExpressionInjectionTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4312" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4312"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/config.properties" ); + Properties props = verifier.loadProperties("target/config.properties"); - assertEquals( "", props.getProperty( "stringParam", "" ) ); - assertEquals( "", props.getProperty( "aliasParam", "" ) ); - assertEquals( "maven-core-it", props.getProperty( "defaultParam" ) ); + assertEquals("", props.getProperty("stringParam", "")); + assertEquals("", props.getProperty("aliasParam", "")); + assertEquals("maven-core-it", props.getProperty("defaultParam")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4314DirectInvocationOfAggregatorTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4314DirectInvocationOfAggregatorTest.java index 8a79e606ea..51d5989127 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4314DirectInvocationOfAggregatorTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4314DirectInvocationOfAggregatorTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; -import java.util.Arrays; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +29,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4314DirectInvocationOfAggregatorTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4314DirectInvocationOfAggregatorTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4314DirectInvocationOfAggregatorTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng4314DirectInvocationOfAggregatorTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -47,25 +41,22 @@ public class MavenITmng4314DirectInvocationOfAggregatorTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4314" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4314"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteDirectory( "consumer/target" ); - verifier.deleteDirectory( "dependency/target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4314" ); - verifier.addCliArguments( "validate", - "org.apache.maven.its.plugins:maven-it-plugin-all:2.1-SNAPSHOT:aggregator-dependencies" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteDirectory("consumer/target"); + verifier.deleteDirectory("dependency/target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4314"); + verifier.addCliArguments( + "validate", "org.apache.maven.its.plugins:maven-it-plugin-all:2.1-SNAPSHOT:aggregator-dependencies"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/touch.txt" ); - verifier.verifyFileNotPresent( "consumer/target/touch.txt" ); - verifier.verifyFileNotPresent( "dependency/target/touch.txt" ); + verifier.verifyFilePresent("target/touch.txt"); + verifier.verifyFileNotPresent("consumer/target/touch.txt"); + verifier.verifyFileNotPresent("dependency/target/touch.txt"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4317PluginVersionResolutionFromMultiReposTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4317PluginVersionResolutionFromMultiReposTest.java index 3c0f7ab558..1cee672481 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4317PluginVersionResolutionFromMultiReposTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4317PluginVersionResolutionFromMultiReposTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4317PluginVersionResolutionFromMultiReposTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4317PluginVersionResolutionFromMultiReposTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4317PluginVersionResolutionFromMultiReposTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng4317PluginVersionResolutionFromMultiReposTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -47,23 +42,20 @@ public class MavenITmng4317PluginVersionResolutionFromMultiReposTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4317" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4317"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4317" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "org.apache.maven.its.mng4317:maven-mng4317-plugin:touch" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4317"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("org.apache.maven.its.mng4317:maven-mng4317-plugin:touch"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/touch.txt" ); + verifier.verifyFilePresent("target/touch.txt"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4318ProjectExecutionRootTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4318ProjectExecutionRootTest.java index 96d86c7ca1..d74a86a30f 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4318ProjectExecutionRootTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4318ProjectExecutionRootTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4318ProjectExecutionRootTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4318ProjectExecutionRootTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4318ProjectExecutionRootTest() - { - super( "[2.0.4,3.0-alpha-1),[3.0.3,)" ); + public MavenITmng4318ProjectExecutionRootTest() { + super("[2.0.4,3.0-alpha-1),[3.0.3,)"); } /** @@ -48,38 +43,35 @@ public class MavenITmng4318ProjectExecutionRootTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4318" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4318"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteDirectory( "sub-1/target" ); - verifier.deleteDirectory( "sub-2/target" ); - verifier.deleteDirectory( "sub-2/sub-3/target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteDirectory("sub-1/target"); + verifier.deleteDirectory("sub-2/target"); + verifier.deleteDirectory("sub-2/sub-3/target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); Properties props; - props = verifier.loadProperties( "target/project.properties" ); - assertEquals( "true", props.getProperty( "project.executionRoot" ) ); + props = verifier.loadProperties("target/project.properties"); + assertEquals("true", props.getProperty("project.executionRoot")); - props = verifier.loadProperties( "sub-1/target/project.properties" ); - assertEquals( "false", props.getProperty( "project.executionRoot" ) ); - assertEquals( "true", props.getProperty( "project.parent.executionRoot" ) ); + props = verifier.loadProperties("sub-1/target/project.properties"); + assertEquals("false", props.getProperty("project.executionRoot")); + assertEquals("true", props.getProperty("project.parent.executionRoot")); - props = verifier.loadProperties( "sub-2/target/project.properties" ); - assertEquals( "false", props.getProperty( "project.executionRoot" ) ); - assertEquals( "true", props.getProperty( "project.parent.executionRoot" ) ); + props = verifier.loadProperties("sub-2/target/project.properties"); + assertEquals("false", props.getProperty("project.executionRoot")); + assertEquals("true", props.getProperty("project.parent.executionRoot")); - props = verifier.loadProperties( "sub-2/sub-3/target/project.properties" ); - assertEquals( "false", props.getProperty( "project.executionRoot" ) ); - assertEquals( "false", props.getProperty( "project.parent.executionRoot" ) ); - assertEquals( "true", props.getProperty( "project.parent.parent.executionRoot" ) ); + props = verifier.loadProperties("sub-2/sub-3/target/project.properties"); + assertEquals("false", props.getProperty("project.executionRoot")); + assertEquals("false", props.getProperty("project.parent.executionRoot")); + assertEquals("true", props.getProperty("project.parent.parent.executionRoot")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4319PluginExecutionGoalInterpolationTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4319PluginExecutionGoalInterpolationTest.java index 7999446794..18fd0ff10c 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4319PluginExecutionGoalInterpolationTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4319PluginExecutionGoalInterpolationTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4319PluginExecutionGoalInterpolationTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4319PluginExecutionGoalInterpolationTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4319PluginExecutionGoalInterpolationTest() - { - super( "[2.0,2.1.0),[2.2.2,)" ); + public MavenITmng4319PluginExecutionGoalInterpolationTest() { + super("[2.0,2.1.0),[2.2.2,)"); } /** @@ -46,19 +41,16 @@ public class MavenITmng4319PluginExecutionGoalInterpolationTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4319" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4319"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/touch.txt" ); + verifier.verifyFilePresent("target/touch.txt"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4320AggregatorAndDependenciesTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4320AggregatorAndDependenciesTest.java index 8c8badbed4..31f53fad72 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4320AggregatorAndDependenciesTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4320AggregatorAndDependenciesTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4320AggregatorAndDependenciesTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4320AggregatorAndDependenciesTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4320AggregatorAndDependenciesTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng4320AggregatorAndDependenciesTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -48,33 +43,30 @@ public class MavenITmng4320AggregatorAndDependenciesTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4320" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4320"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4320" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "org.apache.maven.its.plugins:maven-it-plugin-dependency-resolution:aggregate-test" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4320"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("org.apache.maven.its.plugins:maven-it-plugin-dependency-resolution:aggregate-test"); verifier.execute(); verifier.verifyErrorFreeLog(); List classpath; - classpath = verifier.loadLines( "target/sub-1.txt", "UTF-8" ); - assertTrue( classpath.toString(), classpath.contains( "a-0.1.jar" ) ); + classpath = verifier.loadLines("target/sub-1.txt", "UTF-8"); + assertTrue(classpath.toString(), classpath.contains("a-0.1.jar")); - classpath = verifier.loadLines( "target/sub-2.txt", "UTF-8" ); - assertTrue( classpath.toString(), classpath.contains( "b-0.2.jar" ) ); + classpath = verifier.loadLines("target/sub-2.txt", "UTF-8"); + assertTrue(classpath.toString(), classpath.contains("b-0.2.jar")); - classpath = verifier.loadLines( "target/aggregator.txt", "UTF-8" ); - assertFalse( classpath.toString(), classpath.contains( "a-0.1.jar" ) ); - assertFalse( classpath.toString(), classpath.contains( "b-0.2.jar" ) ); + classpath = verifier.loadLines("target/aggregator.txt", "UTF-8"); + assertFalse(classpath.toString(), classpath.contains("a-0.1.jar")); + assertFalse(classpath.toString(), classpath.contains("b-0.2.jar")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4321CliUsesPluginMgmtConfigTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4321CliUsesPluginMgmtConfigTest.java index 327d9a126b..55093aa0ba 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4321CliUsesPluginMgmtConfigTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4321CliUsesPluginMgmtConfigTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4321CliUsesPluginMgmtConfigTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4321CliUsesPluginMgmtConfigTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4321CliUsesPluginMgmtConfigTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng4321CliUsesPluginMgmtConfigTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -48,19 +43,16 @@ public class MavenITmng4321CliUsesPluginMgmtConfigTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4321" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4321"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "org.apache.maven.its.plugins:maven-it-plugin-log-file:2.1-SNAPSHOT:reset" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("org.apache.maven.its.plugins:maven-it-plugin-log-file:2.1-SNAPSHOT:reset"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/passed.log" ); + verifier.verifyFilePresent("target/passed.log"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4326LocalSnapshotSuppressesRemoteCheckTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4326LocalSnapshotSuppressesRemoteCheckTest.java index b706e81472..cf69f32b0c 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4326LocalSnapshotSuppressesRemoteCheckTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4326LocalSnapshotSuppressesRemoteCheckTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,9 +16,7 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -34,6 +30,8 @@ import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentLinkedDeque; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.eclipse.jetty.server.Handler; import org.eclipse.jetty.server.NetworkConnector; import org.eclipse.jetty.server.Request; @@ -46,13 +44,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4326LocalSnapshotSuppressesRemoteCheckTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4326LocalSnapshotSuppressesRemoteCheckTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4326LocalSnapshotSuppressesRemoteCheckTest() - { - super( "[3.0-beta-1,)" ); + public MavenITmng4326LocalSnapshotSuppressesRemoteCheckTest() { + super("[3.0-beta-1,)"); } /** @@ -62,133 +57,118 @@ public class MavenITmng4326LocalSnapshotSuppressesRemoteCheckTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4326" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4326"); // setup: install a local snapshot - Verifier verifier = newVerifier( new File( testDir, "dependency" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4326" ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(new File(testDir, "dependency").getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng4326"); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); final Deque uris = new ConcurrentLinkedDeque<>(); - Handler repoHandler = new AbstractHandler() - { + Handler repoHandler = new AbstractHandler() { @Override - public void handle( String target, Request baseRequest, HttpServletRequest request, - HttpServletResponse response ) - throws IOException - { + public void handle( + String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) + throws IOException { PrintWriter writer = response.getWriter(); String uri = request.getRequestURI(); - if ( uri.startsWith( "/repo/org/apache/maven/its/mng4326" ) && !uri.endsWith( ".md5" ) && !uri.endsWith( - ".sha1" ) ) - { - uris.add( uri.substring( 34 ) ); + if (uri.startsWith("/repo/org/apache/maven/its/mng4326") + && !uri.endsWith(".md5") + && !uri.endsWith(".sha1")) { + uris.add(uri.substring(34)); } - if ( uri.endsWith( "dep/0.1-SNAPSHOT/maven-metadata.xml" ) ) - { - java.text.DateFormat fmt = new java.text.SimpleDateFormat( "yyyyMMddHHmmss" ); - fmt.setTimeZone( java.util.TimeZone.getTimeZone( "UTC" ) ); - String now = fmt.format( new Date( System.currentTimeMillis() + 3000 ) ); + if (uri.endsWith("dep/0.1-SNAPSHOT/maven-metadata.xml")) { + java.text.DateFormat fmt = new java.text.SimpleDateFormat("yyyyMMddHHmmss"); + fmt.setTimeZone(java.util.TimeZone.getTimeZone("UTC")); + String now = fmt.format(new Date(System.currentTimeMillis() + 3000)); - response.setStatus( HttpServletResponse.SC_OK ); - writer.println( "" ); - writer.println( " org.apache.maven.its.mng4326" ); - writer.println( " dep" ); - writer.println( " 0.1-SNAPSHOT" ); - writer.println( " " ); - writer.println( " " ); - writer.println( " 20100329.235556" ); - writer.println( " 1" ); - writer.println( " " ); - writer.println( " " + now + "" ); - writer.println( " " ); - writer.println( "" ); - } - else if ( uri.endsWith( ".pom" ) ) - { - response.setStatus( HttpServletResponse.SC_OK ); - writer.println( "" ); - writer.println( " 4.0.0" ); - writer.println( " org.apache.maven.its.mng4326" ); - writer.println( " dep" ); - writer.println( " 0.1-SNAPSHOT" ); - writer.println( "" ); - } - else if ( uri.endsWith( ".jar" ) ) - { - response.setStatus( HttpServletResponse.SC_OK ); - writer.println( "empty" ); - } - else - { - response.setStatus( HttpServletResponse.SC_NOT_FOUND ); + response.setStatus(HttpServletResponse.SC_OK); + writer.println(""); + writer.println(" org.apache.maven.its.mng4326"); + writer.println(" dep"); + writer.println(" 0.1-SNAPSHOT"); + writer.println(" "); + writer.println(" "); + writer.println(" 20100329.235556"); + writer.println(" 1"); + writer.println(" "); + writer.println(" " + now + ""); + writer.println(" "); + writer.println(""); + } else if (uri.endsWith(".pom")) { + response.setStatus(HttpServletResponse.SC_OK); + writer.println(""); + writer.println(" 4.0.0"); + writer.println(" org.apache.maven.its.mng4326"); + writer.println(" dep"); + writer.println(" 0.1-SNAPSHOT"); + writer.println(""); + } else if (uri.endsWith(".jar")) { + response.setStatus(HttpServletResponse.SC_OK); + writer.println("empty"); + } else { + response.setStatus(HttpServletResponse.SC_NOT_FOUND); } - ( (Request) request ).setHandled( true ); + ((Request) request).setHandled(true); } }; - Server server = new Server( 0 ); - server.setHandler( repoHandler ); + Server server = new Server(0); + server.setHandler(repoHandler); - try - { + try { server.start(); - if ( server.isFailed() ) - { - fail( "Couldn't bind the server socket to a free port!" ); + if (server.isFailed()) { + fail("Couldn't bind the server socket to a free port!"); } - int port = ( (NetworkConnector) server.getConnectors()[0] ).getLocalPort(); - System.out.println( "Bound server socket to the port " + port ); + int port = ((NetworkConnector) server.getConnectors()[0]).getLocalPort(); + System.out.println("Bound server socket to the port " + port); // test 1: resolve snapshot, just built local copy should suppress daily remote update check - verifier = newVerifier( new File( testDir, "test" ).getAbsolutePath() ); - verifier.setAutoclean( false ); + verifier = newVerifier(new File(testDir, "test").getAbsolutePath()); + verifier.setAutoclean(false); Map filterProps = verifier.newDefaultFilterMap(); - filterProps.put( "@port@", Integer.toString( port ) ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.setLogFileName( "log-daily.txt" ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + filterProps.put("@port@", Integer.toString(port)); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8", filterProps); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.setLogFileName("log-daily.txt"); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List cp = verifier.loadLines( "target/classpath.txt", "UTF-8" ); - assertTrue( cp.toString(), cp.contains( "dep-0.1-SNAPSHOT.jar" ) ); + List cp = verifier.loadLines("target/classpath.txt", "UTF-8"); + assertTrue(cp.toString(), cp.contains("dep-0.1-SNAPSHOT.jar")); - assertFalse( uris.toString(), uris.contains( "/dep/0.1-SNAPSHOT/maven-metadata.xml" ) ); - assertFalse( uris.toString(), uris.contains( "/dep/0.1-SNAPSHOT/dep-0.1-20100329.235556-1.jar" ) ); + assertFalse(uris.toString(), uris.contains("/dep/0.1-SNAPSHOT/maven-metadata.xml")); + assertFalse(uris.toString(), uris.contains("/dep/0.1-SNAPSHOT/dep-0.1-20100329.235556-1.jar")); uris.clear(); // test 2: force snapshot updates, remote metadata and artifacts should be fetched - verifier.addCliArgument( "-U" ); - verifier.setLogFileName( "log-force.txt" ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + verifier.addCliArgument("-U"); + verifier.setLogFileName("log-force.txt"); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - cp = verifier.loadLines( "target/classpath.txt", "UTF-8" ); - assertTrue( cp.toString(), cp.contains( "dep-0.1-SNAPSHOT.jar" ) ); + cp = verifier.loadLines("target/classpath.txt", "UTF-8"); + assertTrue(cp.toString(), cp.contains("dep-0.1-SNAPSHOT.jar")); - assertTrue( uris.toString(), uris.contains( "/dep/0.1-SNAPSHOT/maven-metadata.xml" ) ); - assertTrue( uris.toString(), uris.contains( "/dep/0.1-SNAPSHOT/dep-0.1-20100329.235556-1.jar" ) ); - } - finally - { + assertTrue(uris.toString(), uris.contains("/dep/0.1-SNAPSHOT/maven-metadata.xml")); + assertTrue(uris.toString(), uris.contains("/dep/0.1-SNAPSHOT/dep-0.1-20100329.235556-1.jar")); + } finally { server.stop(); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4327ExcludeForkingMojoFromForkedLifecycleTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4327ExcludeForkingMojoFromForkedLifecycleTest.java index 5e28bf6f64..560f124f2d 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4327ExcludeForkingMojoFromForkedLifecycleTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4327ExcludeForkingMojoFromForkedLifecycleTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4327ExcludeForkingMojoFromForkedLifecycleTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4327ExcludeForkingMojoFromForkedLifecycleTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4327ExcludeForkingMojoFromForkedLifecycleTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng4327ExcludeForkingMojoFromForkedLifecycleTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -48,21 +43,18 @@ public class MavenITmng4327ExcludeForkingMojoFromForkedLifecycleTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4327" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4327"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "generate-sources" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("generate-sources"); verifier.execute(); verifier.verifyErrorFreeLog(); - List log = verifier.loadLines( "target/fork-lifecycle.txt", "UTF-8" ); - assertEquals( 1, log.size() ); - assertTrue( log.toString(), log.contains( "fork-lifecycle.txt" ) ); + List log = verifier.loadLines("target/fork-lifecycle.txt", "UTF-8"); + assertEquals(1, log.size()); + assertTrue(log.toString(), log.contains("fork-lifecycle.txt")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4328PrimitiveMojoParameterConfigurationTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4328PrimitiveMojoParameterConfigurationTest.java index 9dbaa78176..17b98af6d6 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4328PrimitiveMojoParameterConfigurationTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4328PrimitiveMojoParameterConfigurationTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4328PrimitiveMojoParameterConfigurationTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4328PrimitiveMojoParameterConfigurationTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4328PrimitiveMojoParameterConfigurationTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng4328PrimitiveMojoParameterConfigurationTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -49,26 +44,23 @@ public class MavenITmng4328PrimitiveMojoParameterConfigurationTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4328" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4328"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "--offline" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("--offline"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); Properties props; - props = verifier.loadProperties( "target/config1.properties" ); - assertEquals( "true", props.getProperty( "primitiveBooleanParam" ) ); + props = verifier.loadProperties("target/config1.properties"); + assertEquals("true", props.getProperty("primitiveBooleanParam")); - props = verifier.loadProperties( "target/config2.properties" ); - assertEquals( "true", props.getProperty( "primitiveBooleanParam" ) ); + props = verifier.loadProperties("target/config2.properties"); + assertEquals("true", props.getProperty("primitiveBooleanParam")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4331DependencyCollectionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4331DependencyCollectionTest.java index 71c3d042a5..1e43cf3ea3 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4331DependencyCollectionTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4331DependencyCollectionTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4331DependencyCollectionTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4331DependencyCollectionTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4331DependencyCollectionTest() - { - super( "[3.0-alpha-3,)" ); + public MavenITmng4331DependencyCollectionTest() { + super("[3.0-alpha-3,)"); } /** @@ -49,23 +44,21 @@ public class MavenITmng4331DependencyCollectionTest * @throws Exception in case of failure */ @Test - public void testitEarlyLifecyclePhase() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4331" ); + public void testitEarlyLifecyclePhase() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4331"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4331" ); - verifier.deleteDirectory( "sub-2/target" ); - verifier.setLogFileName( "log-lifecycle.txt" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng4331"); + verifier.deleteDirectory("sub-2/target"); + verifier.setLogFileName("log-lifecycle.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List artifacts = verifier.loadLines( "sub-2/target/compile.txt", "UTF-8" ); - assertTrue( artifacts.toString(), artifacts.contains( "org.apache.maven.its.mng4331:sub-1:jar:0.1" ) ); - assertEquals( 1, artifacts.size() ); + List artifacts = verifier.loadLines("sub-2/target/compile.txt", "UTF-8"); + assertTrue(artifacts.toString(), artifacts.contains("org.apache.maven.its.mng4331:sub-1:jar:0.1")); + assertEquals(1, artifacts.size()); } /** @@ -75,30 +68,28 @@ public class MavenITmng4331DependencyCollectionTest * @throws Exception in case of failure */ @Test - public void testitCliAggregator() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4331" ); + public void testitCliAggregator() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4331"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4331" ); - verifier.addCliArgument( "-Ddepres.projectArtifacts=target/@artifactId@.txt" ); - verifier.setLogFileName( "log-aggregator.txt" ); - verifier.addCliArgument( "org.apache.maven.its.plugins:maven-it-plugin-dependency-collection:2.1-SNAPSHOT:aggregate-test" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4331"); + verifier.addCliArgument("-Ddepres.projectArtifacts=target/@artifactId@.txt"); + verifier.setLogFileName("log-aggregator.txt"); + verifier.addCliArgument( + "org.apache.maven.its.plugins:maven-it-plugin-dependency-collection:2.1-SNAPSHOT:aggregate-test"); verifier.execute(); verifier.verifyErrorFreeLog(); - List artifacts = verifier.loadLines( "target/sub-2.txt", "UTF-8" ); - assertTrue( artifacts.toString(), artifacts.contains( "org.apache.maven.its.mng4331:sub-1:jar:0.1" ) ); - assertEquals( 1, artifacts.size() ); + List artifacts = verifier.loadLines("target/sub-2.txt", "UTF-8"); + assertTrue(artifacts.toString(), artifacts.contains("org.apache.maven.its.mng4331:sub-1:jar:0.1")); + assertEquals(1, artifacts.size()); - artifacts = verifier.loadLines( "target/sub-1.txt", "UTF-8" ); - assertEquals( 0, artifacts.size() ); + artifacts = verifier.loadLines("target/sub-1.txt", "UTF-8"); + assertEquals(0, artifacts.size()); - artifacts = verifier.loadLines( "target/test.txt", "UTF-8" ); - assertEquals( 0, artifacts.size() ); + artifacts = verifier.loadLines("target/test.txt", "UTF-8"); + assertEquals(0, artifacts.size()); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4332DefaultPluginExecutionOrderTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4332DefaultPluginExecutionOrderTest.java index 700a839a10..54be0b604d 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4332DefaultPluginExecutionOrderTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4332DefaultPluginExecutionOrderTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Arrays; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4332DefaultPluginExecutionOrderTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4332DefaultPluginExecutionOrderTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4332DefaultPluginExecutionOrderTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng4332DefaultPluginExecutionOrderTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -50,20 +45,17 @@ public class MavenITmng4332DefaultPluginExecutionOrderTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4332" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4332"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "process-resources" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("process-resources"); verifier.execute(); verifier.verifyErrorFreeLog(); - List lines = verifier.loadLines( "target/resources-resources.txt", "UTF-8" ); - assertEquals( Arrays.asList( new String[] { "default", "test-1", "test-2" } ), lines ); + List lines = verifier.loadLines("target/resources-resources.txt", "UTF-8"); + assertEquals(Arrays.asList(new String[] {"default", "test-1", "test-2"}), lines); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4335SettingsOfflineModeTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4335SettingsOfflineModeTest.java index 6628597b63..7dae138fb1 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4335SettingsOfflineModeTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4335SettingsOfflineModeTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4335SettingsOfflineModeTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4335SettingsOfflineModeTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4335SettingsOfflineModeTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng4335SettingsOfflineModeTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -47,29 +42,23 @@ public class MavenITmng4335SettingsOfflineModeTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4335" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4335"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4335" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - try - { - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4335"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + try { + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - fail( "Build did not fail to resolve missing dependency although Maven ought to work offline!" ); - } - catch( VerificationException e ) - { + fail("Build did not fail to resolve missing dependency although Maven ought to work offline!"); + } catch (VerificationException e) { // expected, should fail } } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4338OptionalMojosTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4338OptionalMojosTest.java index 299561e9c3..4696572f5e 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4338OptionalMojosTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4338OptionalMojosTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4338OptionalMojosTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4338OptionalMojosTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4338OptionalMojosTest() - { - super( "[3.0,4.0.0-alpha-1)" ); + public MavenITmng4338OptionalMojosTest() { + super("[3.0,4.0.0-alpha-1)"); } /** @@ -47,17 +42,14 @@ public class MavenITmng4338OptionalMojosTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4338" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4338"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4341PluginExecutionOrderTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4341PluginExecutionOrderTest.java index dbf5d404a0..d943d45976 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4341PluginExecutionOrderTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4341PluginExecutionOrderTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Arrays; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4341PluginExecutionOrderTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4341PluginExecutionOrderTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4341PluginExecutionOrderTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng4341PluginExecutionOrderTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -49,20 +44,17 @@ public class MavenITmng4341PluginExecutionOrderTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4341" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4341"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List lines = verifier.loadLines( "target/log.txt", "UTF-8" ); - assertEquals( Arrays.asList( new String[] { "first", "second" } ), lines ); + List lines = verifier.loadLines("target/log.txt", "UTF-8"); + assertEquals(Arrays.asList(new String[] {"first", "second"}), lines); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4342IndependentMojoParameterDefaultValuesTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4342IndependentMojoParameterDefaultValuesTest.java index 0e6c2e6335..7b6658ee34 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4342IndependentMojoParameterDefaultValuesTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4342IndependentMojoParameterDefaultValuesTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4342IndependentMojoParameterDefaultValuesTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4342IndependentMojoParameterDefaultValuesTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4342IndependentMojoParameterDefaultValuesTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng4342IndependentMojoParameterDefaultValuesTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -48,23 +43,20 @@ public class MavenITmng4342IndependentMojoParameterDefaultValuesTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4342" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4342"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props1 = verifier.loadProperties( "target/config1.properties" ); - assertEquals( "maven-core-it", props1.getProperty( "defaultParam" ) ); + Properties props1 = verifier.loadProperties("target/config1.properties"); + assertEquals("maven-core-it", props1.getProperty("defaultParam")); - Properties props2 = verifier.loadProperties( "target/config2.properties" ); - assertEquals( "test", props2.getProperty( "defaultParam" ) ); + Properties props2 = verifier.loadProperties("target/config2.properties"); + assertEquals("test", props2.getProperty("defaultParam")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4343MissingReleaseUpdatePolicyTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4343MissingReleaseUpdatePolicyTest.java index 32ea410644..b1cb5c3fba 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4343MissingReleaseUpdatePolicyTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4343MissingReleaseUpdatePolicyTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,10 +16,7 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -33,6 +28,9 @@ import java.util.Deque; import java.util.Map; import java.util.concurrent.ConcurrentLinkedDeque; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.eclipse.jetty.server.Handler; import org.eclipse.jetty.server.NetworkConnector; import org.eclipse.jetty.server.Request; @@ -48,9 +46,7 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng4343MissingReleaseUpdatePolicyTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4343MissingReleaseUpdatePolicyTest extends AbstractMavenIntegrationTestCase { private Server server; private Deque requestedUris; @@ -59,80 +55,63 @@ public class MavenITmng4343MissingReleaseUpdatePolicyTest private int port; - public MavenITmng4343MissingReleaseUpdatePolicyTest() - { - super( "[3.0-alpha-3,)" ); + public MavenITmng4343MissingReleaseUpdatePolicyTest() { + super("[3.0-alpha-3,)"); } @BeforeEach - protected void setUp() - throws Exception - { - Handler repoHandler = new AbstractHandler() - { + protected void setUp() throws Exception { + Handler repoHandler = new AbstractHandler() { @Override - public void handle( String target, Request baseRequest, HttpServletRequest request, - HttpServletResponse response ) - throws IOException - { - System.out.println( "Handling " + request.getMethod() + " " + request.getRequestURL() ); + public void handle( + String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) + throws IOException { + System.out.println("Handling " + request.getMethod() + " " + request.getRequestURL()); - if ( request.getRequestURI().startsWith( "/org/apache/maven/its/mng4343" ) ) - { - requestedUris.add( request.getRequestURI().substring( 29 ) ); + if (request.getRequestURI().startsWith("/org/apache/maven/its/mng4343")) { + requestedUris.add(request.getRequestURI().substring(29)); } - if ( blockAccess ) - { - response.setStatus( HttpServletResponse.SC_NOT_FOUND ); - } - else - { + if (blockAccess) { + response.setStatus(HttpServletResponse.SC_NOT_FOUND); + } else { PrintWriter writer = response.getWriter(); - response.setStatus( HttpServletResponse.SC_OK ); + response.setStatus(HttpServletResponse.SC_OK); - if ( request.getRequestURI().endsWith( ".pom" ) ) - { - writer.println( "" ); - writer.println( " 4.0.0" ); - writer.println( " org.apache.maven.its.mng4343" ); - writer.println( " dep" ); - writer.println( " 0.1" ); - writer.println( "" ); - } - else if ( request.getRequestURI().endsWith( ".jar" ) ) - { - writer.println( "empty" ); - } - else if ( request.getRequestURI().endsWith( ".md5" ) || request.getRequestURI().endsWith( ".sha1" ) ) - { - response.setStatus( HttpServletResponse.SC_NOT_FOUND ); + if (request.getRequestURI().endsWith(".pom")) { + writer.println(""); + writer.println(" 4.0.0"); + writer.println(" org.apache.maven.its.mng4343"); + writer.println(" dep"); + writer.println(" 0.1"); + writer.println(""); + } else if (request.getRequestURI().endsWith(".jar")) { + writer.println("empty"); + } else if (request.getRequestURI().endsWith(".md5") + || request.getRequestURI().endsWith(".sha1")) { + response.setStatus(HttpServletResponse.SC_NOT_FOUND); } } - ( (Request) request ).setHandled( true ); + ((Request) request).setHandled(true); } }; - server = new Server( 0 ); - server.setHandler( repoHandler ); + server = new Server(0); + server.setHandler(repoHandler); server.start(); - if ( server.isFailed() ) - { - fail( "Couldn't bind the server socket to a free port!" ); + if (server.isFailed()) { + fail("Couldn't bind the server socket to a free port!"); } - port = ( (NetworkConnector) server.getConnectors()[0] ).getLocalPort(); - System.out.println( "Bound server socket to the port " + port ); + port = ((NetworkConnector) server.getConnectors()[0]).getLocalPort(); + System.out.println("Bound server socket to the port " + port); requestedUris = new ConcurrentLinkedDeque<>(); } @AfterEach - protected void tearDown() - throws Exception - { - if ( server != null ) - { + protected void tearDown() throws Exception { + if (server != null) { server.stop(); server.join(); } @@ -145,53 +124,48 @@ public class MavenITmng4343MissingReleaseUpdatePolicyTest * @throws Exception in case of failure */ @Test - public void testitAlways() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4343" ); + public void testitAlways() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4343"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4343" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng4343"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); Map filterProps = verifier.newDefaultFilterMap(); - filterProps.put( "@updates@", "always" ); - filterProps.put( "@port@", Integer.toString( port ) ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps ); + filterProps.put("@updates@", "always"); + filterProps.put("@port@", Integer.toString(port)); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8", filterProps); blockAccess = true; - verifier.setLogFileName( "log-always-1.txt" ); - try - { - verifier.addCliArgument( "validate" ); + verifier.setLogFileName("log-always-1.txt"); + try { + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - fail( "Build succeeded despite missing dependency" ); - } - catch ( VerificationException e ) - { + fail("Build succeeded despite missing dependency"); + } catch (VerificationException e) { // expected } - assertTrue( requestedUris.toString(), - requestedUris.contains( "/dep/0.1/dep-0.1.jar" ) || requestedUris.contains( "/dep/0.1/dep-0.1.pom" ) ); + assertTrue( + requestedUris.toString(), + requestedUris.contains("/dep/0.1/dep-0.1.jar") || requestedUris.contains("/dep/0.1/dep-0.1.pom")); requestedUris.clear(); blockAccess = false; - verifier.setLogFileName( "log-always-2.txt" ); - verifier.addCliArgument( "validate" ); + verifier.setLogFileName("log-always-2.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - assertTrue( requestedUris.toString(), requestedUris.contains( "/dep/0.1/dep-0.1.jar" ) ); - assertTrue( requestedUris.toString(), requestedUris.contains( "/dep/0.1/dep-0.1.pom" ) ); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng4343", "dep", "0.1", "jar" ); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng4343", "dep", "0.1", "pom" ); - + assertTrue(requestedUris.toString(), requestedUris.contains("/dep/0.1/dep-0.1.jar")); + assertTrue(requestedUris.toString(), requestedUris.contains("/dep/0.1/dep-0.1.pom")); + verifier.verifyArtifactPresent("org.apache.maven.its.mng4343", "dep", "0.1", "jar"); + verifier.verifyArtifactPresent("org.apache.maven.its.mng4343", "dep", "0.1", "pom"); } /** @@ -201,83 +175,74 @@ public class MavenITmng4343MissingReleaseUpdatePolicyTest * @throws Exception in case of failure */ @Test - public void testitNever() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4343" ); + public void testitNever() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4343"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4343" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng4343"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); Map filterProps = verifier.newDefaultFilterMap(); - filterProps.put( "@updates@", "never" ); - filterProps.put( "@port@", Integer.toString( port ) ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps ); + filterProps.put("@updates@", "never"); + filterProps.put("@port@", Integer.toString(port)); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8", filterProps); blockAccess = true; - verifier.setLogFileName( "log-never-1.txt" ); - try - { - verifier.addCliArgument( "validate" ); + verifier.setLogFileName("log-never-1.txt"); + try { + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - fail( "Build succeeded despite missing dependency" ); - } - catch ( VerificationException e ) - { + fail("Build succeeded despite missing dependency"); + } catch (VerificationException e) { // expected } - assertTrue( requestedUris.toString(), - requestedUris.contains( "/dep/0.1/dep-0.1.jar" ) || requestedUris.contains( "/dep/0.1/dep-0.1.pom" ) ); + assertTrue( + requestedUris.toString(), + requestedUris.contains("/dep/0.1/dep-0.1.jar") || requestedUris.contains("/dep/0.1/dep-0.1.pom")); requestedUris.clear(); blockAccess = false; - verifier.setLogFileName( "log-never-2.txt" ); - try - { - verifier.addCliArgument( "validate" ); + verifier.setLogFileName("log-never-2.txt"); + try { + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - fail( "Remote repository was accessed despite updatePolicy=never" ); - } - catch ( VerificationException e ) - { + fail("Remote repository was accessed despite updatePolicy=never"); + } catch (VerificationException e) { // expected } //noinspection unchecked - assertTrue( requestedUris.isEmpty() ); - verifier.verifyArtifactNotPresent( "org.apache.maven.its.mng4343", "dep", "0.1", "jar" ); - verifier.verifyArtifactNotPresent( "org.apache.maven.its.mng4343", "dep", "0.1", "pom" ); + assertTrue(requestedUris.isEmpty()); + verifier.verifyArtifactNotPresent("org.apache.maven.its.mng4343", "dep", "0.1", "jar"); + verifier.verifyArtifactNotPresent("org.apache.maven.its.mng4343", "dep", "0.1", "pom"); - verifier.setLogFileName( "log-never-3.txt" ); - verifier.addCliArgument( "-U" ); - verifier.addCliArgument( "validate" ); + verifier.setLogFileName("log-never-3.txt"); + verifier.addCliArgument("-U"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - assertTrue( requestedUris.contains( "/dep/0.1/dep-0.1.jar" ) ); - assertTrue( requestedUris.contains( "/dep/0.1/dep-0.1.pom" ) ); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng4343", "dep", "0.1", "jar" ); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng4343", "dep", "0.1", "pom" ); + assertTrue(requestedUris.contains("/dep/0.1/dep-0.1.jar")); + assertTrue(requestedUris.contains("/dep/0.1/dep-0.1.pom")); + verifier.verifyArtifactPresent("org.apache.maven.its.mng4343", "dep", "0.1", "jar"); + verifier.verifyArtifactPresent("org.apache.maven.its.mng4343", "dep", "0.1", "pom"); requestedUris.clear(); - verifier.setLogFileName( "log-never-4.txt" ); - verifier.addCliArgument( "-U" ); - verifier.addCliArgument( "validate" ); + verifier.setLogFileName("log-never-4.txt"); + verifier.addCliArgument("-U"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); //noinspection unchecked - assertTrue( requestedUris.isEmpty() ); - + assertTrue(requestedUris.isEmpty()); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4344ManagedPluginExecutionOrderTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4344ManagedPluginExecutionOrderTest.java index 53cec9e2a5..aeefb9758a 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4344ManagedPluginExecutionOrderTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4344ManagedPluginExecutionOrderTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Arrays; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4344ManagedPluginExecutionOrderTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4344ManagedPluginExecutionOrderTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4344ManagedPluginExecutionOrderTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng4344ManagedPluginExecutionOrderTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -50,20 +45,17 @@ public class MavenITmng4344ManagedPluginExecutionOrderTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4344" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4344"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "process-resources" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("process-resources"); verifier.execute(); verifier.verifyErrorFreeLog(); - List lines = verifier.loadLines( "target/log.txt", "UTF-8" ); - assertEquals( Arrays.asList( new String[] { "first", "second" } ), lines ); + List lines = verifier.loadLines("target/log.txt", "UTF-8"); + assertEquals(Arrays.asList(new String[] {"first", "second"}), lines); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4345DefaultPluginExecutionOrderTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4345DefaultPluginExecutionOrderTest.java index 54728542d2..c7ad9a1831 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4345DefaultPluginExecutionOrderTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4345DefaultPluginExecutionOrderTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Arrays; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4345DefaultPluginExecutionOrderTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4345DefaultPluginExecutionOrderTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4345DefaultPluginExecutionOrderTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng4345DefaultPluginExecutionOrderTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -50,20 +45,17 @@ public class MavenITmng4345DefaultPluginExecutionOrderTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4345" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4345"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "process-resources" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("process-resources"); verifier.execute(); verifier.verifyErrorFreeLog(); - List lines = verifier.loadLines( "target/log.txt", "UTF-8" ); - assertEquals( Arrays.asList( new String[] { "first", "second" } ), lines ); + List lines = verifier.loadLines("target/log.txt", "UTF-8"); + assertEquals(Arrays.asList(new String[] {"first", "second"}), lines); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4347ImportScopeWithSettingsProfilesTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4347ImportScopeWithSettingsProfilesTest.java index 67f3d2d2ed..849ed20e12 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4347ImportScopeWithSettingsProfilesTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4347ImportScopeWithSettingsProfilesTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * * @author John Casey */ -public class MavenITmng4347ImportScopeWithSettingsProfilesTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4347ImportScopeWithSettingsProfilesTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4347ImportScopeWithSettingsProfilesTest() - { - super( "(2.2.1,]" ); + public MavenITmng4347ImportScopeWithSettingsProfilesTest() { + super("(2.2.1,]"); } /** @@ -48,27 +43,24 @@ public class MavenITmng4347ImportScopeWithSettingsProfilesTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4347" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4347"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4347" ); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4347"); - verifier.setAutoclean( false ); + verifier.setAutoclean(false); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); - verifier.addCliArgument( "validate" ); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4348NoUnnecessaryRepositoryAccessTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4348NoUnnecessaryRepositoryAccessTest.java index ae21d75efe..799e7c4060 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4348NoUnnecessaryRepositoryAccessTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4348NoUnnecessaryRepositoryAccessTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,9 +16,7 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -31,6 +27,8 @@ import java.util.Collections; import java.util.List; import java.util.Map; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.eclipse.jetty.server.Handler; import org.eclipse.jetty.server.NetworkConnector; import org.eclipse.jetty.server.Request; @@ -44,13 +42,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng4348NoUnnecessaryRepositoryAccessTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4348NoUnnecessaryRepositoryAccessTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4348NoUnnecessaryRepositoryAccessTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng4348NoUnnecessaryRepositoryAccessTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -60,66 +55,57 @@ public class MavenITmng4348NoUnnecessaryRepositoryAccessTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4348" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4348"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); - final List requestedUris = Collections.synchronizedList( new ArrayList() ); + final List requestedUris = Collections.synchronizedList(new ArrayList()); - Handler repoHandler = new AbstractHandler() - { + Handler repoHandler = new AbstractHandler() { @Override - public void handle( String target, Request baseRequest, HttpServletRequest request, - HttpServletResponse response ) - { - System.out.println( "Handling " + request.getMethod() + " " + request.getRequestURL() ); + public void handle( + String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) { + System.out.println("Handling " + request.getMethod() + " " + request.getRequestURL()); // NOTE: Old Maven versions use the test repo also to check for plugin updates so we need to filter - if ( request.getRequestURI().startsWith( "/org/apache/maven/its/mng4348" ) ) - { - requestedUris.add( request.getRequestURI() ); + if (request.getRequestURI().startsWith("/org/apache/maven/its/mng4348")) { + requestedUris.add(request.getRequestURI()); } - response.setStatus( HttpServletResponse.SC_NOT_FOUND ); + response.setStatus(HttpServletResponse.SC_NOT_FOUND); - ( (Request) request ).setHandled( true ); + ((Request) request).setHandled(true); } }; - Server server = new Server( 0 ); - server.setHandler( repoHandler ); + Server server = new Server(0); + server.setHandler(repoHandler); - try - { + try { server.start(); - if ( server.isFailed() ) - { - fail( "Couldn't bind the server socket to a free port!" ); + if (server.isFailed()) { + fail("Couldn't bind the server socket to a free port!"); } - int port = ( (NetworkConnector) server.getConnectors()[0] ).getLocalPort(); - System.out.println( "Bound server socket to the port " + port ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4348" ); - verifier.deleteDirectory( "target" ); + int port = ((NetworkConnector) server.getConnectors()[0]).getLocalPort(); + System.out.println("Bound server socket to the port " + port); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng4348"); + verifier.deleteDirectory("target"); Map filterProps = verifier.newDefaultFilterMap(); - filterProps.put( "@port@", Integer.toString( port ) ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + filterProps.put("@port@", Integer.toString(port)); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8", filterProps); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - } - finally - { + } finally { server.stop(); server.join(); } - verifier.verifyFilePresent( "target/touch.txt" ); - assertEquals( new ArrayList(), requestedUris ); + verifier.verifyFilePresent("target/touch.txt"); + assertEquals(new ArrayList(), requestedUris); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4349RelocatedArtifactWithInvalidPomTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4349RelocatedArtifactWithInvalidPomTest.java index 4fb37ac984..d3ebea5c50 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4349RelocatedArtifactWithInvalidPomTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4349RelocatedArtifactWithInvalidPomTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng4349RelocatedArtifactWithInvalidPomTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4349RelocatedArtifactWithInvalidPomTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4349RelocatedArtifactWithInvalidPomTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng4349RelocatedArtifactWithInvalidPomTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -49,24 +44,21 @@ public class MavenITmng4349RelocatedArtifactWithInvalidPomTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4349" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4349"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4349" ); - verifier.deleteDirectory( "target" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng4349"); + verifier.deleteDirectory("target"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List classpath = verifier.loadLines( "target/classpath.txt", "UTF-8" ); - assertTrue( classpath.toString(), classpath.contains( "new-0.1.jar" ) ); + List classpath = verifier.loadLines("target/classpath.txt", "UTF-8"); + assertTrue(classpath.toString(), classpath.contains("new-0.1.jar")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4350LifecycleMappingExecutionOrderTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4350LifecycleMappingExecutionOrderTest.java index b40cee6617..5c59ed5464 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4350LifecycleMappingExecutionOrderTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4350LifecycleMappingExecutionOrderTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Arrays; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4350LifecycleMappingExecutionOrderTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4350LifecycleMappingExecutionOrderTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4350LifecycleMappingExecutionOrderTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng4350LifecycleMappingExecutionOrderTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -50,20 +45,17 @@ public class MavenITmng4350LifecycleMappingExecutionOrderTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4350" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4350"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "process-resources" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("process-resources"); verifier.execute(); verifier.verifyErrorFreeLog(); - List lines = verifier.loadLines( "target/log.txt", "UTF-8" ); - assertEquals( Arrays.asList( new String[] { "first", "second" } ), lines ); + List lines = verifier.loadLines("target/log.txt", "UTF-8"); + assertEquals(Arrays.asList(new String[] {"first", "second"}), lines); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4353PluginDependencyResolutionFromPomRepoTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4353PluginDependencyResolutionFromPomRepoTest.java index 74ca949456..2957da278c 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4353PluginDependencyResolutionFromPomRepoTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4353PluginDependencyResolutionFromPomRepoTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Map; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4353PluginDependencyResolutionFromPomRepoTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4353PluginDependencyResolutionFromPomRepoTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4353PluginDependencyResolutionFromPomRepoTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng4353PluginDependencyResolutionFromPomRepoTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -48,29 +43,28 @@ public class MavenITmng4353PluginDependencyResolutionFromPomRepoTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4353" ).getCanonicalFile(); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4353") + .getCanonicalFile(); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4353" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4353"); Map filterProps = verifier.newDefaultFilterMap(); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps ); - verifier.filterFile( "repo-1/org/apache/maven/its/mng4353/maven-mng4353-plugin/0.1/template.pom", - "repo-1/org/apache/maven/its/mng4353/maven-mng4353-plugin/0.1/maven-mng4353-plugin-0.1" - + ".pom", - "UTF-8", filterProps ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8", filterProps); + verifier.filterFile( + "repo-1/org/apache/maven/its/mng4353/maven-mng4353-plugin/0.1/template.pom", + "repo-1/org/apache/maven/its/mng4353/maven-mng4353-plugin/0.1/maven-mng4353-plugin-0.1" + ".pom", + "UTF-8", + filterProps); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/touch.properties" ); - assertEquals( "passed", props.getProperty( "test" ) ); + Properties props = verifier.loadProperties("target/touch.properties"); + assertEquals("passed", props.getProperty("test")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4355ExtensionAutomaticVersionResolutionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4355ExtensionAutomaticVersionResolutionTest.java index cb9e1c2df6..965ff38f87 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4355ExtensionAutomaticVersionResolutionTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4355ExtensionAutomaticVersionResolutionTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4355ExtensionAutomaticVersionResolutionTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4355ExtensionAutomaticVersionResolutionTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4355ExtensionAutomaticVersionResolutionTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng4355ExtensionAutomaticVersionResolutionTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -47,20 +42,17 @@ public class MavenITmng4355ExtensionAutomaticVersionResolutionTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4355" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4355"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4355" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng4355"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4356NoNeedlessRelookupFromActiveCollectionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4356NoNeedlessRelookupFromActiveCollectionTest.java index 04cc10277a..8db8694de1 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4356NoNeedlessRelookupFromActiveCollectionTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4356NoNeedlessRelookupFromActiveCollectionTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -34,13 +32,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann */ @Tag("disabled") -public class MavenITmng4356NoNeedlessRelookupFromActiveCollectionTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4356NoNeedlessRelookupFromActiveCollectionTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4356NoNeedlessRelookupFromActiveCollectionTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng4356NoNeedlessRelookupFromActiveCollectionTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -50,21 +45,18 @@ public class MavenITmng4356NoNeedlessRelookupFromActiveCollectionTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4356" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4356"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/component.properties" ); - assertEquals( "2", props.getProperty( "count" ) ); + Properties props = verifier.loadProperties("target/component.properties"); + assertEquals("2", props.getProperty("count")); // the proper behavior of the collections is actually checked by the IT plugin, we merely check it was run } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4357LifecycleMappingDiscoveryInReactorTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4357LifecycleMappingDiscoveryInReactorTest.java index d32403278b..1375f4be67 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4357LifecycleMappingDiscoveryInReactorTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4357LifecycleMappingDiscoveryInReactorTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4357LifecycleMappingDiscoveryInReactorTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4357LifecycleMappingDiscoveryInReactorTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4357LifecycleMappingDiscoveryInReactorTest() - { - super( "[2.1.0,)" ); + public MavenITmng4357LifecycleMappingDiscoveryInReactorTest() { + super("[2.1.0,)"); } /** @@ -47,29 +42,26 @@ public class MavenITmng4357LifecycleMappingDiscoveryInReactorTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4357" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4357"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteDirectory( "mod-a/target" ); - verifier.deleteDirectory( "mod-b/target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4357" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteDirectory("mod-a/target"); + verifier.deleteDirectory("mod-b/target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4357"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "mod-a/target/old.txt" ); - verifier.verifyFileNotPresent( "mod-a/target/new.txt" ); + verifier.verifyFilePresent("mod-a/target/old.txt"); + verifier.verifyFileNotPresent("mod-a/target/new.txt"); - verifier.verifyFileNotPresent( "mod-b/target/old.txt" ); - verifier.verifyFilePresent( "mod-b/target/new.txt" ); + verifier.verifyFileNotPresent("mod-b/target/old.txt"); + verifier.verifyFilePresent("mod-b/target/new.txt"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4359LocallyReachableParentOutsideOfReactorTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4359LocallyReachableParentOutsideOfReactorTest.java index 15148055e1..a7be6cc961 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4359LocallyReachableParentOutsideOfReactorTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4359LocallyReachableParentOutsideOfReactorTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4359LocallyReachableParentOutsideOfReactorTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4359LocallyReachableParentOutsideOfReactorTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4359LocallyReachableParentOutsideOfReactorTest() - { - super( "[2.0.7,)" ); + public MavenITmng4359LocallyReachableParentOutsideOfReactorTest() { + super("[2.0.7,)"); } /** @@ -48,23 +43,20 @@ public class MavenITmng4359LocallyReachableParentOutsideOfReactorTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4359" ); - testDir = new File( testDir, "reactor-parent" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4359"); + testDir = new File(testDir, "reactor-parent"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "mod-c/target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4359" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("mod-c/target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4359"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List cp = verifier.loadLines( "mod-c/target/classpath.txt", "UTF-8" ); - assertTrue( cp.toString(), cp.contains( "mod-b/pom.xml" ) ); - assertTrue( cp.toString(), cp.contains( "mod-a/pom.xml" ) ); + List cp = verifier.loadLines("mod-c/target/classpath.txt", "UTF-8"); + assertTrue(cp.toString(), cp.contains("mod-b/pom.xml")); + assertTrue(cp.toString(), cp.contains("mod-a/pom.xml")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4360WebDavSupportTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4360WebDavSupportTest.java index bbcaa08767..4f2e43a003 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4360WebDavSupportTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4360WebDavSupportTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,9 +16,7 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -31,6 +27,8 @@ import java.io.PrintWriter; import java.util.List; import java.util.Map; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.eclipse.jetty.server.Handler; import org.eclipse.jetty.server.NetworkConnector; import org.eclipse.jetty.server.Request; @@ -44,13 +42,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng4360WebDavSupportTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4360WebDavSupportTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4360WebDavSupportTest() - { - super( "[2.1.0-M1,)" ); + public MavenITmng4360WebDavSupportTest() { + super("[2.1.0-M1,)"); } /** @@ -60,10 +55,8 @@ public class MavenITmng4360WebDavSupportTest * @throws Exception in case of failure */ @Test - public void testitJackrabbitBasedImpl() - throws Exception - { - test( "jackrabbit" ); + public void testitJackrabbitBasedImpl() throws Exception { + test("jackrabbit"); } /** @@ -73,87 +66,73 @@ public class MavenITmng4360WebDavSupportTest * @throws Exception in case of failure */ @Test - public void testitSlideBasedImpl() - throws Exception - { - test( "slide" ); + public void testitSlideBasedImpl() throws Exception { + test("slide"); } - private void test( String project ) - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4360" ); + private void test(String project) throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4360"); - testDir = new File( testDir, project ); + testDir = new File(testDir, project); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); - Handler repoHandler = new AbstractHandler() - { + Handler repoHandler = new AbstractHandler() { @Override - public void handle( String target, Request baseRequest, HttpServletRequest request, - HttpServletResponse response ) - throws IOException - { - System.out.println( "Handling " + request.getMethod() + " " + request.getRequestURL() ); + public void handle( + String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) + throws IOException { + System.out.println("Handling " + request.getMethod() + " " + request.getRequestURL()); PrintWriter writer = response.getWriter(); - response.setStatus( HttpServletResponse.SC_OK ); + response.setStatus(HttpServletResponse.SC_OK); - if ( request.getRequestURI().endsWith( ".pom" ) ) - { - writer.println( "" ); - writer.println( " 4.0.0" ); - writer.println( " org.apache.maven.its.mng4360" ); - writer.println( " dep" ); - writer.println( " 0.1" ); - writer.println( "" ); - } - else if ( request.getRequestURI().endsWith( ".jar" ) ) - { - writer.println( "empty" ); - } - else if ( request.getRequestURI().endsWith( ".md5" ) || request.getRequestURI().endsWith( ".sha1" ) ) - { - response.setStatus( HttpServletResponse.SC_NOT_FOUND ); + if (request.getRequestURI().endsWith(".pom")) { + writer.println(""); + writer.println(" 4.0.0"); + writer.println(" org.apache.maven.its.mng4360"); + writer.println(" dep"); + writer.println(" 0.1"); + writer.println(""); + } else if (request.getRequestURI().endsWith(".jar")) { + writer.println("empty"); + } else if (request.getRequestURI().endsWith(".md5") + || request.getRequestURI().endsWith(".sha1")) { + response.setStatus(HttpServletResponse.SC_NOT_FOUND); } - ( (Request) request ).setHandled( true ); + ((Request) request).setHandled(true); } }; - Server server = new Server( 0 ); - server.setHandler( repoHandler ); + Server server = new Server(0); + server.setHandler(repoHandler); - try - { + try { server.start(); - if ( server.isFailed() ) - { - fail( "Couldn't bind the server socket to a free port!" ); + if (server.isFailed()) { + fail("Couldn't bind the server socket to a free port!"); } - int port = ( (NetworkConnector) server.getConnectors()[0] ).getLocalPort(); - System.out.println( "Bound server socket to the port " + port ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4360" ); - verifier.deleteDirectory( "target" ); + int port = ((NetworkConnector) server.getConnectors()[0]).getLocalPort(); + System.out.println("Bound server socket to the port " + port); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng4360"); + verifier.deleteDirectory("target"); Map filterProps = verifier.newDefaultFilterMap(); - filterProps.put( "@port@", Integer.toString( port ) ); - verifier.filterFile( "../settings-template.xml", "settings.xml", "UTF-8", filterProps ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + filterProps.put("@port@", Integer.toString(port)); + verifier.filterFile("../settings-template.xml", "settings.xml", "UTF-8", filterProps); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - } - finally - { + } finally { server.stop(); server.join(); } - List cp = verifier.loadLines( "target/classpath.txt", "UTF-8" ); - assertTrue( cp.toString(), cp.contains( "dep-0.1.jar" ) ); + List cp = verifier.loadLines("target/classpath.txt", "UTF-8"); + assertTrue(cp.toString(), cp.contains("dep-0.1.jar")); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4361ForceDependencySnapshotUpdateTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4361ForceDependencySnapshotUpdateTest.java index 87e815d861..3915c26a45 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4361ForceDependencySnapshotUpdateTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4361ForceDependencySnapshotUpdateTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Map; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4361ForceDependencySnapshotUpdateTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4361ForceDependencySnapshotUpdateTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4361ForceDependencySnapshotUpdateTest() - { - super( "[2.0,3.0-alpha-1),[3.0-alpha-4,)" ); + public MavenITmng4361ForceDependencySnapshotUpdateTest() { + super("[2.0,3.0-alpha-1),[3.0-alpha-4,)"); } /** @@ -49,47 +44,42 @@ public class MavenITmng4361ForceDependencySnapshotUpdateTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4361" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4361"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4361" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng4361"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); Map filterProps = verifier.newDefaultFilterMap(); - filterProps.put( "@repo@", "repo-1" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps ); - verifier.setLogFileName( "log-force-1.txt" ); - verifier.addCliArgument( "validate" ); + filterProps.put("@repo@", "repo-1"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8", filterProps); + verifier.setLogFileName("log-force-1.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - assertNull( verifier.loadProperties( "target/checksum.properties" ).getProperty( "b-0.1-SNAPSHOT.jar" ) ); + assertNull(verifier.loadProperties("target/checksum.properties").getProperty("b-0.1-SNAPSHOT.jar")); - filterProps.put( "@repo@", "repo-2" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps ); - verifier.setLogFileName( "log-force-2.txt" ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "-U" ); - verifier.addCliArgument( "validate" ); + filterProps.put("@repo@", "repo-2"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8", filterProps); + verifier.setLogFileName("log-force-2.txt"); + verifier.deleteDirectory("target"); + verifier.addCliArgument("-U"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - - Properties checksums = verifier.loadProperties( "target/checksum.properties" ); - assertChecksum( "2a22eeca91211193e927ea3b2ecdf56481585064", "a-0.1-SNAPSHOT.jar", checksums ); - assertChecksum( "ae352eb0047059b2e47fae397eb8ae6bd5b1c8ea", "b-0.1-SNAPSHOT.jar", checksums ); - assertChecksum( "6e6ef8590f166bcf610965c74c165128776214b9", "c-0.1-SNAPSHOT.jar", checksums ); + Properties checksums = verifier.loadProperties("target/checksum.properties"); + assertChecksum("2a22eeca91211193e927ea3b2ecdf56481585064", "a-0.1-SNAPSHOT.jar", checksums); + assertChecksum("ae352eb0047059b2e47fae397eb8ae6bd5b1c8ea", "b-0.1-SNAPSHOT.jar", checksums); + assertChecksum("6e6ef8590f166bcf610965c74c165128776214b9", "c-0.1-SNAPSHOT.jar", checksums); } - private void assertChecksum( String checksum, String jar, Properties checksums ) - { - assertEquals( checksum, checksums.getProperty( jar, "" ).toLowerCase( java.util.Locale.ENGLISH ) ); + private void assertChecksum(String checksum, String jar, Properties checksums) { + assertEquals(checksum, checksums.getProperty(jar, "").toLowerCase(java.util.Locale.ENGLISH)); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4363DynamicAdditionOfDependencyArtifactTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4363DynamicAdditionOfDependencyArtifactTest.java index 4bd28332f2..6243cf9915 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4363DynamicAdditionOfDependencyArtifactTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4363DynamicAdditionOfDependencyArtifactTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4363DynamicAdditionOfDependencyArtifactTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4363DynamicAdditionOfDependencyArtifactTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4363DynamicAdditionOfDependencyArtifactTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng4363DynamicAdditionOfDependencyArtifactTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -48,26 +43,23 @@ public class MavenITmng4363DynamicAdditionOfDependencyArtifactTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4363" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4363"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4363" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "generate-sources" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4363"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("generate-sources"); verifier.execute(); verifier.verifyErrorFreeLog(); - List classpath = verifier.loadLines( "target/classpath.txt", "UTF-8" ); - assertTrue( classpath.toString(), classpath.contains( "a-0.1.jar" ) ); - assertTrue( classpath.toString(), classpath.contains( "b-0.1.jar" ) ); - assertTrue( classpath.toString(), classpath.contains( "c-0.1.jar" ) ); + List classpath = verifier.loadLines("target/classpath.txt", "UTF-8"); + assertTrue(classpath.toString(), classpath.contains("a-0.1.jar")); + assertTrue(classpath.toString(), classpath.contains("b-0.1.jar")); + assertTrue(classpath.toString(), classpath.contains("c-0.1.jar")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4365XmlMarkupInAttributeValueTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4365XmlMarkupInAttributeValueTest.java index 024858c6ff..c142568c0e 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4365XmlMarkupInAttributeValueTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4365XmlMarkupInAttributeValueTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4365XmlMarkupInAttributeValueTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4365XmlMarkupInAttributeValueTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4365XmlMarkupInAttributeValueTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng4365XmlMarkupInAttributeValueTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -46,16 +41,13 @@ public class MavenITmng4365XmlMarkupInAttributeValueTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4365" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4365"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4367LayoutAwareMirrorSelectionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4367LayoutAwareMirrorSelectionTest.java index f52eaea4ae..eb15cc8707 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4367LayoutAwareMirrorSelectionTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4367LayoutAwareMirrorSelectionTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Map; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4367LayoutAwareMirrorSelectionTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4367LayoutAwareMirrorSelectionTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4367LayoutAwareMirrorSelectionTest() - { - super( "[3.0-alpha-3,)" ); + public MavenITmng4367LayoutAwareMirrorSelectionTest() { + super("[3.0-alpha-3,)"); } /** @@ -48,29 +43,27 @@ public class MavenITmng4367LayoutAwareMirrorSelectionTest * @throws Exception in case of failure */ @Test - public void testitNoLayout() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4367" ); + public void testitNoLayout() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4367"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4367" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng4367"); Map filterProps = verifier.newDefaultFilterMap(); - filterProps.put( "@repourl@", filterProps.get( "@baseurl@" ) + "/void" ); - filterProps.put( "@mirrorurl@", filterProps.get( "@baseurl@" ) + "/repo" ); - filterProps.put( "@layouts@", "" ); + filterProps.put("@repourl@", filterProps.get("@baseurl@") + "/void"); + filterProps.put("@mirrorurl@", filterProps.get("@baseurl@") + "/repo"); + filterProps.put("@layouts@", ""); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings-a.xml" ); - verifier.filterFile( "settings-template.xml", "settings-a.xml", "UTF-8", filterProps ); - verifier.setLogFileName( "log-a.txt" ); - verifier.addCliArgument( "validate" ); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings-a.xml"); + verifier.filterFile("settings-template.xml", "settings-a.xml", "UTF-8", filterProps); + verifier.setLogFileName("log-a.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng4367", "dep", "0.1", "jar" ); + verifier.verifyArtifactPresent("org.apache.maven.its.mng4367", "dep", "0.1", "jar"); } /** @@ -79,29 +72,27 @@ public class MavenITmng4367LayoutAwareMirrorSelectionTest * @throws Exception in case of failure */ @Test - public void testitSpecificLayouts() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4367" ); + public void testitSpecificLayouts() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4367"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4367" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng4367"); Map filterProps = verifier.newDefaultFilterMap(); - filterProps.put( "@repourl@", filterProps.get( "@baseurl@" ) + "/void" ); - filterProps.put( "@mirrorurl@", filterProps.get( "@baseurl@" ) + "/repo" ); - filterProps.put( "@layouts@", "default,legacy" ); + filterProps.put("@repourl@", filterProps.get("@baseurl@") + "/void"); + filterProps.put("@mirrorurl@", filterProps.get("@baseurl@") + "/repo"); + filterProps.put("@layouts@", "default,legacy"); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings-b.xml" ); - verifier.filterFile( "settings-template.xml", "settings-b.xml", "UTF-8", filterProps ); - verifier.setLogFileName( "log-b.txt" ); - verifier.addCliArgument( "validate" ); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings-b.xml"); + verifier.filterFile("settings-template.xml", "settings-b.xml", "UTF-8", filterProps); + verifier.setLogFileName("log-b.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng4367", "dep", "0.1", "jar" ); + verifier.verifyArtifactPresent("org.apache.maven.its.mng4367", "dep", "0.1", "jar"); } /** @@ -110,29 +101,26 @@ public class MavenITmng4367LayoutAwareMirrorSelectionTest * @throws Exception in case of failure */ @Test - public void testitNonMatchingLayout() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4367" ); + public void testitNonMatchingLayout() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4367"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4367" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng4367"); Map filterProps = verifier.newDefaultFilterMap(); - filterProps.put( "@repourl@", filterProps.get( "@baseurl@" ) + "/repo" ); - filterProps.put( "@mirrorurl@", filterProps.get( "@baseurl@" ) + "/void" ); - filterProps.put( "@layouts@", "foo" ); + filterProps.put("@repourl@", filterProps.get("@baseurl@") + "/repo"); + filterProps.put("@mirrorurl@", filterProps.get("@baseurl@") + "/void"); + filterProps.put("@layouts@", "foo"); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings-c.xml" ); - verifier.filterFile( "settings-template.xml", "settings-c.xml", "UTF-8", filterProps ); - verifier.setLogFileName( "log-c.txt" ); - verifier.addCliArgument( "validate" ); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings-c.xml"); + verifier.filterFile("settings-template.xml", "settings-c.xml", "UTF-8", filterProps); + verifier.setLogFileName("log-c.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng4367", "dep", "0.1", "jar" ); + verifier.verifyArtifactPresent("org.apache.maven.its.mng4367", "dep", "0.1", "jar"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4368TimestampAwareArtifactInstallerTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4368TimestampAwareArtifactInstallerTest.java index a52e454e2d..b58ea201a9 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4368TimestampAwareArtifactInstallerTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4368TimestampAwareArtifactInstallerTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import org.apache.maven.shared.utils.io.FileUtils; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4368TimestampAwareArtifactInstallerTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4368TimestampAwareArtifactInstallerTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4368TimestampAwareArtifactInstallerTest() - { - super( "[2.0.3,3.0-alpha-1),[3.0-alpha-6,)" ); + public MavenITmng4368TimestampAwareArtifactInstallerTest() { + super("[2.0.3,3.0-alpha-1),[3.0-alpha-6,)"); } /** @@ -48,48 +43,46 @@ public class MavenITmng4368TimestampAwareArtifactInstallerTest * @throws Exception in case of failure */ @Test - public void testitPomPackaging() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4368/pom" ); + public void testitPomPackaging() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4368/pom"); - File aDir = new File( testDir, "branch-a" ); - File aPom = new File( aDir, "pom.xml" ); - File bDir = new File( testDir, "branch-b" ); - File bPom = new File( bDir, "pom.xml" ); + File aDir = new File(testDir, "branch-a"); + File aPom = new File(aDir, "pom.xml"); + File bDir = new File(testDir, "branch-b"); + File bPom = new File(bDir, "pom.xml"); - aPom.setLastModified( System.currentTimeMillis() ); - bPom.setLastModified( aPom.lastModified() - 1000 * 60 ); + aPom.setLastModified(System.currentTimeMillis()); + bPom.setLastModified(aPom.lastModified() - 1000 * 60); - Verifier verifier = newVerifier( aDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4368" ); - verifier.addCliArgument( "initialize" ); + Verifier verifier = newVerifier(aDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4368"); + verifier.addCliArgument("initialize"); verifier.execute(); verifier.verifyErrorFreeLog(); File installedPom = - new File( verifier.getArtifactPath( "org.apache.maven.its.mng4368", "test", "0.1-SNAPSHOT", "pom" ) ); + new File(verifier.getArtifactPath("org.apache.maven.its.mng4368", "test", "0.1-SNAPSHOT", "pom")); - String pom = FileUtils.fileRead( installedPom, "UTF-8" ); - assertTrue( pom.indexOf( "Branch-A" ) > 0 ); - assertFalse( pom.contains( "Branch-B" ) ); + String pom = FileUtils.fileRead(installedPom, "UTF-8"); + assertTrue(pom.indexOf("Branch-A") > 0); + assertFalse(pom.contains("Branch-B")); - assertEquals( aPom.length(), bPom.length() ); - assertTrue( aPom.lastModified() > bPom.lastModified() ); - assertTrue( installedPom.lastModified() > bPom.lastModified() ); + assertEquals(aPom.length(), bPom.length()); + assertTrue(aPom.lastModified() > bPom.lastModified()); + assertTrue(installedPom.lastModified() > bPom.lastModified()); - verifier = newVerifier( bDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "initialize" ); + verifier = newVerifier(bDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("initialize"); verifier.execute(); verifier.verifyErrorFreeLog(); - pom = FileUtils.fileRead( installedPom, "UTF-8" ); - assertFalse( pom.contains( "Branch-A" ) ); - assertTrue( pom.indexOf( "Branch-B" ) > 0 ); + pom = FileUtils.fileRead(installedPom, "UTF-8"); + assertFalse(pom.contains("Branch-A")); + assertTrue(pom.indexOf("Branch-B") > 0); } /** @@ -99,68 +92,65 @@ public class MavenITmng4368TimestampAwareArtifactInstallerTest * @throws Exception in case of failure */ @Test - public void testitJarPackaging() - throws Exception - { - requiresMavenVersion( "[2.2.2,3.0-alpha-1),[3.0-alpha-6,)" ); + public void testitJarPackaging() throws Exception { + requiresMavenVersion("[2.2.2,3.0-alpha-1),[3.0-alpha-6,)"); - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4368/jar" ); + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4368/jar"); - File aDir = new File( testDir, "branch-a" ); - File aArtifact = new File( aDir, "artifact.jar" ); - File bDir = new File( testDir, "branch-b" ); - File bArtifact = new File( bDir, "artifact.jar" ); + File aDir = new File(testDir, "branch-a"); + File aArtifact = new File(aDir, "artifact.jar"); + File bDir = new File(testDir, "branch-b"); + File bArtifact = new File(bDir, "artifact.jar"); - FileUtils.fileWrite( aArtifact.getPath(), "UTF-8", "from Branch-A" ); - aArtifact.setLastModified( System.currentTimeMillis() ); - FileUtils.fileWrite( bArtifact.getPath(), "UTF-8", "from Branch-B" ); - bArtifact.setLastModified( aArtifact.lastModified() - 1000 * 60 ); + FileUtils.fileWrite(aArtifact.getPath(), "UTF-8", "from Branch-A"); + aArtifact.setLastModified(System.currentTimeMillis()); + FileUtils.fileWrite(bArtifact.getPath(), "UTF-8", "from Branch-B"); + bArtifact.setLastModified(aArtifact.lastModified() - 1000 * 60); - Verifier verifier = newVerifier( aDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4368" ); - verifier.addCliArgument( "initialize" ); + Verifier verifier = newVerifier(aDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4368"); + verifier.addCliArgument("initialize"); verifier.execute(); verifier.verifyErrorFreeLog(); File installedArtifact = - new File( verifier.getArtifactPath( "org.apache.maven.its.mng4368", "test", "0.1-SNAPSHOT", "jar" ) ); + new File(verifier.getArtifactPath("org.apache.maven.its.mng4368", "test", "0.1-SNAPSHOT", "jar")); - String data = FileUtils.fileRead( installedArtifact, "UTF-8" ); - assertTrue( data.indexOf( "Branch-A" ) > 0 ); - assertFalse( data.contains( "Branch-B" ) ); + String data = FileUtils.fileRead(installedArtifact, "UTF-8"); + assertTrue(data.indexOf("Branch-A") > 0); + assertFalse(data.contains("Branch-B")); - assertEquals( aArtifact.length(), bArtifact.length() ); - assertTrue( aArtifact.lastModified() > bArtifact.lastModified() ); - assertTrue( installedArtifact.lastModified() > bArtifact.lastModified() ); + assertEquals(aArtifact.length(), bArtifact.length()); + assertTrue(aArtifact.lastModified() > bArtifact.lastModified()); + assertTrue(installedArtifact.lastModified() > bArtifact.lastModified()); - verifier = newVerifier( bDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "initialize" ); + verifier = newVerifier(bDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("initialize"); verifier.execute(); verifier.verifyErrorFreeLog(); - data = FileUtils.fileRead( installedArtifact, "UTF-8" ); - assertFalse( data.contains( "Branch-A" ) ); - assertTrue( data.indexOf( "Branch-B" ) > 0 ); + data = FileUtils.fileRead(installedArtifact, "UTF-8"); + assertFalse(data.contains("Branch-A")); + assertTrue(data.indexOf("Branch-B") > 0); long lastModified = installedArtifact.lastModified(); - FileUtils.fileWrite( installedArtifact.getPath(), "UTF-8", "from Branch-C" ); - installedArtifact.setLastModified( lastModified ); + FileUtils.fileWrite(installedArtifact.getPath(), "UTF-8", "from Branch-C"); + installedArtifact.setLastModified(lastModified); - verifier = newVerifier( bDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.setLogFileName( "log-b.txt" ); - verifier.addCliArgument( "initialize" ); + verifier = newVerifier(bDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.setLogFileName("log-b.txt"); + verifier.addCliArgument("initialize"); verifier.execute(); verifier.verifyErrorFreeLog(); - data = FileUtils.fileRead( installedArtifact, "UTF-8" ); - assertFalse( data.contains( "Branch-B" ) ); - assertTrue( data.indexOf( "Branch-C" ) > 0 ); + data = FileUtils.fileRead(installedArtifact, "UTF-8"); + assertFalse(data.contains("Branch-B")); + assertTrue(data.indexOf("Branch-C") > 0); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4379TransitiveSystemPathInterpolatedWithEnvVarTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4379TransitiveSystemPathInterpolatedWithEnvVarTest.java index 5420777181..733eeb80bf 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4379TransitiveSystemPathInterpolatedWithEnvVarTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4379TransitiveSystemPathInterpolatedWithEnvVarTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4379TransitiveSystemPathInterpolatedWithEnvVarTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4379TransitiveSystemPathInterpolatedWithEnvVarTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4379TransitiveSystemPathInterpolatedWithEnvVarTest() - { - super( "[2.0.3,2.1.0),[3.0-alpha-6,)" ); + public MavenITmng4379TransitiveSystemPathInterpolatedWithEnvVarTest() { + super("[2.0.3,2.1.0),[3.0-alpha-6,)"); } /** @@ -48,25 +43,22 @@ public class MavenITmng4379TransitiveSystemPathInterpolatedWithEnvVarTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4379" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4379"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4379" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.setEnvironmentVariable( "MNG_4379_HOME", testDir.getAbsolutePath() ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArguments( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4379"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.setEnvironmentVariable("MNG_4379_HOME", testDir.getAbsolutePath()); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArguments("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List classpath = verifier.loadLines( "target/classpath.txt", "UTF-8" ); - assertTrue( classpath.toString(), classpath.contains( "pom.xml" ) ); + List classpath = verifier.loadLines("target/classpath.txt", "UTF-8"); + assertTrue(classpath.toString(), classpath.contains("pom.xml")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4381ExtensionSingletonComponentTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4381ExtensionSingletonComponentTest.java index 824ff77cab..31144f85d1 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4381ExtensionSingletonComponentTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4381ExtensionSingletonComponentTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4381ExtensionSingletonComponentTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4381ExtensionSingletonComponentTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4381ExtensionSingletonComponentTest() - { - super( "[3.0-alpha-3,)" ); + public MavenITmng4381ExtensionSingletonComponentTest() { + super("[3.0-alpha-3,)"); } /** @@ -48,23 +43,20 @@ public class MavenITmng4381ExtensionSingletonComponentTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4381" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4381"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "sub-a/target" ); - verifier.deleteDirectory( "sub-b/target" ); - verifier.addCliArgument( "initialize" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("sub-a/target"); + verifier.deleteDirectory("sub-b/target"); + verifier.addCliArgument("initialize"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "sub-b/target/singleton.properties" ); - assertEquals( "called", props.getProperty( "sub-a-provider" ) ); - assertEquals( "called", props.getProperty( "sub-a-consumer" ) ); - assertEquals( "called", props.getProperty( "sub-b-provider" ) ); + Properties props = verifier.loadProperties("sub-b/target/singleton.properties"); + assertEquals("called", props.getProperty("sub-a-provider")); + assertEquals("called", props.getProperty("sub-a-consumer")); + assertEquals("called", props.getProperty("sub-b-provider")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4383ValidDependencyVersionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4383ValidDependencyVersionTest.java index bca79f2e3a..b697ad3fd5 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4383ValidDependencyVersionTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4383ValidDependencyVersionTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4383ValidDependencyVersionTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4383ValidDependencyVersionTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4383ValidDependencyVersionTest() - { - super( "[3.0-alpha-3,)" ); + public MavenITmng4383ValidDependencyVersionTest() { + super("[3.0-alpha-3,)"); } /** @@ -47,25 +42,19 @@ public class MavenITmng4383ValidDependencyVersionTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4383" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4383"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - try - { - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + try { + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - fail( "Invalid dependency version did not cause validation error" ); - } - catch ( VerificationException e ) - { + fail("Invalid dependency version did not cause validation error"); + } catch (VerificationException e) { // expected } } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4385LifecycleMappingFromExtensionInReactorTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4385LifecycleMappingFromExtensionInReactorTest.java index e939160ed2..1089773e5d 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4385LifecycleMappingFromExtensionInReactorTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4385LifecycleMappingFromExtensionInReactorTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4385LifecycleMappingFromExtensionInReactorTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4385LifecycleMappingFromExtensionInReactorTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4385LifecycleMappingFromExtensionInReactorTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng4385LifecycleMappingFromExtensionInReactorTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -48,28 +43,24 @@ public class MavenITmng4385LifecycleMappingFromExtensionInReactorTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4385" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4385"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - try - { - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + try { + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - fail( "Build leaked lifecycle mapping from extension of first project into second project!" ); - } - catch( VerificationException e ) - { + fail("Build leaked lifecycle mapping from extension of first project into second project!"); + } catch (VerificationException e) { // expected, should fail String msg = e.getMessage(); - assertTrue( "Failure should be due to unknown packaging", msg.contains( "Unknown packaging: it-packaging" )); - assertTrue( "Failure should be due to sub-b project", msg.contains( "The project org.apache.maven.its.mng4385:sub-b:0.1" )); + assertTrue("Failure should be due to unknown packaging", msg.contains("Unknown packaging: it-packaging")); + assertTrue( + "Failure should be due to sub-b project", + msg.contains("The project org.apache.maven.its.mng4385:sub-b:0.1")); } } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4386DebugLoggingTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4386DebugLoggingTest.java index af52d5ec6e..acdde6da2b 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4386DebugLoggingTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4386DebugLoggingTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4386DebugLoggingTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4386DebugLoggingTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4386DebugLoggingTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng4386DebugLoggingTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -47,33 +42,28 @@ public class MavenITmng4386DebugLoggingTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4386" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4386"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "-X" ); - verifier.setLogFileName( "log.txt" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("-X"); + verifier.setLogFileName("log.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List lines = verifier.loadLines( "log.txt", "UTF-8" ); + List lines = verifier.loadLines("log.txt", "UTF-8"); boolean debug = false; - for ( String line : lines ) - { - if ( line.startsWith( "[DEBUG" ) ) - { + for (String line : lines) { + if (line.startsWith("[DEBUG")) { debug = true; break; } } - assertTrue( lines.toString(), debug ); + assertTrue(lines.toString(), debug); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4387QuietLoggingTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4387QuietLoggingTest.java index 0cab01173b..dcedb6180d 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4387QuietLoggingTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4387QuietLoggingTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,15 +16,15 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Collections; import java.util.Iterator; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -34,13 +32,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4387QuietLoggingTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4387QuietLoggingTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4387QuietLoggingTest() - { - super( "[2.0.5,)" ); + public MavenITmng4387QuietLoggingTest() { + super("[2.0.5,)"); } /** @@ -49,31 +44,26 @@ public class MavenITmng4387QuietLoggingTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4387" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4387"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.addCliArgument( "-q" ); - verifier.setLogFileName( "log.txt" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.addCliArgument("-q"); + verifier.setLogFileName("log.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List lines = verifier.loadLines( "log.txt", "UTF-8" ); + List lines = verifier.loadLines("log.txt", "UTF-8"); - for ( Iterator it = lines.iterator(); it.hasNext(); ) - { + for (Iterator it = lines.iterator(); it.hasNext(); ) { String line = it.next(); - if ( line.startsWith( "+" ) || line.startsWith( "EMMA" ) ) - { + if (line.startsWith("+") || line.startsWith("EMMA")) { it.remove(); } } - assertEquals( Collections.EMPTY_LIST, lines ); + assertEquals(Collections.EMPTY_LIST, lines); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4393ParseExternalParenPomLenientTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4393ParseExternalParenPomLenientTest.java index 140f167ba5..d68acfef8a 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4393ParseExternalParenPomLenientTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4393ParseExternalParenPomLenientTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4393ParseExternalParenPomLenientTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4393ParseExternalParenPomLenientTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4393ParseExternalParenPomLenientTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng4393ParseExternalParenPomLenientTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -46,21 +41,18 @@ public class MavenITmng4393ParseExternalParenPomLenientTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4393" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4393"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4393" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4393"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4396AntBased20xMojoSupportTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4396AntBased20xMojoSupportTest.java index 8488127f15..4e8ee0661b 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4396AntBased20xMojoSupportTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4396AntBased20xMojoSupportTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4396AntBased20xMojoSupportTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4396AntBased20xMojoSupportTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4396AntBased20xMojoSupportTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng4396AntBased20xMojoSupportTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -47,19 +42,16 @@ public class MavenITmng4396AntBased20xMojoSupportTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4396" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4396"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/ant.txt" ); + verifier.verifyFilePresent("target/ant.txt"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4400RepositoryOrderTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4400RepositoryOrderTest.java index d26aa21ec6..4b7d26dd88 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4400RepositoryOrderTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4400RepositoryOrderTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4400RepositoryOrderTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4400RepositoryOrderTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4400RepositoryOrderTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng4400RepositoryOrderTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -47,23 +42,21 @@ public class MavenITmng4400RepositoryOrderTest * @throws Exception in case of failure */ @Test - public void testitSettingsRepos() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4400" ); + public void testitSettingsRepos() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4400"); - Verifier verifier = newVerifier( new File( testDir, "settings" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4400" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(new File(testDir, "settings").getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng4400"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties checksums = verifier.loadProperties( "target/checksum.properties" ); - assertChecksum( "d0a4998ff37a55f8de1dffccdff826eca365400f", checksums ); + Properties checksums = verifier.loadProperties("target/checksum.properties"); + assertChecksum("d0a4998ff37a55f8de1dffccdff826eca365400f", checksums); } /** @@ -72,28 +65,24 @@ public class MavenITmng4400RepositoryOrderTest * @throws Exception in case of failure */ @Test - public void testitPomRepos() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4400" ); + public void testitPomRepos() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4400"); - Verifier verifier = newVerifier( new File( testDir, "pom" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4400" ); - verifier.filterFile( "pom-template.xml", "pom.xml", "UTF-8" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(new File(testDir, "pom").getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng4400"); + verifier.filterFile("pom-template.xml", "pom.xml", "UTF-8"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties checksums = verifier.loadProperties( "target/checksum.properties" ); - assertChecksum( "d0a4998ff37a55f8de1dffccdff826eca365400f", checksums ); + Properties checksums = verifier.loadProperties("target/checksum.properties"); + assertChecksum("d0a4998ff37a55f8de1dffccdff826eca365400f", checksums); } - private void assertChecksum( String checksum, Properties checksums ) - { - assertEquals( checksum, checksums.getProperty( "dep-0.1.jar" ).toLowerCase( java.util.Locale.ENGLISH ) ); + private void assertChecksum(String checksum, Properties checksums) { + assertEquals(checksum, checksums.getProperty("dep-0.1.jar").toLowerCase(java.util.Locale.ENGLISH)); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4401RepositoryOrderForParentPomTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4401RepositoryOrderForParentPomTest.java index 91db8fe093..751fc3d8ec 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4401RepositoryOrderForParentPomTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4401RepositoryOrderForParentPomTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4401RepositoryOrderForParentPomTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4401RepositoryOrderForParentPomTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4401RepositoryOrderForParentPomTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng4401RepositoryOrderForParentPomTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -47,24 +42,21 @@ public class MavenITmng4401RepositoryOrderForParentPomTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4401" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4401"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4401" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4401"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/passed.txt" ); - verifier.verifyFileNotPresent( "target/failed.txt" ); + verifier.verifyFilePresent("target/passed.txt"); + verifier.verifyFileNotPresent("target/failed.txt"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4402DuplicateChildModuleTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4402DuplicateChildModuleTest.java index 4ba30f2cb9..c24130de0f 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4402DuplicateChildModuleTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4402DuplicateChildModuleTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4402DuplicateChildModuleTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4402DuplicateChildModuleTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4402DuplicateChildModuleTest() - { - super( "[3.0-alpha-3,)" ); + public MavenITmng4402DuplicateChildModuleTest() { + super("[3.0-alpha-3,)"); } /** @@ -47,26 +42,20 @@ public class MavenITmng4402DuplicateChildModuleTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4402" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4402"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "-N" ); - try - { - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("-N"); + try { + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - fail( "Duplicate child module did not cause validation error" ); - } - catch ( VerificationException e ) - { + fail("Duplicate child module did not cause validation error"); + } catch (VerificationException e) { // expected } } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4403LenientDependencyPomParsingTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4403LenientDependencyPomParsingTest.java index 2b03494694..bafcb74400 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4403LenientDependencyPomParsingTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4403LenientDependencyPomParsingTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,15 +16,15 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -34,13 +32,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4403LenientDependencyPomParsingTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4403LenientDependencyPomParsingTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4403LenientDependencyPomParsingTest() - { - super( "[2.0.3,3.0-alpha-1),[3.0-beta-2,)" ); + public MavenITmng4403LenientDependencyPomParsingTest() { + super("[2.0.3,3.0-alpha-1),[3.0-beta-2,)"); } /** @@ -51,31 +46,28 @@ public class MavenITmng4403LenientDependencyPomParsingTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4403" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4403"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4403" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4403"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List artifacts = verifier.loadLines( "target/artifacts.txt", "UTF-8" ); - Collections.sort( artifacts ); + List artifacts = verifier.loadLines("target/artifacts.txt", "UTF-8"); + Collections.sort(artifacts); List expected = new ArrayList<>(); - expected.add( "org.apache.maven.its.mng4403:a:jar:0.1" ); - expected.add( "org.apache.maven.its.mng4403:b:jar:0.1" ); - expected.add( "org.apache.maven.its.mng4403:c:jar:0.1" ); + expected.add("org.apache.maven.its.mng4403:a:jar:0.1"); + expected.add("org.apache.maven.its.mng4403:b:jar:0.1"); + expected.add("org.apache.maven.its.mng4403:c:jar:0.1"); - assertEquals( expected, artifacts ); + assertEquals(expected, artifacts); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4404UniqueProfileIdTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4404UniqueProfileIdTest.java index e684f953d9..246e21744a 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4404UniqueProfileIdTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4404UniqueProfileIdTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4404UniqueProfileIdTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4404UniqueProfileIdTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4404UniqueProfileIdTest() - { - super( "[3.0-alpha-3,)" ); + public MavenITmng4404UniqueProfileIdTest() { + super("[3.0-alpha-3,)"); } /** @@ -47,25 +42,19 @@ public class MavenITmng4404UniqueProfileIdTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4404" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4404"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - try - { - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + try { + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - fail( "Duplicate profile id did not cause validation error" ); - } - catch ( VerificationException e ) - { + fail("Duplicate profile id did not cause validation error"); + } catch (VerificationException e) { // expected } } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4405ValidPluginVersionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4405ValidPluginVersionTest.java index 8925bf1a6c..7470977e7b 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4405ValidPluginVersionTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4405ValidPluginVersionTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4405ValidPluginVersionTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4405ValidPluginVersionTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4405ValidPluginVersionTest() - { - super( "[3.0-alpha-3,)" ); + public MavenITmng4405ValidPluginVersionTest() { + super("[3.0-alpha-3,)"); } /** @@ -47,25 +42,19 @@ public class MavenITmng4405ValidPluginVersionTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4405" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4405"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - try - { - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + try { + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - fail( "Invalid plugin version did not cause validation error" ); - } - catch ( VerificationException e ) - { + fail("Invalid plugin version did not cause validation error"); + } catch (VerificationException e) { // expected } } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4408NonExistentSettingsFileTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4408NonExistentSettingsFileTest.java index a8b133d82d..450ae9cdeb 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4408NonExistentSettingsFileTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4408NonExistentSettingsFileTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4408NonExistentSettingsFileTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4408NonExistentSettingsFileTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4408NonExistentSettingsFileTest() - { - super( "[3.0-alpha-3,)" ); + public MavenITmng4408NonExistentSettingsFileTest() { + super("[3.0-alpha-3,)"); } /** @@ -47,25 +42,20 @@ public class MavenITmng4408NonExistentSettingsFileTest * @throws Exception in case of failure */ @Test - public void testitUserSettings() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4408" ); + public void testitUserSettings() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4408"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.setLogFileName( "log-user.txt" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "non-existing-settings.xml" ); - try - { - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.setLogFileName("log-user.txt"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("non-existing-settings.xml"); + try { + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - fail( "Missing settings file did not cause build error" ); - } - catch ( VerificationException e ) - { + fail("Missing settings file did not cause build error"); + } catch (VerificationException e) { // expected } } @@ -76,27 +66,21 @@ public class MavenITmng4408NonExistentSettingsFileTest * @throws Exception in case of failure */ @Test - public void testitGlobalSettings() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4408" ); + public void testitGlobalSettings() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4408"); - Verifier verifier = new Verifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.setLogFileName( "log-global.txt" ); - verifier.addCliArgument( "--global-settings" ); - verifier.addCliArgument( "non-existing-settings.xml" ); - try - { - verifier.addCliArgument( "validate" ); + Verifier verifier = new Verifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.setLogFileName("log-global.txt"); + verifier.addCliArgument("--global-settings"); + verifier.addCliArgument("non-existing-settings.xml"); + try { + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - fail( "Missing settings file did not cause build error" ); - } - catch ( VerificationException e ) - { + fail("Missing settings file did not cause build error"); + } catch (VerificationException e) { // expected } } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4410UsageHelpTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4410UsageHelpTest.java index cd5da1b304..a583088f09 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4410UsageHelpTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4410UsageHelpTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4410UsageHelpTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4410UsageHelpTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4410UsageHelpTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng4410UsageHelpTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -46,20 +41,17 @@ public class MavenITmng4410UsageHelpTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4410" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4410"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.addCliArgument( "--help" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.addCliArgument("--help"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyTextInLog( "--version" ); - verifier.verifyTextInLog( "--debug" ); - verifier.verifyTextInLog( "--batch-mode" ); + verifier.verifyTextInLog("--version"); + verifier.verifyTextInLog("--debug"); + verifier.verifyTextInLog("--batch-mode"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4411VersionInfoTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4411VersionInfoTest.java index 571a8edb02..202605539e 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4411VersionInfoTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4411VersionInfoTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4411VersionInfoTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4411VersionInfoTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4411VersionInfoTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng4411VersionInfoTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -46,18 +41,15 @@ public class MavenITmng4411VersionInfoTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4411" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4411"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.addCliArgument( "--version" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.addCliArgument("--version"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyTextInLog( "Maven" ); + verifier.verifyTextInLog("Maven"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4412OfflineModeInPluginTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4412OfflineModeInPluginTest.java index 44720c0355..ba09fe6eb5 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4412OfflineModeInPluginTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4412OfflineModeInPluginTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4412OfflineModeInPluginTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4412OfflineModeInPluginTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4412OfflineModeInPluginTest() - { - super( "[2.0,3.0-alpha-1),[3.0-alpha-4,)" ); + public MavenITmng4412OfflineModeInPluginTest() { + super("[2.0,3.0-alpha-1),[3.0-alpha-4,)"); } /** @@ -48,30 +43,25 @@ public class MavenITmng4412OfflineModeInPluginTest * @throws Exception in case of failure */ @Test - public void testitResolver() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4412" ); + public void testitResolver() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4412"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4412" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "-Presolver" ); - verifier.addCliArgument( "--offline" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.setLogFileName( "log-resolver.txt" ); - try - { - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4412"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("-Presolver"); + verifier.addCliArgument("--offline"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.setLogFileName("log-resolver.txt"); + try { + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - fail( "Plugin could resolve artifact from remote repository despite Maven being offline" ); - } - catch ( VerificationException e ) - { + fail("Plugin could resolve artifact from remote repository despite Maven being offline"); + } catch (VerificationException e) { // expected } } @@ -83,26 +73,23 @@ public class MavenITmng4412OfflineModeInPluginTest * @throws Exception in case of failure */ @Test - public void testitCollector() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4412" ); + public void testitCollector() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4412"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4412" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "-Pcollector" ); - verifier.addCliArgument( "--offline" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.setLogFileName( "log-collector.txt" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4412"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("-Pcollector"); + verifier.addCliArgument("--offline"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.setLogFileName("log-collector.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyArtifactNotPresent( "org.apache.maven.its.mng4412", "dep", "0.1", "pom" ); + verifier.verifyArtifactNotPresent("org.apache.maven.its.mng4412", "dep", "0.1", "pom"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4413MirroringOfDependencyRepoTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4413MirroringOfDependencyRepoTest.java index a2048fc586..00e36f68e2 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4413MirroringOfDependencyRepoTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4413MirroringOfDependencyRepoTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Map; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.eclipse.jetty.security.ConstraintMapping; import org.eclipse.jetty.security.ConstraintSecurityHandler; import org.eclipse.jetty.security.HashLoginService; @@ -45,13 +43,10 @@ import static org.eclipse.jetty.util.security.Constraint.__BASIC_AUTH; * * @author Benjamin Bentmann */ -public class MavenITmng4413MirroringOfDependencyRepoTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4413MirroringOfDependencyRepoTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4413MirroringOfDependencyRepoTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng4413MirroringOfDependencyRepoTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -61,67 +56,61 @@ public class MavenITmng4413MirroringOfDependencyRepoTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4413" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4413"); Constraint constraint = new Constraint(); - constraint.setName( Constraint.__BASIC_AUTH ); - constraint.setRoles( new String[] { "user" } ); - constraint.setAuthenticate( true ); + constraint.setName(Constraint.__BASIC_AUTH); + constraint.setRoles(new String[] {"user"}); + constraint.setAuthenticate(true); ConstraintMapping constraintMapping = new ConstraintMapping(); - constraintMapping.setConstraint( constraint ); - constraintMapping.setPathSpec( "/*" ); + constraintMapping.setConstraint(constraint); + constraintMapping.setPathSpec("/*"); - HashLoginService userRealm = new HashLoginService( "TestRealm" ); + HashLoginService userRealm = new HashLoginService("TestRealm"); UserStore userStore = new UserStore(); - userStore.addUser( "testuser", new Password( "testtest" ), new String[] { "user" } ); - userRealm.setUserStore( userStore ); + userStore.addUser("testuser", new Password("testtest"), new String[] {"user"}); + userRealm.setUserStore(userStore); - Server server = new Server( 0 ); + Server server = new Server(0); ConstraintSecurityHandler securityHandler = new ConstraintSecurityHandler(); - securityHandler.setLoginService( userRealm ); - securityHandler.setAuthMethod( __BASIC_AUTH ); - securityHandler.setConstraintMappings( new ConstraintMapping[] { constraintMapping } ); + securityHandler.setLoginService(userRealm); + securityHandler.setAuthMethod(__BASIC_AUTH); + securityHandler.setConstraintMappings(new ConstraintMapping[] {constraintMapping}); ResourceHandler repoHandler = new ResourceHandler(); - repoHandler.setResourceBase( new File( testDir, "repo-a" ).getAbsolutePath() ); + repoHandler.setResourceBase(new File(testDir, "repo-a").getAbsolutePath()); HandlerList handlerList = new HandlerList(); - handlerList.addHandler( securityHandler ); - handlerList.addHandler( repoHandler ); - handlerList.addHandler( new DefaultHandler() ); + handlerList.addHandler(securityHandler); + handlerList.addHandler(repoHandler); + handlerList.addHandler(new DefaultHandler()); - server.setHandler( handlerList ); + server.setHandler(handlerList); - try - { + try { server.start(); - if ( server.isFailed() ) - { - fail( "Couldn't bind the server socket to a free port!" ); + if (server.isFailed()) { + fail("Couldn't bind the server socket to a free port!"); } - int port = ( (NetworkConnector) server.getConnectors()[0] ).getLocalPort(); - System.out.println( "Bound server socket to the port " + port ); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4413" ); + int port = ((NetworkConnector) server.getConnectors()[0]).getLocalPort(); + System.out.println("Bound server socket to the port " + port); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4413"); Map filterProps = verifier.newDefaultFilterMap(); - filterProps.put( "@port@", Integer.toString( port ) ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + filterProps.put("@port@", Integer.toString(port)); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8", filterProps); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng4413", "a", "0.1", "jar" ); - } - finally - { + verifier.verifyArtifactPresent("org.apache.maven.its.mng4413", "a", "0.1", "jar"); + } finally { server.stop(); server.join(); } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4415InheritedPluginOrderTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4415InheritedPluginOrderTest.java index ba595f31e0..626c1f3cfc 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4415InheritedPluginOrderTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4415InheritedPluginOrderTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,15 +16,15 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.ArrayList; import java.util.List; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -34,13 +32,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4415InheritedPluginOrderTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4415InheritedPluginOrderTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4415InheritedPluginOrderTest() - { - super( "[2.0.5,)" ); + public MavenITmng4415InheritedPluginOrderTest() { + super("[2.0.5,)"); } /** @@ -52,42 +47,38 @@ public class MavenITmng4415InheritedPluginOrderTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4415" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4415"); - Verifier verifier = newVerifier( new File( testDir, "sub" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(new File(testDir, "sub").getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/it.properties" ); - assertNotNull( props.getProperty( "project.build.plugins" ) ); + Properties props = verifier.loadProperties("target/it.properties"); + assertNotNull(props.getProperty("project.build.plugins")); List expected = new ArrayList<>(); - expected.add( "maven-it-plugin-error" ); - expected.add( "maven-it-plugin-configuration" ); - expected.add( "maven-it-plugin-dependency-resolution" ); - expected.add( "maven-it-plugin-packaging" ); - expected.add( "maven-it-plugin-log-file" ); - expected.add( "maven-it-plugin-expression" ); - expected.add( "maven-it-plugin-fork" ); - expected.add( "maven-it-plugin-touch" ); + expected.add("maven-it-plugin-error"); + expected.add("maven-it-plugin-configuration"); + expected.add("maven-it-plugin-dependency-resolution"); + expected.add("maven-it-plugin-packaging"); + expected.add("maven-it-plugin-log-file"); + expected.add("maven-it-plugin-expression"); + expected.add("maven-it-plugin-fork"); + expected.add("maven-it-plugin-touch"); List actual = new ArrayList<>(); - int count = Integer.parseInt( props.getProperty( "project.build.plugins" ) ); - for ( int i = 0; i < count; i++ ) - { - actual.add( props.getProperty( "project.build.plugins." + i + ".artifactId" ) ); + int count = Integer.parseInt(props.getProperty("project.build.plugins")); + for (int i = 0; i < count; i++) { + actual.add(props.getProperty("project.build.plugins." + i + ".artifactId")); } - actual.retainAll( expected ); + actual.retainAll(expected); - assertEquals( actual, expected ); + assertEquals(actual, expected); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4416PluginOrderAfterProfileInjectionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4416PluginOrderAfterProfileInjectionTest.java index a129f8dca6..32f1b0df7b 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4416PluginOrderAfterProfileInjectionTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4416PluginOrderAfterProfileInjectionTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,15 +16,15 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.ArrayList; import java.util.List; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -34,13 +32,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4416PluginOrderAfterProfileInjectionTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4416PluginOrderAfterProfileInjectionTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4416PluginOrderAfterProfileInjectionTest() - { - super( "[2.0.5,)" ); + public MavenITmng4416PluginOrderAfterProfileInjectionTest() { + super("[2.0.5,)"); } /** @@ -52,42 +47,38 @@ public class MavenITmng4416PluginOrderAfterProfileInjectionTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4416" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4416"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/it.properties" ); - assertNotNull( props.getProperty( "project.build.plugins" ) ); + Properties props = verifier.loadProperties("target/it.properties"); + assertNotNull(props.getProperty("project.build.plugins")); List expected = new ArrayList<>(); - expected.add( "maven-it-plugin-error" ); - expected.add( "maven-it-plugin-configuration" ); - expected.add( "maven-it-plugin-dependency-resolution" ); - expected.add( "maven-it-plugin-packaging" ); - expected.add( "maven-it-plugin-log-file" ); - expected.add( "maven-it-plugin-expression" ); - expected.add( "maven-it-plugin-fork" ); - expected.add( "maven-it-plugin-touch" ); + expected.add("maven-it-plugin-error"); + expected.add("maven-it-plugin-configuration"); + expected.add("maven-it-plugin-dependency-resolution"); + expected.add("maven-it-plugin-packaging"); + expected.add("maven-it-plugin-log-file"); + expected.add("maven-it-plugin-expression"); + expected.add("maven-it-plugin-fork"); + expected.add("maven-it-plugin-touch"); List actual = new ArrayList<>(); - int count = Integer.parseInt( props.getProperty( "project.build.plugins" ) ); - for ( int i = 0; i < count; i++ ) - { - actual.add( props.getProperty( "project.build.plugins." + i + ".artifactId" ) ); + int count = Integer.parseInt(props.getProperty("project.build.plugins")); + for (int i = 0; i < count; i++) { + actual.add(props.getProperty("project.build.plugins." + i + ".artifactId")); } - actual.retainAll( expected ); + actual.retainAll(expected); - assertEquals( actual, expected ); + assertEquals(actual, expected); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4421DeprecatedPomInterpolationExpressionsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4421DeprecatedPomInterpolationExpressionsTest.java index e3fb01da97..9248b3cb14 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4421DeprecatedPomInterpolationExpressionsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4421DeprecatedPomInterpolationExpressionsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -37,13 +35,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4421DeprecatedPomInterpolationExpressionsTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4421DeprecatedPomInterpolationExpressionsTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4421DeprecatedPomInterpolationExpressionsTest() - { - super( "[3.0-alpha-3,4.0.0-alpha-1)" ); + public MavenITmng4421DeprecatedPomInterpolationExpressionsTest() { + super("[3.0-alpha-3,4.0.0-alpha-1)"); } /** @@ -52,44 +47,37 @@ public class MavenITmng4421DeprecatedPomInterpolationExpressionsTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4421" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4421"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/pom.properties" ); - assertEquals( "0.1", props.getProperty( "project.properties.property1" ) ); - assertEquals( "0.1", props.getProperty( "project.properties.property2" ) ); + Properties props = verifier.loadProperties("target/pom.properties"); + assertEquals("0.1", props.getProperty("project.properties.property1")); + assertEquals("0.1", props.getProperty("project.properties.property2")); - List lines = verifier.loadLines( "log.txt", null ); + List lines = verifier.loadLines("log.txt", null); boolean warnedPomPrefix = false; boolean warnedEmptyPrefix = false; - for ( String line : lines ) - { - if ( line.startsWith( "[WARN" ) ) - { - if ( line.contains( "${pom.version}" ) ) - { + for (String line : lines) { + if (line.startsWith("[WARN")) { + if (line.contains("${pom.version}")) { warnedPomPrefix = true; } - if ( line.contains( "${version}" ) ) - { + if (line.contains("${version}")) { warnedEmptyPrefix = true; } } } - assertTrue( warnedPomPrefix ); - assertTrue( warnedEmptyPrefix ); + assertTrue(warnedPomPrefix); + assertTrue(warnedEmptyPrefix); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4422PluginExecutionPhaseInterpolationTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4422PluginExecutionPhaseInterpolationTest.java index 40c98c80e9..805e6b6b7e 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4422PluginExecutionPhaseInterpolationTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4422PluginExecutionPhaseInterpolationTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4422PluginExecutionPhaseInterpolationTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4422PluginExecutionPhaseInterpolationTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4422PluginExecutionPhaseInterpolationTest() - { - super( "[2.0,2.1.0),[2.2.2,)" ); + public MavenITmng4422PluginExecutionPhaseInterpolationTest() { + super("[2.0,2.1.0),[2.2.2,)"); } /** @@ -46,19 +41,16 @@ public class MavenITmng4422PluginExecutionPhaseInterpolationTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4422" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4422"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/touch.txt" ); + verifier.verifyFilePresent("target/touch.txt"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4423SessionDataFromPluginParameterExpressionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4423SessionDataFromPluginParameterExpressionTest.java index 1eb369b14e..c2f018fc7b 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4423SessionDataFromPluginParameterExpressionTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4423SessionDataFromPluginParameterExpressionTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4423SessionDataFromPluginParameterExpressionTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4423SessionDataFromPluginParameterExpressionTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4423SessionDataFromPluginParameterExpressionTest() - { - super( "[3.0-alpha-3,)" ); + public MavenITmng4423SessionDataFromPluginParameterExpressionTest() { + super("[3.0-alpha-3,)"); } /** @@ -47,22 +42,19 @@ public class MavenITmng4423SessionDataFromPluginParameterExpressionTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4423" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4423"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.getSystemProperties().setProperty( "mng4423", "PASSED" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.getSystemProperties().setProperty("mng4423", "PASSED"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/config.properties" ); - assertEquals( "PASSED", props.getProperty( "propertiesParam.mng4423" ) ); - assertNotNull( props.getProperty( "propertiesParam.java.home" ) ); + Properties props = verifier.loadProperties("target/config.properties"); + assertEquals("PASSED", props.getProperty("propertiesParam.mng4423")); + assertNotNull(props.getProperty("propertiesParam.java.home")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4428FollowHttpRedirectTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4428FollowHttpRedirectTest.java index 84f049000e..ea36daf043 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4428FollowHttpRedirectTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4428FollowHttpRedirectTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,9 +16,7 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -30,8 +26,9 @@ import java.io.IOException; import java.io.PrintWriter; import java.util.List; import java.util.Map; -import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.HttpConfiguration; import org.eclipse.jetty.server.HttpConnectionFactory; @@ -53,13 +50,10 @@ import static org.eclipse.jetty.http.HttpVersion.HTTP_1_1; * @author Benjamin Bentmann * */ -public class MavenITmng4428FollowHttpRedirectTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4428FollowHttpRedirectTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4428FollowHttpRedirectTest() - { - super( "[2.0.3,3.0-alpha-1),(3.0-alpha-1,)" ); + public MavenITmng4428FollowHttpRedirectTest() { + super("[2.0.3,3.0-alpha-1),(3.0-alpha-1,)"); } /** @@ -68,10 +62,8 @@ public class MavenITmng4428FollowHttpRedirectTest * @throws Exception in case of failure */ @Test - public void testitHttpToHttp() - throws Exception - { - testit( true, true ); + public void testitHttpToHttp() throws Exception { + testit(true, true); } /** @@ -80,10 +72,8 @@ public class MavenITmng4428FollowHttpRedirectTest * @throws Exception in case of failure */ @Test - public void testitHttpsToHttps() - throws Exception - { - testit( false, false ); + public void testitHttpsToHttps() throws Exception { + testit(false, false); } /** @@ -93,148 +83,125 @@ public class MavenITmng4428FollowHttpRedirectTest * @throws Exception in case of failure */ @Test - public void testitRelativeLocation() - throws Exception - { - testit( true, true, true ); + public void testitRelativeLocation() throws Exception { + testit(true, true, true); } - private void testit( boolean fromHttp, boolean toHttp ) - throws Exception - { - testit( fromHttp, toHttp, false ); + private void testit(boolean fromHttp, boolean toHttp) throws Exception { + testit(fromHttp, toHttp, false); } - private void testit( boolean fromHttp, boolean toHttp, boolean relativeLocation ) - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4428" ); + private void testit(boolean fromHttp, boolean toHttp, boolean relativeLocation) throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4428"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); // NOTE: trust store cannot be reliably configured for the current JVM - verifier.setForkJvm( true ); + verifier.setForkJvm(true); // keytool -genkey -alias localhost -keypass key-passwd -keystore keystore -storepass store-passwd \ // -validity 4096 -dname "cn=localhost, ou=None, L=Seattle, ST=Washington, o=ExampleOrg, c=US" -keyalg RSA - String storePath = new File( testDir, "keystore" ).getAbsolutePath(); + String storePath = new File(testDir, "keystore").getAbsolutePath(); String storePwd = "store-passwd"; String keyPwd = "key-passwd"; - Server server = new Server( 0 ); - addHttpsConnector( server, storePath, storePwd, keyPwd ); - Connector from = server.getConnectors()[ fromHttp ? 0 : 1 ]; - Connector to = server.getConnectors()[ toHttp ? 0 : 1 ]; + Server server = new Server(0); + addHttpsConnector(server, storePath, storePwd, keyPwd); + Connector from = server.getConnectors()[fromHttp ? 0 : 1]; + Connector to = server.getConnectors()[toHttp ? 0 : 1]; server.setHandler( - new RedirectHandler( toHttp ? "http" : "https", relativeLocation ? null : (NetworkConnector) to ) ); + new RedirectHandler(toHttp ? "http" : "https", relativeLocation ? null : (NetworkConnector) to)); - try - { + try { server.start(); - if ( server.isFailed() ) - { - fail( "Couldn't bind the server socket to a free port!" ); + if (server.isFailed()) { + fail("Couldn't bind the server socket to a free port!"); } - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4428" ); - verifier.deleteDirectory( "target" ); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng4428"); + verifier.deleteDirectory("target"); Map filterProps = verifier.newDefaultFilterMap(); - filterProps.put( "@protocol@", fromHttp ? "http" : "https" ); - filterProps.put( "@port@", Integer.toString( ( (NetworkConnector) from ).getLocalPort() ) ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps ); - verifier.addCliArgument( "-X" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.setEnvironmentVariable( "MAVEN_OPTS", "-Djavax.net.ssl.trustStore=" + storePath + " -Djavax.net.ssl.trustStorePassword=" + storePwd ); - verifier.setLogFileName( "log-" + getName().substring( 6 ) + ".txt" ); - verifier.addCliArgument( "validate" ); + filterProps.put("@protocol@", fromHttp ? "http" : "https"); + filterProps.put("@port@", Integer.toString(((NetworkConnector) from).getLocalPort())); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8", filterProps); + verifier.addCliArgument("-X"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.setEnvironmentVariable( + "MAVEN_OPTS", + "-Djavax.net.ssl.trustStore=" + storePath + " -Djavax.net.ssl.trustStorePassword=" + storePwd); + verifier.setLogFileName("log-" + getName().substring(6) + ".txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - } - finally - { + } finally { server.stop(); server.join(); } - List cp = verifier.loadLines( "target/classpath.txt", "UTF-8" ); - assertTrue( cp.toString(), cp.contains( "dep-0.1.jar" ) ); + List cp = verifier.loadLines("target/classpath.txt", "UTF-8"); + assertTrue(cp.toString(), cp.contains("dep-0.1.jar")); } - private void addHttpsConnector( Server server, String keyStorePath, String keyStorePassword, String keyPassword ) - { - SslContextFactory sslContextFactory = new SslContextFactory( keyStorePath ); - sslContextFactory.setKeyStorePassword( keyStorePassword ); - sslContextFactory.setKeyManagerPassword( keyPassword ); + private void addHttpsConnector(Server server, String keyStorePath, String keyStorePassword, String keyPassword) { + SslContextFactory sslContextFactory = new SslContextFactory(keyStorePath); + sslContextFactory.setKeyStorePassword(keyStorePassword); + sslContextFactory.setKeyManagerPassword(keyPassword); HttpConfiguration httpConfiguration = new HttpConfiguration(); - httpConfiguration.setSecureScheme( "https" ); - HttpConfiguration httpsConfiguration = new HttpConfiguration( httpConfiguration ); - httpsConfiguration.addCustomizer( new SecureRequestCustomizer() ); - ServerConnector httpsConnector = new ServerConnector( server, - new SslConnectionFactory( sslContextFactory, HTTP_1_1.asString() ), - new HttpConnectionFactory( httpsConfiguration ) ); - server.addConnector( httpsConnector ); + httpConfiguration.setSecureScheme("https"); + HttpConfiguration httpsConfiguration = new HttpConfiguration(httpConfiguration); + httpsConfiguration.addCustomizer(new SecureRequestCustomizer()); + ServerConnector httpsConnector = new ServerConnector( + server, + new SslConnectionFactory(sslContextFactory, HTTP_1_1.asString()), + new HttpConnectionFactory(httpsConfiguration)); + server.addConnector(httpsConnector); } - static class RedirectHandler extends AbstractHandler - { + static class RedirectHandler extends AbstractHandler { private final String protocol; private final NetworkConnector connector; - RedirectHandler( String protocol, NetworkConnector connector ) - { + RedirectHandler(String protocol, NetworkConnector connector) { this.protocol = protocol; this.connector = connector; } - public void handle( String target, Request baseRequest, HttpServletRequest request, - HttpServletResponse response ) - throws IOException - { - System.out.println( "Handling " + request.getMethod() + " " + request.getRequestURL() ); + public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) + throws IOException { + System.out.println("Handling " + request.getMethod() + " " + request.getRequestURL()); PrintWriter writer = response.getWriter(); String uri = request.getRequestURI(); - if ( uri.startsWith( "/repo/" ) ) - { - String location = "/redirected/" + uri.substring( 6 ); - if ( protocol != null && connector != null ) - { + if (uri.startsWith("/repo/")) { + String location = "/redirected/" + uri.substring(6); + if (protocol != null && connector != null) { location = protocol + "://localhost:" + connector.getLocalPort() + location; } - if ( uri.endsWith( ".pom" ) ) - { - response.setStatus( HttpServletResponse.SC_MOVED_TEMPORARILY ); + if (uri.endsWith(".pom")) { + response.setStatus(HttpServletResponse.SC_MOVED_TEMPORARILY); + } else { + response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY); } - else - { - response.setStatus( HttpServletResponse.SC_MOVED_PERMANENTLY ); - } - response.setHeader( "Location", location ); - } - else if ( uri.endsWith( ".pom" ) ) - { - writer.println( "" ); - writer.println( " 4.0.0" ); - writer.println( " org.apache.maven.its.mng4428" ); - writer.println( " dep" ); - writer.println( " 0.1" ); - writer.println( "" ); - response.setStatus( HttpServletResponse.SC_OK ); - } - else if ( uri.endsWith( ".jar" ) ) - { - writer.println( "empty" ); - response.setStatus( HttpServletResponse.SC_OK ); - } - else - { - response.setStatus( HttpServletResponse.SC_NOT_FOUND ); + response.setHeader("Location", location); + } else if (uri.endsWith(".pom")) { + writer.println(""); + writer.println(" 4.0.0"); + writer.println(" org.apache.maven.its.mng4428"); + writer.println(" dep"); + writer.println(" 0.1"); + writer.println(""); + response.setStatus(HttpServletResponse.SC_OK); + } else if (uri.endsWith(".jar")) { + writer.println("empty"); + response.setStatus(HttpServletResponse.SC_OK); + } else { + response.setStatus(HttpServletResponse.SC_NOT_FOUND); } - ( (Request) request ).setHandled( true ); + ((Request) request).setHandled(true); } } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4429CompRequirementOnNonDefaultImplTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4429CompRequirementOnNonDefaultImplTest.java index f15b5f72b4..09a94107c0 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4429CompRequirementOnNonDefaultImplTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4429CompRequirementOnNonDefaultImplTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4429CompRequirementOnNonDefaultImplTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4429CompRequirementOnNonDefaultImplTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4429CompRequirementOnNonDefaultImplTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng4429CompRequirementOnNonDefaultImplTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -47,20 +42,17 @@ public class MavenITmng4429CompRequirementOnNonDefaultImplTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4429" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4429"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/comp.properties" ); - assertEquals( "concrete", props.getProperty( "id" ) ); + Properties props = verifier.loadProperties("target/comp.properties"); + assertEquals("concrete", props.getProperty("id")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4430DistributionManagementStatusTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4430DistributionManagementStatusTest.java index 3152f87cbc..29efcd5dff 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4430DistributionManagementStatusTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4430DistributionManagementStatusTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4430DistributionManagementStatusTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4430DistributionManagementStatusTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4430DistributionManagementStatusTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng4430DistributionManagementStatusTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -48,25 +43,19 @@ public class MavenITmng4430DistributionManagementStatusTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4430" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4430"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - try - { - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + try { + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - fail( "Distribution management status did not cause validation error" ); - } - catch ( VerificationException e ) - { + fail("Distribution management status did not cause validation error"); + } catch (VerificationException e) { // expected } } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4433ForceParentSnapshotUpdateTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4433ForceParentSnapshotUpdateTest.java index fccf456e77..6d64a57e6f 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4433ForceParentSnapshotUpdateTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4433ForceParentSnapshotUpdateTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Map; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4433ForceParentSnapshotUpdateTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4433ForceParentSnapshotUpdateTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4433ForceParentSnapshotUpdateTest() - { - super( "[2.0,3.0-alpha-1),[3.0-alpha-4,)" ); + public MavenITmng4433ForceParentSnapshotUpdateTest() { + super("[2.0,3.0-alpha-1),[3.0-alpha-4,)"); } /** @@ -47,42 +42,38 @@ public class MavenITmng4433ForceParentSnapshotUpdateTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4433" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4433"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4433" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng4433"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); Map filterProps = verifier.newDefaultFilterMap(); - filterProps.put( "@repo@", "repo-1" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps ); - verifier.setLogFileName( "log-force-1.txt" ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + filterProps.put("@repo@", "repo-1"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8", filterProps); + verifier.setLogFileName("log-force-1.txt"); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/old.txt" ); - verifier.verifyFileNotPresent( "target/new.txt" ); + verifier.verifyFilePresent("target/old.txt"); + verifier.verifyFileNotPresent("target/new.txt"); - filterProps.put( "@repo@", "repo-2" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps ); - verifier.setLogFileName( "log-force-2.txt" ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "-U" ); - verifier.addCliArgument( "validate" ); + filterProps.put("@repo@", "repo-2"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8", filterProps); + verifier.setLogFileName("log-force-2.txt"); + verifier.deleteDirectory("target"); + verifier.addCliArgument("-U"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - - verifier.verifyFileNotPresent( "target/old.txt" ); - verifier.verifyFilePresent( "target/new.txt" ); + verifier.verifyFileNotPresent("target/old.txt"); + verifier.verifyFilePresent("target/new.txt"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4436SingletonComponentLookupTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4436SingletonComponentLookupTest.java index eb4cb28455..c0fc80c97c 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4436SingletonComponentLookupTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4436SingletonComponentLookupTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4436SingletonComponentLookupTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4436SingletonComponentLookupTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4436SingletonComponentLookupTest() - { - super( "[3.0-alpha-4,)" ); + public MavenITmng4436SingletonComponentLookupTest() { + super("[3.0-alpha-4,)"); } /** @@ -47,25 +42,22 @@ public class MavenITmng4436SingletonComponentLookupTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4436" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4436"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/comp.properties" ); + Properties props = verifier.loadProperties("target/comp.properties"); - assertTrue( props.getProperty( "id.0", "" ).length() > 0 ); + assertTrue(props.getProperty("id.0", "").length() > 0); - assertEquals( props.getProperty( "id.0" ), props.getProperty( "id.1" ) ); - assertEquals( props.getProperty( "id.1" ), props.getProperty( "id.2" ) ); - assertEquals( props.getProperty( "id.2" ), props.getProperty( "id.3" ) ); + assertEquals(props.getProperty("id.0"), props.getProperty("id.1")); + assertEquals(props.getProperty("id.1"), props.getProperty("id.2")); + assertEquals(props.getProperty("id.2"), props.getProperty("id.3")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4450StubModelForMissingDependencyPomTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4450StubModelForMissingDependencyPomTest.java index 492b5a4b5f..60aa1db9cb 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4450StubModelForMissingDependencyPomTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4450StubModelForMissingDependencyPomTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4450StubModelForMissingDependencyPomTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4450StubModelForMissingDependencyPomTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4450StubModelForMissingDependencyPomTest() - { - super( "[2.0.3,3.0-alpha-1),[3.0-alpha-5,)" ); + public MavenITmng4450StubModelForMissingDependencyPomTest() { + super("[2.0.3,3.0-alpha-1),[3.0-alpha-5,)"); } /** @@ -47,28 +42,29 @@ public class MavenITmng4450StubModelForMissingDependencyPomTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4450" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4450"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4450" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4450"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/pom.properties" ); + Properties props = verifier.loadProperties("target/pom.properties"); // NOTE: Some Maven versions generate faulty packaging for the stub model (always "pom"), not our business here - assertEquals( "org.apache.maven.its.mng4450:missing:jar:0.1", - props.getProperty( "org.apache.maven.its.mng4450:missing:jar:0.1.project.id" ).replaceAll( "pom", "jar" ) ); - assertEquals( "org.apache.maven.its.mng4450:missing:jar:0.1", - props.getProperty( "org.apache.maven.its.mng4450:missing:jar:0.1.artifact.id" ).replaceAll( "pom", "jar" ) ); + assertEquals( + "org.apache.maven.its.mng4450:missing:jar:0.1", + props.getProperty("org.apache.maven.its.mng4450:missing:jar:0.1.project.id") + .replaceAll("pom", "jar")); + assertEquals( + "org.apache.maven.its.mng4450:missing:jar:0.1", + props.getProperty("org.apache.maven.its.mng4450:missing:jar:0.1.artifact.id") + .replaceAll("pom", "jar")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4452ResolutionOfSnapshotWithClassifierTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4452ResolutionOfSnapshotWithClassifierTest.java index 787280045e..f37242ff3c 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4452ResolutionOfSnapshotWithClassifierTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4452ResolutionOfSnapshotWithClassifierTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4452ResolutionOfSnapshotWithClassifierTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4452ResolutionOfSnapshotWithClassifierTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4452ResolutionOfSnapshotWithClassifierTest() - { - super( "[3.0-beta-4,)" ); + public MavenITmng4452ResolutionOfSnapshotWithClassifierTest() { + super("[3.0-beta-4,)"); } /** @@ -50,52 +45,50 @@ public class MavenITmng4452ResolutionOfSnapshotWithClassifierTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4452" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4452"); - Verifier verifier = newVerifier( new File( testDir, "producer" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4452" ); - verifier.addCliArgument( "-Dmng4452.type=jar" ); - verifier.addCliArgument( "-Dmng4452.classifier=unix" ); - verifier.setLogFileName( "log-1.txt" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(new File(testDir, "producer").getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4452"); + verifier.addCliArgument("-Dmng4452.type=jar"); + verifier.addCliArgument("-Dmng4452.classifier=unix"); + verifier.setLogFileName("log-1.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.addCliArgument( "-Dmng4452.type=jar" ); - verifier.addCliArgument( "-Dmng4452.classifier=win" ); - verifier.setLogFileName( "log-2.txt" ); - verifier.addCliArgument( "validate" ); + verifier.addCliArgument("-Dmng4452.type=jar"); + verifier.addCliArgument("-Dmng4452.classifier=win"); + verifier.setLogFileName("log-2.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.addCliArgument( "-Dmng4452.type=war" ); - verifier.addCliArgument( "-Dmng4452.classifier=win" ); - verifier.setLogFileName( "log-3.txt" ); - verifier.addCliArgument( "validate" ); + verifier.addCliArgument("-Dmng4452.type=war"); + verifier.addCliArgument("-Dmng4452.classifier=win"); + verifier.setLogFileName("log-3.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier = newVerifier( new File( testDir, "consumer" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4452" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "validate" ); + verifier = newVerifier(new File(testDir, "consumer").getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4452"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List artifacts = verifier.loadLines( "target/artifacts.txt", "UTF-8" ); - assertTrue( artifacts.toString(), - artifacts.contains( "org.apache.maven.its.mng4452:producer:jar:unix:0.1-SNAPSHOT" ) ); - assertTrue( artifacts.toString(), - artifacts.contains( "org.apache.maven.its.mng4452:producer:jar:win:0.1-SNAPSHOT" ) ); - assertTrue( artifacts.toString(), - artifacts.contains( "org.apache.maven.its.mng4452:producer:war:win:0.1-SNAPSHOT" ) ); + List artifacts = verifier.loadLines("target/artifacts.txt", "UTF-8"); + assertTrue( + artifacts.toString(), + artifacts.contains("org.apache.maven.its.mng4452:producer:jar:unix:0.1-SNAPSHOT")); + assertTrue( + artifacts.toString(), artifacts.contains("org.apache.maven.its.mng4452:producer:jar:win:0.1-SNAPSHOT")); + assertTrue( + artifacts.toString(), artifacts.contains("org.apache.maven.its.mng4452:producer:war:win:0.1-SNAPSHOT")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4453PluginVersionFromLifecycleMappingTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4453PluginVersionFromLifecycleMappingTest.java index 67bc9dd42b..1358df786c 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4453PluginVersionFromLifecycleMappingTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4453PluginVersionFromLifecycleMappingTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4453PluginVersionFromLifecycleMappingTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4453PluginVersionFromLifecycleMappingTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4453PluginVersionFromLifecycleMappingTest() - { - super( "[2.0.3,3.0-alpha-1),[3.0-beta-1,)" ); + public MavenITmng4453PluginVersionFromLifecycleMappingTest() { + super("[2.0.3,3.0-alpha-1),[3.0-beta-1,)"); } /** @@ -47,19 +42,16 @@ public class MavenITmng4453PluginVersionFromLifecycleMappingTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4453" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4453"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "process-resources" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("process-resources"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/resources-resources.txt" ); + verifier.verifyFilePresent("target/resources-resources.txt"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4459InMemorySettingsKeptEncryptedTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4459InMemorySettingsKeptEncryptedTest.java index ff801fbebd..20cbe8eecb 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4459InMemorySettingsKeptEncryptedTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4459InMemorySettingsKeptEncryptedTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4459InMemorySettingsKeptEncryptedTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4459InMemorySettingsKeptEncryptedTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4459InMemorySettingsKeptEncryptedTest() - { - super( "[2.1.0,3.0-alpha-1),[3.0-alpha-5,)" ); + public MavenITmng4459InMemorySettingsKeptEncryptedTest() { + super("[2.1.0,3.0-alpha-1),[3.0-alpha-5,)"); } /** @@ -48,25 +43,22 @@ public class MavenITmng4459InMemorySettingsKeptEncryptedTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4459" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4459"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.getSystemProperties().setProperty( "settings.security", - new File( testDir, "settings-security.xml" ).getAbsolutePath() ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.getSystemProperties() + .setProperty("settings.security", new File(testDir, "settings-security.xml").getAbsolutePath()); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/settings.properties" ); - assertEquals( "{BteqUEnqHecHM7MZfnj9FwLcYbdInWxou1C929Txa0A=}", - props.getProperty( "settings.servers.0.password", "" ) ); + Properties props = verifier.loadProperties("target/settings.properties"); + assertEquals( + "{BteqUEnqHecHM7MZfnj9FwLcYbdInWxou1C929Txa0A=}", props.getProperty("settings.servers.0.password", "")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4461ArtifactUploadMonitorTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4461ArtifactUploadMonitorTest.java index 1218c8163e..ce7b9f7fc2 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4461ArtifactUploadMonitorTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4461ArtifactUploadMonitorTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4461ArtifactUploadMonitorTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4461ArtifactUploadMonitorTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4461ArtifactUploadMonitorTest() - { - super( "[2.0.3.0,3.0-alpha-1),[3.0-alpha-5,)" ); + public MavenITmng4461ArtifactUploadMonitorTest() { + super("[2.0.3.0,3.0-alpha-1),[3.0-alpha-5,)"); } /** @@ -46,19 +41,16 @@ public class MavenITmng4461ArtifactUploadMonitorTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4461" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4461"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyTextInLog( "/target/repo/org/apache/maven/its/mng4461/release/1.0/release-1.0.jar" ); + verifier.verifyTextInLog("/target/repo/org/apache/maven/its/mng4461/release/1.0/release-1.0.jar"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4463DependencyManagementImportVersionRanges.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4463DependencyManagementImportVersionRanges.java index 73738211d3..0cfc5a3799 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4463DependencyManagementImportVersionRanges.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4463DependencyManagementImportVersionRanges.java @@ -18,14 +18,13 @@ */ package org.apache.maven.it; -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; - import java.io.File; import java.util.List; import java.util.regex.Pattern; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,83 +32,68 @@ import org.junit.jupiter.api.Test; * * @author Christian Schulte */ -public class MavenITmng4463DependencyManagementImportVersionRanges - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4463DependencyManagementImportVersionRanges extends AbstractMavenIntegrationTestCase { - public MavenITmng4463DependencyManagementImportVersionRanges() - { - super( "[4.0.0-alpha-1,)" ); + public MavenITmng4463DependencyManagementImportVersionRanges() { + super("[4.0.0-alpha-1,)"); } @Test - public void testInclusiveUpperBoundResolvesToHighestVersion() - throws Exception - { - final File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4463/inclusive-upper-bound" ); - final Verifier verifier = newVerifier( testDir.getAbsolutePath(), "remote" ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + public void testInclusiveUpperBoundResolvesToHighestVersion() throws Exception { + final File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4463/inclusive-upper-bound"); + final Verifier verifier = newVerifier(testDir.getAbsolutePath(), "remote"); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - final List artifacts = verifier.loadLines( "target/compile.txt", "UTF-8" ); - assertTrue( artifacts.toString(), artifacts.contains( "org.apache.maven:maven-plugin-api:jar:3.0" ) ); + final List artifacts = verifier.loadLines("target/compile.txt", "UTF-8"); + assertTrue(artifacts.toString(), artifacts.contains("org.apache.maven:maven-plugin-api:jar:3.0")); } @Test - public void testExclusiveUpperBoundResolvesToHighestVersion() - throws Exception - { - final File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4463/exclusive-upper-bound" ); - final Verifier verifier = newVerifier( testDir.getAbsolutePath(), "remote" ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + public void testExclusiveUpperBoundResolvesToHighestVersion() throws Exception { + final File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4463/exclusive-upper-bound"); + final Verifier verifier = newVerifier(testDir.getAbsolutePath(), "remote"); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List artifacts = verifier.loadLines( "target/compile.txt", "UTF-8" ); - assertTrue( artifacts.toString(), artifacts.contains( "org.apache.maven:maven-plugin-api:jar:3.0" ) ); + List artifacts = verifier.loadLines("target/compile.txt", "UTF-8"); + assertTrue(artifacts.toString(), artifacts.contains("org.apache.maven:maven-plugin-api:jar:3.0")); } @Test - public void testFailureWithoutUpperBound() - throws Exception - { - final File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4463/no-upper-bound" ); - final Verifier verifier = newVerifier( testDir.getAbsolutePath(), "remote" ); + public void testFailureWithoutUpperBound() throws Exception { + final File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4463/no-upper-bound"); + final Verifier verifier = newVerifier(testDir.getAbsolutePath(), "remote"); - try - { - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + try { + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); - fail( "Expected 'VerificationException' not thrown." ); - } - catch ( final VerificationException e ) - { - final List lines = verifier.loadFile( new File( testDir, "log.txt" ), false ); - assertTrue( "Expected error message not found.", - indexOf( lines, ".*dependency version range.*does not specify an upper bound.*" ) >= 0 ); + fail("Expected 'VerificationException' not thrown."); + } catch (final VerificationException e) { + final List lines = verifier.loadFile(new File(testDir, "log.txt"), false); + assertTrue( + "Expected error message not found.", + indexOf(lines, ".*dependency version range.*does not specify an upper bound.*") >= 0); } } - private static int indexOf( final List logLines, final String regex ) - { - final Pattern pattern = Pattern.compile( regex ); + private static int indexOf(final List logLines, final String regex) { + final Pattern pattern = Pattern.compile(regex); - for ( int i = 0, l0 = logLines.size(); i < l0; i++ ) - { - if ( pattern.matcher( logLines.get( i ) ).matches() ) - { + for (int i = 0, l0 = logLines.size(); i < l0; i++) { + if (pattern.matcher(logLines.get(i)).matches()) { return i; } } return -1; } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4464PlatformIndependentFileSeparatorTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4464PlatformIndependentFileSeparatorTest.java index a14526affc..e79cf46e07 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4464PlatformIndependentFileSeparatorTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4464PlatformIndependentFileSeparatorTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4464PlatformIndependentFileSeparatorTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4464PlatformIndependentFileSeparatorTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4464PlatformIndependentFileSeparatorTest() - { - super( "[3.0-alpha-7,)" ); + public MavenITmng4464PlatformIndependentFileSeparatorTest() { + super("[3.0-alpha-7,)"); } /** @@ -48,34 +43,30 @@ public class MavenITmng4464PlatformIndependentFileSeparatorTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4464" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4464"); - Verifier verifier = newVerifier( new File( testDir, "aggregator" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "../sub/target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4464" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(new File(testDir, "aggregator").getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("../sub/target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4464"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "../sub/target/path.properties" ); - Properties props = verifier.loadProperties( "../sub/target/path.properties" ); - assertPath( props, "project.build.resources.0.directory", "src/main/res" ); - assertPath( props, "project.build.testResources.0.directory", "src/test/res" ); - assertPath( props, "project.build.sourceDirectory", "src/main/j" ); - assertPath( props, "project.build.testSourceDirectory", "src/test/j" ); - assertPath( props, "project.build.directory", "target/it" ); - assertPath( props, "project.build.outputDirectory", "target/it/classes" ); - assertPath( props, "project.build.testOutputDirectory", "target/it/test-classes" ); + verifier.verifyFilePresent("../sub/target/path.properties"); + Properties props = verifier.loadProperties("../sub/target/path.properties"); + assertPath(props, "project.build.resources.0.directory", "src/main/res"); + assertPath(props, "project.build.testResources.0.directory", "src/test/res"); + assertPath(props, "project.build.sourceDirectory", "src/main/j"); + assertPath(props, "project.build.testSourceDirectory", "src/test/j"); + assertPath(props, "project.build.directory", "target/it"); + assertPath(props, "project.build.outputDirectory", "target/it/classes"); + assertPath(props, "project.build.testOutputDirectory", "target/it/test-classes"); } - private void assertPath( Properties props, String key, String path ) - { - String actual = props.getProperty( key, "" ); - assertTrue( actual, actual.endsWith( path.replace( '/', File.separatorChar ) ) ); + private void assertPath(Properties props, String key, String path) { + String actual = props.getProperty(key, ""); + assertTrue(actual, actual.endsWith(path.replace('/', File.separatorChar))); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4465PluginPrefixFromLocalCacheOfDownRepoTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4465PluginPrefixFromLocalCacheOfDownRepoTest.java index d44ed0014f..7b50fadf80 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4465PluginPrefixFromLocalCacheOfDownRepoTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4465PluginPrefixFromLocalCacheOfDownRepoTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Collections; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4465PluginPrefixFromLocalCacheOfDownRepoTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4465PluginPrefixFromLocalCacheOfDownRepoTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4465PluginPrefixFromLocalCacheOfDownRepoTest() - { - super( "[2.1.0,3.0-alpha-1),[3.0-alpha-6,)" ); + public MavenITmng4465PluginPrefixFromLocalCacheOfDownRepoTest() { + super("[2.1.0,3.0-alpha-1),[3.0-alpha-6,)"); } /** @@ -48,42 +43,42 @@ public class MavenITmng4465PluginPrefixFromLocalCacheOfDownRepoTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4465" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4465"); // phase 1: get the metadata into the local repo - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4465" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.setLogFileName( "log1.txt" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "mng4465:touch" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4465"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.setLogFileName("log1.txt"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("mng4465:touch"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/touch.properties" ); + verifier.verifyFilePresent("target/touch.properties"); // phase 2: re-try with the remote repo being inaccessible (due to bad URL) - verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", - Collections.singletonMap( "@baseurl@", "bad://localhost:63412" ) ); - verifier.setLogFileName( "log2.txt" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "mng4465:touch" ); + verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.filterFile( + "settings-template.xml", + "settings.xml", + "UTF-8", + Collections.singletonMap("@baseurl@", "bad://localhost:63412")); + verifier.setLogFileName("log2.txt"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("mng4465:touch"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/touch.properties" ); + verifier.verifyFilePresent("target/touch.properties"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4469AuthenticatedDeploymentToCustomRepoTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4469AuthenticatedDeploymentToCustomRepoTest.java index 2b833b06a2..183049df4a 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4469AuthenticatedDeploymentToCustomRepoTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4469AuthenticatedDeploymentToCustomRepoTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,15 +16,15 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.eclipse.jetty.security.ConstraintMapping; import org.eclipse.jetty.security.ConstraintSecurityHandler; import org.eclipse.jetty.security.HashLoginService; @@ -51,87 +49,73 @@ import static org.eclipse.jetty.util.security.Constraint.__BASIC_AUTH; * @author Benjamin Bentmann * */ -public class MavenITmng4469AuthenticatedDeploymentToCustomRepoTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4469AuthenticatedDeploymentToCustomRepoTest extends AbstractMavenIntegrationTestCase { private Server server; private int port; private volatile boolean deployed; - public MavenITmng4469AuthenticatedDeploymentToCustomRepoTest() - { - super( "[2.0.3,3.0-alpha-3),[3.0-alpha-6,)" ); + public MavenITmng4469AuthenticatedDeploymentToCustomRepoTest() { + super("[2.0.3,3.0-alpha-3),[3.0-alpha-6,)"); } @BeforeEach - protected void setUp() - throws Exception - { - Handler repoHandler = new AbstractHandler() - { + protected void setUp() throws Exception { + Handler repoHandler = new AbstractHandler() { @Override - public void handle( String target, Request baseRequest, HttpServletRequest request, - HttpServletResponse response ) - { - System.out.println( "Handling " + request.getMethod() + " " + request.getRequestURL() ); + public void handle( + String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) { + System.out.println("Handling " + request.getMethod() + " " + request.getRequestURL()); - if ( "PUT".equalsIgnoreCase( request.getMethod() ) ) - { - response.setStatus( HttpServletResponse.SC_OK ); + if ("PUT".equalsIgnoreCase(request.getMethod())) { + response.setStatus(HttpServletResponse.SC_OK); deployed = true; - } - else - { - response.setStatus( HttpServletResponse.SC_NOT_FOUND ); + } else { + response.setStatus(HttpServletResponse.SC_NOT_FOUND); } - ( (Request) request ).setHandled( true ); + ((Request) request).setHandled(true); } }; Constraint constraint = new Constraint(); - constraint.setName( Constraint.__BASIC_AUTH ); - constraint.setRoles( new String[] { "deployer" } ); - constraint.setAuthenticate( true ); + constraint.setName(Constraint.__BASIC_AUTH); + constraint.setRoles(new String[] {"deployer"}); + constraint.setAuthenticate(true); ConstraintMapping constraintMapping = new ConstraintMapping(); - constraintMapping.setConstraint( constraint ); - constraintMapping.setPathSpec( "/*" ); + constraintMapping.setConstraint(constraint); + constraintMapping.setPathSpec("/*"); - HashLoginService userRealm = new HashLoginService( "TestRealm" ); + HashLoginService userRealm = new HashLoginService("TestRealm"); UserStore userStore = new UserStore(); - userStore.addUser( "testuser", new Password( "testtest" ), new String[] { "deployer" } ); - userRealm.setUserStore( userStore ); + userStore.addUser("testuser", new Password("testtest"), new String[] {"deployer"}); + userRealm.setUserStore(userStore); - server = new Server( 0 ); + server = new Server(0); ConstraintSecurityHandler securityHandler = new ConstraintSecurityHandler(); - securityHandler.setLoginService( userRealm ); - securityHandler.setAuthMethod( __BASIC_AUTH ); - securityHandler.setConstraintMappings( new ConstraintMapping[] { constraintMapping } ); + securityHandler.setLoginService(userRealm); + securityHandler.setAuthMethod(__BASIC_AUTH); + securityHandler.setConstraintMappings(new ConstraintMapping[] {constraintMapping}); HandlerList handlerList = new HandlerList(); - handlerList.addHandler( securityHandler ); - handlerList.addHandler( repoHandler ); + handlerList.addHandler(securityHandler); + handlerList.addHandler(repoHandler); - server.setHandler( handlerList ); + server.setHandler(handlerList); server.start(); - if ( server.isFailed() ) - { - fail( "Couldn't bind the server socket to a free port!" ); + if (server.isFailed()) { + fail("Couldn't bind the server socket to a free port!"); } - port = ( (NetworkConnector) server.getConnectors()[0] ).getLocalPort(); - System.out.println( "Bound server socket to the port " + port ); + port = ((NetworkConnector) server.getConnectors()[0]).getLocalPort(); + System.out.println("Bound server socket to the port " + port); deployed = false; } @AfterEach - protected void tearDown() - throws Exception - { - if ( server != null ) - { + protected void tearDown() throws Exception { + if (server != null) { server.stop(); server.join(); } @@ -143,25 +127,23 @@ public class MavenITmng4469AuthenticatedDeploymentToCustomRepoTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4469" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4469"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "-Dfile=settings.xml" ); - verifier.addCliArgument( "-DgroupId=org.apache.maven.its.mng4469" ); - verifier.addCliArgument( "-DartifactId=it" ); - verifier.addCliArgument( "-Dversion=0.1" ); - verifier.addCliArgument( "-DrepositoryId=mng4469" ); - verifier.addCliArgument( "-DrepositoryUrl=http://localhost:" + port + "/repo" ); - verifier.addCliArgument( "org.apache.maven.its.plugins:maven-it-plugin-artifact:2.1-SNAPSHOT:deploy-file" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("-Dfile=settings.xml"); + verifier.addCliArgument("-DgroupId=org.apache.maven.its.mng4469"); + verifier.addCliArgument("-DartifactId=it"); + verifier.addCliArgument("-Dversion=0.1"); + verifier.addCliArgument("-DrepositoryId=mng4469"); + verifier.addCliArgument("-DrepositoryUrl=http://localhost:" + port + "/repo"); + verifier.addCliArgument("org.apache.maven.its.plugins:maven-it-plugin-artifact:2.1-SNAPSHOT:deploy-file"); verifier.execute(); verifier.verifyErrorFreeLog(); - assertTrue( deployed ); + assertTrue(deployed); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4470AuthenticatedDeploymentToProxyTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4470AuthenticatedDeploymentToProxyTest.java index ba943106e3..c56d065369 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4470AuthenticatedDeploymentToProxyTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4470AuthenticatedDeploymentToProxyTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,9 +16,7 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -33,6 +29,8 @@ import java.util.Deque; import java.util.concurrent.ConcurrentLinkedDeque; import org.apache.maven.it.utils.DeployedResource; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.codehaus.plexus.util.StringUtils; import org.eclipse.jetty.security.ConstraintMapping; import org.eclipse.jetty.security.ConstraintSecurityHandler; @@ -58,9 +56,7 @@ import static org.eclipse.jetty.util.security.Constraint.__BASIC_AUTH; * @author Benjamin Bentmann * */ -public class MavenITmng4470AuthenticatedDeploymentToProxyTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4470AuthenticatedDeploymentToProxyTest extends AbstractMavenIntegrationTestCase { private Server server; private int port; @@ -69,126 +65,110 @@ public class MavenITmng4470AuthenticatedDeploymentToProxyTest private final Deque deployedResources = new ConcurrentLinkedDeque<>(); - public MavenITmng4470AuthenticatedDeploymentToProxyTest() - { - super( "[2.0.3,3.0-alpha-1),[3.0-alpha-6,)" ); + public MavenITmng4470AuthenticatedDeploymentToProxyTest() { + super("[2.0.3,3.0-alpha-1),[3.0-alpha-6,)"); } @BeforeEach - protected void setUp() - throws Exception - { - Handler proxyHandler = new AbstractHandler() - { + protected void setUp() throws Exception { + Handler proxyHandler = new AbstractHandler() { @Override - public void handle( String target, Request baseRequest, HttpServletRequest request, - HttpServletResponse response ) - { + public void handle( + String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) { String tn = Thread.currentThread().getName(); - System.out.println( tn + " Handling (proxy) " + request.getMethod() + " " + request.getRequestURL() ); + System.out.println(tn + " Handling (proxy) " + request.getMethod() + " " + request.getRequestURL()); - String auth = request.getHeader( "Proxy-Authorization" ); - if ( auth != null ) - { - auth = auth.substring( auth.indexOf( ' ' ) + 1 ).trim(); - auth = new String( Base64.getDecoder().decode( auth ), StandardCharsets.US_ASCII ); + String auth = request.getHeader("Proxy-Authorization"); + if (auth != null) { + auth = auth.substring(auth.indexOf(' ') + 1).trim(); + auth = new String(Base64.getDecoder().decode(auth), StandardCharsets.US_ASCII); } - System.out.println( tn + " Proxy-Authorization: " + auth ); + System.out.println(tn + " Proxy-Authorization: " + auth); - if ( !"proxyuser:proxypass".equals( auth ) ) - { - response.setStatus( HttpServletResponse.SC_PROXY_AUTHENTICATION_REQUIRED ); - response.addHeader( "Proxy-Authenticate", "Basic realm=\"Squid proxy-caching web server\"" ); - ( (Request) request ).setHandled( true ); + if (!"proxyuser:proxypass".equals(auth)) { + response.setStatus(HttpServletResponse.SC_PROXY_AUTHENTICATION_REQUIRED); + response.addHeader("Proxy-Authenticate", "Basic realm=\"Squid proxy-caching web server\""); + ((Request) request).setHandled(true); } DeployedResource deployedResource = new DeployedResource(); deployedResource.httpMethod = request.getMethod(); deployedResource.requestUri = request.getRequestURI(); - deployedResource.transferEncoding = request.getHeader( "Transfer-Encoding" ); - deployedResource.contentLength = request.getHeader( "Content-Length" ); + deployedResource.transferEncoding = request.getHeader("Transfer-Encoding"); + deployedResource.contentLength = request.getHeader("Content-Length"); - deployedResources.add( deployedResource ); - System.out.println( tn + " Done (proxy) " + request.getMethod() + " " + request.getRequestURL() ); + deployedResources.add(deployedResource); + System.out.println(tn + " Done (proxy) " + request.getMethod() + " " + request.getRequestURL()); } }; - Handler repoHandler = new AbstractHandler() - { + Handler repoHandler = new AbstractHandler() { @Override - public void handle( String target, Request baseRequest, HttpServletRequest request, - HttpServletResponse response ) - { + public void handle( + String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) { String tn = Thread.currentThread().getName(); - System.out.println( tn + " Handling (repos) " + request.getMethod() + " " + request.getRequestURL() ); + System.out.println(tn + " Handling (repos) " + request.getMethod() + " " + request.getRequestURL()); - if ( "PUT".equalsIgnoreCase( request.getMethod() ) ) - { - response.setStatus( HttpServletResponse.SC_OK ); + if ("PUT".equalsIgnoreCase(request.getMethod())) { + response.setStatus(HttpServletResponse.SC_OK); deployed = true; - } - else - { - response.setStatus( HttpServletResponse.SC_NOT_FOUND ); + } else { + response.setStatus(HttpServletResponse.SC_NOT_FOUND); } - ( (Request) request ).setHandled( true ); + ((Request) request).setHandled(true); DeployedResource deployedResource = new DeployedResource(); deployedResource.httpMethod = request.getMethod(); deployedResource.requestUri = request.getRequestURI(); - deployedResource.transferEncoding = request.getHeader( "Transfer-Encoding" ); - deployedResource.contentLength = request.getHeader( "Content-Length" ); + deployedResource.transferEncoding = request.getHeader("Transfer-Encoding"); + deployedResource.contentLength = request.getHeader("Content-Length"); - deployedResources.add( deployedResource ); - System.out.println( tn + " Done (repos) " + request.getMethod() + " " + request.getRequestURL() ); + deployedResources.add(deployedResource); + System.out.println(tn + " Done (repos) " + request.getMethod() + " " + request.getRequestURL()); } }; Constraint constraint = new Constraint(); - constraint.setName( Constraint.__BASIC_AUTH ); - constraint.setRoles( new String[]{ "deployer" } ); - constraint.setAuthenticate( true ); + constraint.setName(Constraint.__BASIC_AUTH); + constraint.setRoles(new String[] {"deployer"}); + constraint.setAuthenticate(true); ConstraintMapping constraintMapping = new ConstraintMapping(); - constraintMapping.setConstraint( constraint ); - constraintMapping.setPathSpec( "/*" ); + constraintMapping.setConstraint(constraint); + constraintMapping.setPathSpec("/*"); - HashLoginService userRealm = new HashLoginService( "TestRealm" ); + HashLoginService userRealm = new HashLoginService("TestRealm"); UserStore userStore = new UserStore(); - userStore.addUser( "testuser", new Password( "testtest" ), new String[] { "deployer" } ); - userRealm.setUserStore( userStore ); + userStore.addUser("testuser", new Password("testtest"), new String[] {"deployer"}); + userRealm.setUserStore(userStore); - server = new Server( 0 ); + server = new Server(0); ConstraintSecurityHandler securityHandler = new ConstraintSecurityHandler(); - securityHandler.setLoginService( userRealm ); - securityHandler.setAuthMethod( __BASIC_AUTH ); - securityHandler.setConstraintMappings( new ConstraintMapping[] { constraintMapping } ); + securityHandler.setLoginService(userRealm); + securityHandler.setAuthMethod(__BASIC_AUTH); + securityHandler.setConstraintMappings(new ConstraintMapping[] {constraintMapping}); HandlerList handlerList = new HandlerList(); - handlerList.addHandler( proxyHandler ); - handlerList.addHandler( securityHandler ); - handlerList.addHandler( repoHandler ); + handlerList.addHandler(proxyHandler); + handlerList.addHandler(securityHandler); + handlerList.addHandler(repoHandler); - server.setHandler( handlerList ); + server.setHandler(handlerList); server.start(); - if ( server.isFailed() ) - { - fail( "Couldn't bind the server socket to a free port!" ); + if (server.isFailed()) { + fail("Couldn't bind the server socket to a free port!"); } - port = ( (NetworkConnector) server.getConnectors()[0] ).getLocalPort(); - System.out.println( "Bound server socket to the port " + port ); + port = ((NetworkConnector) server.getConnectors()[0]).getLocalPort(); + System.out.println("Bound server socket to the port " + port); deployed = false; } @AfterEach - protected void tearDown() - throws Exception - { - if ( server != null ) - { + protected void tearDown() throws Exception { + if (server != null) { server.stop(); server.join(); } @@ -200,10 +180,8 @@ public class MavenITmng4470AuthenticatedDeploymentToProxyTest * @throws Exception in case of failure */ @Test - public void testitRelease() - throws Exception - { - testit( "release" ); + public void testitRelease() throws Exception { + testit("release"); } /** @@ -212,36 +190,33 @@ public class MavenITmng4470AuthenticatedDeploymentToProxyTest * @throws Exception in case of failure */ @Test - public void testitSnapshot() - throws Exception - { - testit( "snapshot" ); + public void testitSnapshot() throws Exception { + testit("snapshot"); } - private void testit( String project ) - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4470/" + project ); + private void testit(String project) throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4470/" + project); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", - Collections.singletonMap( "@port@", Integer.toString( port ) ) ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.filterFile( + "settings-template.xml", + "settings.xml", + "UTF-8", + Collections.singletonMap("@port@", Integer.toString(port))); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - for ( DeployedResource deployedResource : deployedResources ) - { - if ( StringUtils.equalsIgnoreCase( "chunked", deployedResource.transferEncoding ) ) - { - fail( "deployedResource " + deployedResource - + " use chunked transfert encoding some http server doesn't support that" ); + for (DeployedResource deployedResource : deployedResources) { + if (StringUtils.equalsIgnoreCase("chunked", deployedResource.transferEncoding)) { + fail("deployedResource " + deployedResource + + " use chunked transfert encoding some http server doesn't support that"); } } - assertTrue( deployed ); + assertTrue(deployed); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4474PerLookupWagonInstantiationTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4474PerLookupWagonInstantiationTest.java index e8555721ad..a95451abd3 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4474PerLookupWagonInstantiationTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4474PerLookupWagonInstantiationTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4474PerLookupWagonInstantiationTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4474PerLookupWagonInstantiationTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4474PerLookupWagonInstantiationTest() - { - super( "[2.0.5,3.0-alpha-1),[3.0-alpha-6,)" ); + public MavenITmng4474PerLookupWagonInstantiationTest() { + super("[2.0.5,3.0-alpha-1),[3.0-alpha-6,)"); } /** @@ -47,24 +42,21 @@ public class MavenITmng4474PerLookupWagonInstantiationTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4474" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4474"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/wagon.properties" ); - String hash1 = props.getProperty( "coreit://one.hash" ); - assertNotNull( hash1 ); - String hash2 = props.getProperty( "coreit://two.hash" ); - assertNotNull( hash2 ); - assertNotEquals( hash1, hash2 ); + Properties props = verifier.loadProperties("target/wagon.properties"); + String hash1 = props.getProperty("coreit://one.hash"); + assertNotNull(hash1); + String hash2 = props.getProperty("coreit://two.hash"); + assertNotNull(hash2); + assertNotEquals(hash1, hash2); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4482ForcePluginSnapshotUpdateTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4482ForcePluginSnapshotUpdateTest.java index 4bd5de493d..a537750a0f 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4482ForcePluginSnapshotUpdateTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4482ForcePluginSnapshotUpdateTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Map; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4482ForcePluginSnapshotUpdateTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4482ForcePluginSnapshotUpdateTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4482ForcePluginSnapshotUpdateTest() - { - super( "[2.0.3,3.0-alpha-1),[3.0-alpha-6,)" ); + public MavenITmng4482ForcePluginSnapshotUpdateTest() { + super("[2.0.3,3.0-alpha-1),[3.0-alpha-6,)"); } /** @@ -48,51 +43,47 @@ public class MavenITmng4482ForcePluginSnapshotUpdateTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4482" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4482"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4482" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng4482"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); /* * NOTE: The update of the extension plugin while still being referenced by a class loader from the first test * run make this test intermittently fail on *nix boxes, hence we enforce forking. */ - verifier.setForkJvm( true ); + verifier.setForkJvm(true); Map filterProps = verifier.newDefaultFilterMap(); - filterProps.put( "@repo@", "repo-1" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps ); - verifier.setLogFileName( "log-force-1.txt" ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + filterProps.put("@repo@", "repo-1"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8", filterProps); + verifier.setLogFileName("log-force-1.txt"); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props1 = verifier.loadProperties( "target/touch.properties" ); - assertEquals( "old", props1.getProperty( "one" ) ); - assertNull( props1.getProperty( "two" ) ); + Properties props1 = verifier.loadProperties("target/touch.properties"); + assertEquals("old", props1.getProperty("one")); + assertNull(props1.getProperty("two")); - filterProps.put( "@repo@", "repo-2" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps ); - verifier.setLogFileName( "log-force-2.txt" ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "-X" ); - verifier.addCliArgument( "-U" ); - verifier.addCliArgument( "validate" ); + filterProps.put("@repo@", "repo-2"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8", filterProps); + verifier.setLogFileName("log-force-2.txt"); + verifier.deleteDirectory("target"); + verifier.addCliArgument("-X"); + verifier.addCliArgument("-U"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - - Properties props2 = verifier.loadProperties( "target/touch.properties" ); - assertEquals( "new", props2.getProperty( "two" ) ); - assertNull( props2.getProperty( "one" ) ); + Properties props2 = verifier.loadProperties("target/touch.properties"); + assertEquals("new", props2.getProperty("two")); + assertNull(props2.getProperty("one")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4488ValidateExternalParenPomLenientTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4488ValidateExternalParenPomLenientTest.java index ab5ef0a378..f69052fbbd 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4488ValidateExternalParenPomLenientTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4488ValidateExternalParenPomLenientTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4488ValidateExternalParenPomLenientTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4488ValidateExternalParenPomLenientTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4488ValidateExternalParenPomLenientTest() - { - super( "[2.0.3,3.0-alpha-1),[3.0-alpha-6,)" ); + public MavenITmng4488ValidateExternalParenPomLenientTest() { + super("[2.0.3,3.0-alpha-1),[3.0-alpha-6,)"); } /** @@ -46,21 +41,18 @@ public class MavenITmng4488ValidateExternalParenPomLenientTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4488" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4488"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4488" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4488"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4489MirroringOfExtensionRepoTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4489MirroringOfExtensionRepoTest.java index 9c015278db..1931e45d2e 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4489MirroringOfExtensionRepoTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4489MirroringOfExtensionRepoTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Map; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.eclipse.jetty.security.ConstraintMapping; import org.eclipse.jetty.security.ConstraintSecurityHandler; import org.eclipse.jetty.security.HashLoginService; @@ -45,13 +43,10 @@ import static org.eclipse.jetty.util.security.Constraint.__BASIC_AUTH; * * @author Benjamin Bentmann */ -public class MavenITmng4489MirroringOfExtensionRepoTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4489MirroringOfExtensionRepoTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4489MirroringOfExtensionRepoTest() - { - super( "[2.0.3,3.0-alpha-1),[3.0-alpha-6,)" ); + public MavenITmng4489MirroringOfExtensionRepoTest() { + super("[2.0.3,3.0-alpha-1),[3.0-alpha-6,)"); } /** @@ -61,68 +56,62 @@ public class MavenITmng4489MirroringOfExtensionRepoTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4489" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4489"); Constraint constraint = new Constraint(); - constraint.setName( Constraint.__BASIC_AUTH ); - constraint.setRoles( new String[] { "user" } ); - constraint.setAuthenticate( true ); + constraint.setName(Constraint.__BASIC_AUTH); + constraint.setRoles(new String[] {"user"}); + constraint.setAuthenticate(true); ConstraintMapping constraintMapping = new ConstraintMapping(); - constraintMapping.setConstraint( constraint ); - constraintMapping.setPathSpec( "/*" ); + constraintMapping.setConstraint(constraint); + constraintMapping.setPathSpec("/*"); - HashLoginService userRealm = new HashLoginService( "TestRealm" ); + HashLoginService userRealm = new HashLoginService("TestRealm"); UserStore userStore = new UserStore(); - userStore.addUser( "testuser", new Password( "testtest" ), new String[] { "user" } ); - userRealm.setUserStore( userStore ); + userStore.addUser("testuser", new Password("testtest"), new String[] {"user"}); + userRealm.setUserStore(userStore); - Server server = new Server( 0 ); + Server server = new Server(0); ConstraintSecurityHandler securityHandler = new ConstraintSecurityHandler(); - securityHandler.setLoginService( userRealm ); - securityHandler.setAuthMethod( __BASIC_AUTH ); - securityHandler.setConstraintMappings( new ConstraintMapping[] { constraintMapping } ); + securityHandler.setLoginService(userRealm); + securityHandler.setAuthMethod(__BASIC_AUTH); + securityHandler.setConstraintMappings(new ConstraintMapping[] {constraintMapping}); ResourceHandler repoHandler = new ResourceHandler(); - repoHandler.setResourceBase( testDir.getAbsolutePath() ); + repoHandler.setResourceBase(testDir.getAbsolutePath()); HandlerList handlerList = new HandlerList(); - handlerList.addHandler( securityHandler ); - handlerList.addHandler( repoHandler ); - handlerList.addHandler( new DefaultHandler() ); + handlerList.addHandler(securityHandler); + handlerList.addHandler(repoHandler); + handlerList.addHandler(new DefaultHandler()); - server.setHandler( handlerList ); + server.setHandler(handlerList); - try - { + try { server.start(); - if ( server.isFailed() ) - { - fail( "Couldn't bind the server socket to a free port!" ); + if (server.isFailed()) { + fail("Couldn't bind the server socket to a free port!"); } - int port = ( (NetworkConnector) server.getConnectors()[0] ).getLocalPort(); - System.out.println( "Bound server socket to the port " + port ); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4489" ); + int port = ((NetworkConnector) server.getConnectors()[0]).getLocalPort(); + System.out.println("Bound server socket to the port " + port); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4489"); Map filterProps = verifier.newDefaultFilterMap(); - filterProps.put( "@port@", Integer.toString( port ) ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + filterProps.put("@port@", Integer.toString(port)); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8", filterProps); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng4489", "ext-dep", "0.1", "jar" ); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng4489", "ext-dep", "0.1", "pom" ); - } - finally - { + verifier.verifyArtifactPresent("org.apache.maven.its.mng4489", "ext-dep", "0.1", "jar"); + verifier.verifyArtifactPresent("org.apache.maven.its.mng4489", "ext-dep", "0.1", "pom"); + } finally { server.stop(); server.join(); } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4498IgnoreBrokenMetadataTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4498IgnoreBrokenMetadataTest.java index bb9acf6f19..9289c3209b 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4498IgnoreBrokenMetadataTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4498IgnoreBrokenMetadataTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4498IgnoreBrokenMetadataTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4498IgnoreBrokenMetadataTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4498IgnoreBrokenMetadataTest() - { - super( "[3.0-alpha-6,)" ); + public MavenITmng4498IgnoreBrokenMetadataTest() { + super("[3.0-alpha-6,)"); } /** @@ -47,24 +42,21 @@ public class MavenITmng4498IgnoreBrokenMetadataTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4498" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4498"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4498" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4498"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List classpath = verifier.loadLines( "target/classpath.txt", "UTF-8" ); - assertTrue( classpath.toString(), classpath.contains( "dep-0.1-SNAPSHOT.jar" ) ); + List classpath = verifier.loadLines("target/classpath.txt", "UTF-8"); + assertTrue(classpath.toString(), classpath.contains("dep-0.1-SNAPSHOT.jar")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4500NoUpdateOfTimestampedSnapshotsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4500NoUpdateOfTimestampedSnapshotsTest.java index 8dc242cfef..4bb1ab0220 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4500NoUpdateOfTimestampedSnapshotsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4500NoUpdateOfTimestampedSnapshotsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,9 +16,7 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -31,6 +27,8 @@ import java.util.Collections; import java.util.List; import java.util.Map; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.eclipse.jetty.server.NetworkConnector; import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.Server; @@ -45,13 +43,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4500NoUpdateOfTimestampedSnapshotsTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4500NoUpdateOfTimestampedSnapshotsTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4500NoUpdateOfTimestampedSnapshotsTest() - { - super( "[2.0.3,3.0-alpha-1),[3.0-alpha-6,)" ); + public MavenITmng4500NoUpdateOfTimestampedSnapshotsTest() { + super("[2.0.3,3.0-alpha-1),[3.0-alpha-6,)"); } /** @@ -61,80 +56,72 @@ public class MavenITmng4500NoUpdateOfTimestampedSnapshotsTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4500" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4500"); String pomUri = "/repo/org/apache/maven/its/mng4500/dep/0.1-SNAPSHOT/dep-0.1-20091219.230823-1.pom"; String jarUri = "/repo/org/apache/maven/its/mng4500/dep/0.1-SNAPSHOT/dep-0.1-20091219.230823-1.jar"; - final List requestedUris = Collections.synchronizedList( new ArrayList() ); + final List requestedUris = Collections.synchronizedList(new ArrayList()); - AbstractHandler logHandler = new AbstractHandler() - { + AbstractHandler logHandler = new AbstractHandler() { @Override - public void handle( String target, Request baseRequest, HttpServletRequest request, - HttpServletResponse response ) - { - requestedUris.add( request.getRequestURI() ); + public void handle( + String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) { + requestedUris.add(request.getRequestURI()); } }; ResourceHandler repoHandler = new ResourceHandler(); - repoHandler.setResourceBase( testDir.getAbsolutePath() ); + repoHandler.setResourceBase(testDir.getAbsolutePath()); HandlerList handlerList = new HandlerList(); - handlerList.addHandler( logHandler ); - handlerList.addHandler( repoHandler ); - handlerList.addHandler( new DefaultHandler() ); + handlerList.addHandler(logHandler); + handlerList.addHandler(repoHandler); + handlerList.addHandler(new DefaultHandler()); - Server server = new Server( 0 ); - server.setHandler( handlerList ); + Server server = new Server(0); + server.setHandler(handlerList); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - try - { + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + try { server.start(); - if ( server.isFailed() ) - { - fail( "Couldn't bind the server socket to a free port!" ); + if (server.isFailed()) { + fail("Couldn't bind the server socket to a free port!"); } - int port = ( (NetworkConnector) server.getConnectors()[0] ).getLocalPort(); - System.out.println( "Bound server socket to the port " + port ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4500" ); + int port = ((NetworkConnector) server.getConnectors()[0]).getLocalPort(); + System.out.println("Bound server socket to the port " + port); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4500"); Map filterProps = verifier.newDefaultFilterMap(); - filterProps.put( "@port@", Integer.toString( port ) ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); + filterProps.put("@port@", Integer.toString(port)); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8", filterProps); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); - verifier.setLogFileName( "log-1.txt" ); - verifier.addCliArgument( "validate" ); + verifier.setLogFileName("log-1.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List classpath = verifier.loadLines( "target/classpath.txt", "UTF-8" ); - assertTrue( classpath.toString(), classpath.contains( "dep-0.1-SNAPSHOT.jar" ) ); - assertTrue( requestedUris.toString(), requestedUris.contains( pomUri ) ); - assertTrue( requestedUris.toString(), requestedUris.contains( jarUri ) ); + List classpath = verifier.loadLines("target/classpath.txt", "UTF-8"); + assertTrue(classpath.toString(), classpath.contains("dep-0.1-SNAPSHOT.jar")); + assertTrue(requestedUris.toString(), requestedUris.contains(pomUri)); + assertTrue(requestedUris.toString(), requestedUris.contains(jarUri)); requestedUris.clear(); - verifier.setLogFileName( "log-2.txt" ); - verifier.addCliArgument( "validate" ); + verifier.setLogFileName("log-2.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - classpath = verifier.loadLines( "target/classpath.txt", "UTF-8" ); - assertTrue( classpath.toString(), classpath.contains( "dep-0.1-SNAPSHOT.jar" ) ); - assertFalse( requestedUris.toString(), requestedUris.contains( pomUri ) ); - assertFalse( requestedUris.toString(), requestedUris.contains( jarUri ) ); - } - finally - { + classpath = verifier.loadLines("target/classpath.txt", "UTF-8"); + assertTrue(classpath.toString(), classpath.contains("dep-0.1-SNAPSHOT.jar")); + assertFalse(requestedUris.toString(), requestedUris.contains(pomUri)); + assertFalse(requestedUris.toString(), requestedUris.contains(jarUri)); + } finally { server.stop(); server.join(); } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4522FailUponMissingDependencyParentPomTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4522FailUponMissingDependencyParentPomTest.java index e3a5b3ed68..a46f800a35 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4522FailUponMissingDependencyParentPomTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4522FailUponMissingDependencyParentPomTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4522FailUponMissingDependencyParentPomTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4522FailUponMissingDependencyParentPomTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4522FailUponMissingDependencyParentPomTest() - { - super( "[2.0.3,3.0-alpha-1),[3.0-alpha-7,)" ); + public MavenITmng4522FailUponMissingDependencyParentPomTest() { + super("[2.0.3,3.0-alpha-1),[3.0-alpha-7,)"); } /** @@ -47,29 +42,23 @@ public class MavenITmng4522FailUponMissingDependencyParentPomTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4522" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4522"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4522" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - try - { - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4522"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + try { + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - fail( "Missing parent POM of dependency did not fail the build." ); - } - catch ( VerificationException e ) - { + fail("Missing parent POM of dependency did not fail the build."); + } catch (VerificationException e) { // expected } } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4526MavenProjectArtifactsScopeTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4526MavenProjectArtifactsScopeTest.java index a6693d0c65..8642583c97 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4526MavenProjectArtifactsScopeTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4526MavenProjectArtifactsScopeTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4526MavenProjectArtifactsScopeTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4526MavenProjectArtifactsScopeTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4526MavenProjectArtifactsScopeTest() - { - super( "[2.0.3,3.0-alpha-1),[3.0-alpha-7,)" ); + public MavenITmng4526MavenProjectArtifactsScopeTest() { + super("[2.0.3,3.0-alpha-1),[3.0-alpha-7,)"); } /** @@ -48,38 +43,35 @@ public class MavenITmng4526MavenProjectArtifactsScopeTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4526" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4526"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4526" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "generate-sources" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4526"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("generate-sources"); verifier.execute(); verifier.verifyErrorFreeLog(); List artifacts; - artifacts = verifier.loadLines( "target/compile.txt", "UTF-8" ); - assertTrue( artifacts.toString(), artifacts.contains( "org.apache.maven.its.mng4526:a:jar:0.1" ) ); - assertFalse( artifacts.toString(), artifacts.contains( "org.apache.maven.its.mng4526:b:jar:0.1" ) ); - assertFalse( artifacts.toString(), artifacts.contains( "org.apache.maven.its.mng4526:c:jar:0.1" ) ); + artifacts = verifier.loadLines("target/compile.txt", "UTF-8"); + assertTrue(artifacts.toString(), artifacts.contains("org.apache.maven.its.mng4526:a:jar:0.1")); + assertFalse(artifacts.toString(), artifacts.contains("org.apache.maven.its.mng4526:b:jar:0.1")); + assertFalse(artifacts.toString(), artifacts.contains("org.apache.maven.its.mng4526:c:jar:0.1")); - artifacts = verifier.loadLines( "target/runtime.txt", "UTF-8" ); - assertTrue( artifacts.toString(), artifacts.contains( "org.apache.maven.its.mng4526:a:jar:0.1" ) ); - assertTrue( artifacts.toString(), artifacts.contains( "org.apache.maven.its.mng4526:b:jar:0.1" ) ); - assertFalse( artifacts.toString(), artifacts.contains( "org.apache.maven.its.mng4526:c:jar:0.1" ) ); + artifacts = verifier.loadLines("target/runtime.txt", "UTF-8"); + assertTrue(artifacts.toString(), artifacts.contains("org.apache.maven.its.mng4526:a:jar:0.1")); + assertTrue(artifacts.toString(), artifacts.contains("org.apache.maven.its.mng4526:b:jar:0.1")); + assertFalse(artifacts.toString(), artifacts.contains("org.apache.maven.its.mng4526:c:jar:0.1")); - artifacts = verifier.loadLines( "target/test.txt", "UTF-8" ); - assertTrue( artifacts.toString(), artifacts.contains( "org.apache.maven.its.mng4526:a:jar:0.1" ) ); - assertTrue( artifacts.toString(), artifacts.contains( "org.apache.maven.its.mng4526:b:jar:0.1" ) ); - assertTrue( artifacts.toString(), artifacts.contains( "org.apache.maven.its.mng4526:c:jar:0.1" ) ); + artifacts = verifier.loadLines("target/test.txt", "UTF-8"); + assertTrue(artifacts.toString(), artifacts.contains("org.apache.maven.its.mng4526:a:jar:0.1")); + assertTrue(artifacts.toString(), artifacts.contains("org.apache.maven.its.mng4526:b:jar:0.1")); + assertTrue(artifacts.toString(), artifacts.contains("org.apache.maven.its.mng4526:c:jar:0.1")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4528ExcludeWagonsFromMavenCoreArtifactsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4528ExcludeWagonsFromMavenCoreArtifactsTest.java index 69852290dc..a68b9b86a8 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4528ExcludeWagonsFromMavenCoreArtifactsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4528ExcludeWagonsFromMavenCoreArtifactsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4528ExcludeWagonsFromMavenCoreArtifactsTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4528ExcludeWagonsFromMavenCoreArtifactsTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4528ExcludeWagonsFromMavenCoreArtifactsTest() - { - super( "[2.0.5,3.0-alpha-1),[3.0-alpha-7,4.0.0-alpha-1)" ); + public MavenITmng4528ExcludeWagonsFromMavenCoreArtifactsTest() { + super("[2.0.5,3.0-alpha-1),[3.0-alpha-7,4.0.0-alpha-1)"); } /** @@ -51,21 +46,18 @@ public class MavenITmng4528ExcludeWagonsFromMavenCoreArtifactsTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4528" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4528"); - Verifier verifier = newVerifier( testDir.getAbsolutePath(), "remote" ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath(), "remote"); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/wagon.properties" ); - String version = props.getProperty( "version", "" ); - assertNotEquals( "Bad wagon version used: " + version, "1.0-alpha-6", version ); + Properties props = verifier.loadProperties("target/wagon.properties"); + String version = props.getProperty("version", ""); + assertNotEquals("Bad wagon version used: " + version, "1.0-alpha-6", version); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4536RequiresNoProjectForkingMojoTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4536RequiresNoProjectForkingMojoTest.java index 6e18dc6593..321f45dd19 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4536RequiresNoProjectForkingMojoTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4536RequiresNoProjectForkingMojoTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4536RequiresNoProjectForkingMojoTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4536RequiresNoProjectForkingMojoTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4536RequiresNoProjectForkingMojoTest() - { - super( "[2.0.3,3.0-alpha-1),[3.0-alpha-7,)" ); + public MavenITmng4536RequiresNoProjectForkingMojoTest() { + super("[2.0.3,3.0-alpha-1),[3.0-alpha-7,)"); } /** @@ -46,22 +41,19 @@ public class MavenITmng4536RequiresNoProjectForkingMojoTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4536" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4536"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteDirectory( "mod-a/target" ); - verifier.deleteDirectory( "mod-b/target" ); - verifier.addCliArgument( "generate-sources" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteDirectory("mod-a/target"); + verifier.deleteDirectory("mod-b/target"); + verifier.addCliArgument("generate-sources"); verifier.execute(); verifier.verifyErrorFreeLog(); - assertEquals( 2, verifier.loadLines( "mod-a/target/touch.log", "UTF-8" ).size() ); - assertEquals( 2, verifier.loadLines( "mod-b/target/touch.log", "UTF-8" ).size() ); + assertEquals(2, verifier.loadLines("mod-a/target/touch.log", "UTF-8").size()); + assertEquals(2, verifier.loadLines("mod-b/target/touch.log", "UTF-8").size()); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4544ActiveComponentCollectionThreadSafeTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4544ActiveComponentCollectionThreadSafeTest.java index dd89559c9d..81fa5879f9 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4544ActiveComponentCollectionThreadSafeTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4544ActiveComponentCollectionThreadSafeTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4544ActiveComponentCollectionThreadSafeTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4544ActiveComponentCollectionThreadSafeTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4544ActiveComponentCollectionThreadSafeTest() - { - super( "[2.0.3,3.0-alpha-1),[3.0-alpha-7,)" ); + public MavenITmng4544ActiveComponentCollectionThreadSafeTest() { + super("[2.0.3,3.0-alpha-1),[3.0-alpha-7,)"); } /** @@ -47,21 +42,18 @@ public class MavenITmng4544ActiveComponentCollectionThreadSafeTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4544" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4544"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/thread.properties" ); - assertEquals( 0, Integer.parseInt( props.getProperty( "exceptions" ) ) ); - assertEquals( 2, Integer.parseInt( props.getProperty( "components" ) ) ); + Properties props = verifier.loadProperties("target/thread.properties"); + assertEquals(0, Integer.parseInt(props.getProperty("exceptions"))); + assertEquals(2, Integer.parseInt(props.getProperty("components"))); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4553CoreArtifactFilterConsidersGroupIdTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4553CoreArtifactFilterConsidersGroupIdTest.java index ad49422bd9..bf78227301 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4553CoreArtifactFilterConsidersGroupIdTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4553CoreArtifactFilterConsidersGroupIdTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4553CoreArtifactFilterConsidersGroupIdTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4553CoreArtifactFilterConsidersGroupIdTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4553CoreArtifactFilterConsidersGroupIdTest() - { - super( "[3.0-alpha-7,)" ); + public MavenITmng4553CoreArtifactFilterConsidersGroupIdTest() { + super("[3.0-alpha-7,)"); } /** @@ -47,25 +42,22 @@ public class MavenITmng4553CoreArtifactFilterConsidersGroupIdTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4553" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4553"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4553" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4553"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties pclProps = verifier.loadProperties( "target/pcl.properties" ); - assertNotNull( pclProps.getProperty( "mng4553.properties" ) ); - assertEquals( "1", pclProps.getProperty( "mng4553.properties.count" ) ); + Properties pclProps = verifier.loadProperties("target/pcl.properties"); + assertNotNull(pclProps.getProperty("mng4553.properties")); + assertEquals("1", pclProps.getProperty("mng4553.properties.count")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4554PluginPrefixMappingUpdateTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4554PluginPrefixMappingUpdateTest.java index 5fbb9ec88e..dea98e65f7 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4554PluginPrefixMappingUpdateTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4554PluginPrefixMappingUpdateTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,9 +16,7 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -33,6 +29,8 @@ import java.util.List; import java.util.Map; import org.apache.maven.shared.utils.io.FileUtils; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.eclipse.jetty.server.NetworkConnector; import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.Server; @@ -47,13 +45,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4554PluginPrefixMappingUpdateTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4554PluginPrefixMappingUpdateTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4554PluginPrefixMappingUpdateTest() - { - super( "[2.0.3,3.0-alpha-1),[3.0-alpha-7,)" ); + public MavenITmng4554PluginPrefixMappingUpdateTest() { + super("[2.0.3,3.0-alpha-1),[3.0-alpha-7,)"); } /** @@ -63,82 +58,73 @@ public class MavenITmng4554PluginPrefixMappingUpdateTest * @throws Exception in case of failure */ @Test - public void testitCached() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4554" ); + public void testitCached() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4554"); String metadataUri = "/repo-1/org/apache/maven/its/mng4554/maven-metadata.xml"; - final List requestedUris = Collections.synchronizedList( new ArrayList() ); + final List requestedUris = Collections.synchronizedList(new ArrayList()); - AbstractHandler logHandler = new AbstractHandler() - { + AbstractHandler logHandler = new AbstractHandler() { @Override - public void handle( String target, Request baseRequest, HttpServletRequest request, - HttpServletResponse response ) - { - requestedUris.add( request.getRequestURI() ); + public void handle( + String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) { + requestedUris.add(request.getRequestURI()); } }; ResourceHandler repoHandler = new ResourceHandler(); - repoHandler.setResourceBase( testDir.getAbsolutePath() ); + repoHandler.setResourceBase(testDir.getAbsolutePath()); HandlerList handlerList = new HandlerList(); - handlerList.addHandler( logHandler ); - handlerList.addHandler( repoHandler ); - handlerList.addHandler( new DefaultHandler() ); + handlerList.addHandler(logHandler); + handlerList.addHandler(repoHandler); + handlerList.addHandler(new DefaultHandler()); - Server server = new Server( 0 ); - server.setHandler( handlerList ); + Server server = new Server(0); + server.setHandler(handlerList); server.start(); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - try - { - if ( server.isFailed() ) - { - fail( "Couldn't bind the server socket to a free port!" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + try { + if (server.isFailed()) { + fail("Couldn't bind the server socket to a free port!"); } - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - try - { - verifier.deleteArtifacts( "org.apache.maven.its.mng4554" ); - } - catch ( IOException e ) - { + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + try { + verifier.deleteArtifacts("org.apache.maven.its.mng4554"); + } catch (IOException e) { // expected when running test on Windows using embedded Maven (JAR files locked by plugin class realm) - assertFalse( new File( verifier.getArtifactMetadataPath( "org.apache.maven.its.mng4554", null, null, "maven-metadata-mng4554.xml" ) ).exists() ); + assertFalse(new File(verifier.getArtifactMetadataPath( + "org.apache.maven.its.mng4554", null, null, "maven-metadata-mng4554.xml")) + .exists()); } Map filterProps = verifier.newDefaultFilterMap(); NetworkConnector connector = (NetworkConnector) server.getConnectors()[0]; - filterProps.put( "@port@", Integer.toString( connector.getLocalPort() ) ); - filterProps.put( "@repo@", "repo-1" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); + filterProps.put("@port@", Integer.toString(connector.getLocalPort())); + filterProps.put("@repo@", "repo-1"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8", filterProps); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); - verifier.setLogFileName( "log-cached-1.txt" ); - verifier.addCliArgument( "a:touch" ); + verifier.setLogFileName("log-cached-1.txt"); + verifier.addCliArgument("a:touch"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/touch.txt" ); - assertTrue( requestedUris.toString(), requestedUris.contains( metadataUri ) ); + verifier.verifyFilePresent("target/touch.txt"); + assertTrue(requestedUris.toString(), requestedUris.contains(metadataUri)); requestedUris.clear(); - verifier.setLogFileName( "log-cached-2.txt" ); - verifier.addCliArgument( "a:touch" ); + verifier.setLogFileName("log-cached-2.txt"); + verifier.addCliArgument("a:touch"); verifier.execute(); verifier.verifyErrorFreeLog(); - assertFalse( requestedUris.toString(), requestedUris.contains( metadataUri ) ); - } - finally - { + assertFalse(requestedUris.toString(), requestedUris.contains(metadataUri)); + } finally { server.stop(); server.join(); } @@ -151,83 +137,74 @@ public class MavenITmng4554PluginPrefixMappingUpdateTest * @throws Exception in case of failure */ @Test - public void testitForcedUpdate() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4554" ); + public void testitForcedUpdate() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4554"); String metadataUri = "/repo-1/org/apache/maven/its/mng4554/maven-metadata.xml"; - final List requestedUris = Collections.synchronizedList( new ArrayList() ); + final List requestedUris = Collections.synchronizedList(new ArrayList()); - AbstractHandler logHandler = new AbstractHandler() - { + AbstractHandler logHandler = new AbstractHandler() { @Override - public void handle( String target, Request baseRequest, HttpServletRequest request, - HttpServletResponse response ) - { - requestedUris.add( request.getRequestURI() ); + public void handle( + String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) { + requestedUris.add(request.getRequestURI()); } }; ResourceHandler repoHandler = new ResourceHandler(); - repoHandler.setResourceBase( testDir.getAbsolutePath() ); + repoHandler.setResourceBase(testDir.getAbsolutePath()); HandlerList handlerList = new HandlerList(); - handlerList.addHandler( logHandler ); - handlerList.addHandler( repoHandler ); - handlerList.addHandler( new DefaultHandler() ); + handlerList.addHandler(logHandler); + handlerList.addHandler(repoHandler); + handlerList.addHandler(new DefaultHandler()); - Server server = new Server( 0 ); - server.setHandler( handlerList ); + Server server = new Server(0); + server.setHandler(handlerList); server.start(); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - try - { - if ( server.isFailed() ) - { - fail( "Couldn't bind the server socket to a free port!" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + try { + if (server.isFailed()) { + fail("Couldn't bind the server socket to a free port!"); } - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - try - { - verifier.deleteArtifacts( "org.apache.maven.its.mng4554" ); - } - catch ( IOException e ) - { + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + try { + verifier.deleteArtifacts("org.apache.maven.its.mng4554"); + } catch (IOException e) { // expected when running test on Windows using embedded Maven (JAR files locked by plugin class realm) - assertFalse( new File( verifier.getArtifactMetadataPath( "org.apache.maven.its.mng4554", null, null, "maven-metadata-mng4554.xml" ) ).exists() ); + assertFalse(new File(verifier.getArtifactMetadataPath( + "org.apache.maven.its.mng4554", null, null, "maven-metadata-mng4554.xml")) + .exists()); } Map filterProps = verifier.newDefaultFilterMap(); NetworkConnector connector = (NetworkConnector) server.getConnectors()[0]; - filterProps.put( "@port@", Integer.toString( connector.getLocalPort() ) ); - filterProps.put( "@repo@", "repo-1" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps ); - verifier.addCliArgument( "-U" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); + filterProps.put("@port@", Integer.toString(connector.getLocalPort())); + filterProps.put("@repo@", "repo-1"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8", filterProps); + verifier.addCliArgument("-U"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); - verifier.setLogFileName( "log-forced-1.txt" ); - verifier.addCliArgument( "a:touch" ); + verifier.setLogFileName("log-forced-1.txt"); + verifier.addCliArgument("a:touch"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/touch.txt" ); - assertTrue( requestedUris.toString(), requestedUris.contains( metadataUri ) ); + verifier.verifyFilePresent("target/touch.txt"); + assertTrue(requestedUris.toString(), requestedUris.contains(metadataUri)); requestedUris.clear(); - verifier.setLogFileName( "log-forced-2.txt" ); - verifier.addCliArgument( "a:touch" ); + verifier.setLogFileName("log-forced-2.txt"); + verifier.addCliArgument("a:touch"); verifier.execute(); verifier.verifyErrorFreeLog(); - assertTrue( requestedUris.toString(), requestedUris.contains( metadataUri ) ); - } - finally - { + assertTrue(requestedUris.toString(), requestedUris.contains(metadataUri)); + } finally { server.stop(); server.join(); } @@ -240,89 +217,80 @@ public class MavenITmng4554PluginPrefixMappingUpdateTest * @throws Exception in case of failure */ @Test - public void testitRefetched() - throws Exception - { - requiresMavenVersion( "[3.0-alpha-3,)" ); + public void testitRefetched() throws Exception { + requiresMavenVersion("[3.0-alpha-3,)"); - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4554" ); + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4554"); String metadataUri = "/repo-it/org/apache/maven/its/mng4554/maven-metadata.xml"; - final List requestedUris = Collections.synchronizedList( new ArrayList() ); + final List requestedUris = Collections.synchronizedList(new ArrayList()); - AbstractHandler logHandler = new AbstractHandler() - { + AbstractHandler logHandler = new AbstractHandler() { @Override - public void handle( String target, Request baseRequest, HttpServletRequest request, - HttpServletResponse response ) - { - requestedUris.add( request.getRequestURI() ); + public void handle( + String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) { + requestedUris.add(request.getRequestURI()); } }; ResourceHandler repoHandler = new ResourceHandler(); - repoHandler.setResourceBase( testDir.getAbsolutePath() ); + repoHandler.setResourceBase(testDir.getAbsolutePath()); HandlerList handlerList = new HandlerList(); - handlerList.addHandler( logHandler ); - handlerList.addHandler( repoHandler ); - handlerList.addHandler( new DefaultHandler() ); + handlerList.addHandler(logHandler); + handlerList.addHandler(repoHandler); + handlerList.addHandler(new DefaultHandler()); - Server server = new Server( 0 ); - server.setHandler( handlerList ); + Server server = new Server(0); + server.setHandler(handlerList); server.start(); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - try - { - if ( server.isFailed() ) - { - fail( "Couldn't bind the server socket to a free port!" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + try { + if (server.isFailed()) { + fail("Couldn't bind the server socket to a free port!"); } - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - try - { - verifier.deleteArtifacts( "org.apache.maven.its.mng4554" ); - } - catch ( IOException e ) - { + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + try { + verifier.deleteArtifacts("org.apache.maven.its.mng4554"); + } catch (IOException e) { // expected when running test on Windows using embedded Maven (JAR files locked by plugin class realm) - assertFalse( new File( verifier.getArtifactMetadataPath( "org.apache.maven.its.mng4554", null, null, "maven-metadata-mng4554.xml" ) ).exists() ); + assertFalse(new File(verifier.getArtifactMetadataPath( + "org.apache.maven.its.mng4554", null, null, "maven-metadata-mng4554.xml")) + .exists()); } Map filterProps = verifier.newDefaultFilterMap(); NetworkConnector connector = (NetworkConnector) server.getConnectors()[0]; - filterProps.put( "@port@", Integer.toString( connector.getLocalPort() ) ); - filterProps.put( "@repo@", "repo-it" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); + filterProps.put("@port@", Integer.toString(connector.getLocalPort())); + filterProps.put("@repo@", "repo-it"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8", filterProps); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); - FileUtils.copyDirectoryStructure( new File( testDir, "repo-1" ), new File( testDir, "repo-it" ) ); + FileUtils.copyDirectoryStructure(new File(testDir, "repo-1"), new File(testDir, "repo-it")); - verifier.setLogFileName( "log-refetched-1.txt" ); - verifier.addCliArgument( "a:touch" ); + verifier.setLogFileName("log-refetched-1.txt"); + verifier.addCliArgument("a:touch"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/touch.txt" ); - assertTrue( requestedUris.toString(), requestedUris.contains( metadataUri ) ); + verifier.verifyFilePresent("target/touch.txt"); + assertTrue(requestedUris.toString(), requestedUris.contains(metadataUri)); requestedUris.clear(); // simulate deployment of new plugin which updates the prefix mapping in the remote repo - FileUtils.copyDirectoryStructure( new File( testDir, "repo-2" ), new File( testDir, "repo-it" ) ); + FileUtils.copyDirectoryStructure(new File(testDir, "repo-2"), new File(testDir, "repo-it")); - verifier.setLogFileName( "log-refetched-2.txt" ); - verifier.addCliArgument( "b:touch" ); + verifier.setLogFileName("log-refetched-2.txt"); + verifier.addCliArgument("b:touch"); verifier.execute(); verifier.verifyErrorFreeLog(); - assertTrue( requestedUris.toString(), requestedUris.contains( metadataUri ) ); - } - finally - { + assertTrue(requestedUris.toString(), requestedUris.contains(metadataUri)); + } finally { server.stop(); server.join(); } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4555MetaversionResolutionOfflineTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4555MetaversionResolutionOfflineTest.java index 6f398b8945..cf850acaf2 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4555MetaversionResolutionOfflineTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4555MetaversionResolutionOfflineTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,10 +16,7 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -31,6 +26,9 @@ import java.util.Deque; import java.util.Map; import java.util.concurrent.ConcurrentLinkedDeque; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.eclipse.jetty.server.Handler; import org.eclipse.jetty.server.NetworkConnector; import org.eclipse.jetty.server.Request; @@ -43,13 +41,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4555MetaversionResolutionOfflineTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4555MetaversionResolutionOfflineTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4555MetaversionResolutionOfflineTest() - { - super( "[2.0.3,3.0-alpha-1),[3.0-beta-1,)" ); + public MavenITmng4555MetaversionResolutionOfflineTest() { + super("[2.0.3,3.0-alpha-1),[3.0-beta-1,)"); } /** @@ -58,66 +53,55 @@ public class MavenITmng4555MetaversionResolutionOfflineTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4555" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4555"); final Deque uris = new ConcurrentLinkedDeque<>(); - Handler repoHandler = new AbstractHandler() - { + Handler repoHandler = new AbstractHandler() { @Override - public void handle( String target, Request baseRequest, HttpServletRequest request, - HttpServletResponse response ) - { + public void handle( + String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) { String uri = request.getRequestURI(); - if ( uri.startsWith( "/repo/org/apache/maven/its/mng4555" ) ) - { - uris.add( uri.substring( 34 ) ); + if (uri.startsWith("/repo/org/apache/maven/its/mng4555")) { + uris.add(uri.substring(34)); } - response.setStatus( HttpServletResponse.SC_NOT_FOUND ); - ( (Request) request ).setHandled( true ); + response.setStatus(HttpServletResponse.SC_NOT_FOUND); + ((Request) request).setHandled(true); } }; - Server server = new Server( 0 ); - server.setHandler( repoHandler ); + Server server = new Server(0); + server.setHandler(repoHandler); server.start(); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4555" ); - try - { - if ( server.isFailed() ) - { - fail( "Couldn't bind the server socket to a free port!" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4555"); + try { + if (server.isFailed()) { + fail("Couldn't bind the server socket to a free port!"); } - int port = ( (NetworkConnector) server.getConnectors()[0] ).getLocalPort(); - System.out.println( "Bound server socket to the port " + port ); + int port = ((NetworkConnector) server.getConnectors()[0]).getLocalPort(); + System.out.println("Bound server socket to the port " + port); Map filterProps = verifier.newDefaultFilterMap(); - filterProps.put( "@port@", Integer.toString( port ) ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps ); - verifier.addCliArgument( "--offline" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + filterProps.put("@port@", Integer.toString(port)); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8", filterProps); + verifier.addCliArgument("--offline"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); - } - catch ( VerificationException e ) - { + } catch (VerificationException e) { // expected - } - finally - { + } finally { server.stop(); server.join(); } - assertTrue( uris.toString(), uris.isEmpty() ); + assertTrue(uris.toString(), uris.isEmpty()); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4561MirroringOfPluginRepoTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4561MirroringOfPluginRepoTest.java index 37dc1d21a6..d9e9dcc4a8 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4561MirroringOfPluginRepoTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4561MirroringOfPluginRepoTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Map; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.eclipse.jetty.security.ConstraintMapping; import org.eclipse.jetty.security.ConstraintSecurityHandler; import org.eclipse.jetty.security.HashLoginService; @@ -45,13 +43,10 @@ import static org.eclipse.jetty.util.security.Constraint.__BASIC_AUTH; * * @author Benjamin Bentmann */ -public class MavenITmng4561MirroringOfPluginRepoTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4561MirroringOfPluginRepoTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4561MirroringOfPluginRepoTest() - { - super( "[2.0.3,3.0-alpha-1),[3.0-alpha-7,)" ); + public MavenITmng4561MirroringOfPluginRepoTest() { + super("[2.0.3,3.0-alpha-1),[3.0-alpha-7,)"); } /** @@ -61,69 +56,63 @@ public class MavenITmng4561MirroringOfPluginRepoTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4561" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4561"); Constraint constraint = new Constraint(); - constraint.setName( Constraint.__BASIC_AUTH ); - constraint.setRoles( new String[] { "user" } ); - constraint.setAuthenticate( true ); + constraint.setName(Constraint.__BASIC_AUTH); + constraint.setRoles(new String[] {"user"}); + constraint.setAuthenticate(true); ConstraintMapping constraintMapping = new ConstraintMapping(); - constraintMapping.setConstraint( constraint ); - constraintMapping.setPathSpec( "/*" ); + constraintMapping.setConstraint(constraint); + constraintMapping.setPathSpec("/*"); - HashLoginService userRealm = new HashLoginService( "TestRealm" ); + HashLoginService userRealm = new HashLoginService("TestRealm"); UserStore userStore = new UserStore(); - userStore.addUser( "testuser", new Password( "testtest" ), new String[] { "user" } ); - userRealm.setUserStore( userStore ); + userStore.addUser("testuser", new Password("testtest"), new String[] {"user"}); + userRealm.setUserStore(userStore); - Server server = new Server( 0 ); + Server server = new Server(0); ConstraintSecurityHandler securityHandler = new ConstraintSecurityHandler(); - securityHandler.setLoginService( userRealm ); - securityHandler.setAuthMethod( __BASIC_AUTH ); - securityHandler.setConstraintMappings( new ConstraintMapping[] { constraintMapping } ); + securityHandler.setLoginService(userRealm); + securityHandler.setAuthMethod(__BASIC_AUTH); + securityHandler.setConstraintMappings(new ConstraintMapping[] {constraintMapping}); ResourceHandler repoHandler = new ResourceHandler(); - repoHandler.setResourceBase( testDir.getAbsolutePath() ); + repoHandler.setResourceBase(testDir.getAbsolutePath()); HandlerList handlerList = new HandlerList(); - handlerList.addHandler( securityHandler ); - handlerList.addHandler( repoHandler ); - handlerList.addHandler( new DefaultHandler() ); + handlerList.addHandler(securityHandler); + handlerList.addHandler(repoHandler); + handlerList.addHandler(new DefaultHandler()); - server.setHandler( handlerList ); + server.setHandler(handlerList); server.start(); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - try - { - if ( server.isFailed() ) - { - fail( "Couldn't bind the server socket to a free port!" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + try { + if (server.isFailed()) { + fail("Couldn't bind the server socket to a free port!"); } - int port = ( (NetworkConnector) server.getConnectors()[0] ).getLocalPort(); - System.out.println( "Bound server socket to the port " + port ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4561" ); + int port = ((NetworkConnector) server.getConnectors()[0]).getLocalPort(); + System.out.println("Bound server socket to the port " + port); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4561"); Map filterProps = verifier.newDefaultFilterMap(); - filterProps.put( "@port@", Integer.toString( port ) ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + filterProps.put("@port@", Integer.toString(port)); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8", filterProps); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng4561", "plugin-dep", "0.1", "jar" ); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng4561", "plugin-dep", "0.1", "pom" ); - verifier.verifyFilePresent( "target/touch.txt" ); - } - finally - { + verifier.verifyArtifactPresent("org.apache.maven.its.mng4561", "plugin-dep", "0.1", "jar"); + verifier.verifyArtifactPresent("org.apache.maven.its.mng4561", "plugin-dep", "0.1", "pom"); + verifier.verifyFilePresent("target/touch.txt"); + } finally { server.stop(); server.join(); } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4565MultiConditionProfileActivationTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4565MultiConditionProfileActivationTest.java index 0316afdff7..faaf8559e0 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4565MultiConditionProfileActivationTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4565MultiConditionProfileActivationTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -34,12 +32,9 @@ import org.junit.jupiter.api.Test; * conditions must be satisfied in order for the profile to be activated. */ @Tag("disabled") -public class MavenITmng4565MultiConditionProfileActivationTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng4565MultiConditionProfileActivationTest() - { - super( "(3.2.2,)" ); +public class MavenITmng4565MultiConditionProfileActivationTest extends AbstractMavenIntegrationTestCase { + public MavenITmng4565MultiConditionProfileActivationTest() { + super("(3.2.2,)"); } /** @@ -50,27 +45,26 @@ public class MavenITmng4565MultiConditionProfileActivationTest * @throws Exception in case of failure */ @Test - public void testProfilesWithMultipleActivators() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4565-multi-condition-profile-activation" ); + public void testProfilesWithMultipleActivators() throws Exception { + File testDir = + ResourceExtractor.simpleExtractResources(getClass(), "/mng-4565-multi-condition-profile-activation"); Verifier verifier; - verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "-Dprofile1.on=true" ); - verifier.addCliArgument( "validate" ); + verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("-Dprofile1.on=true"); + verifier.addCliArgument("validate"); verifier.execute(); // - // The property profile1.on = true so only profile1 should be activated. The profile2.on property is not true so profile2 + // The property profile1.on = true so only profile1 should be activated. The profile2.on property is not true so + // profile2 // should not be activated. Only the profile1/touch.txt file should be generated. // verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/profile1/touch.txt" ); - verifier.verifyFileNotPresent( "target/profile2/touch.txt" ); + verifier.verifyFilePresent("target/profile1/touch.txt"); + verifier.verifyFileNotPresent("target/profile2/touch.txt"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4572ModelVersionSurroundedByWhitespaceTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4572ModelVersionSurroundedByWhitespaceTest.java index cb81502b72..4f80fb15f5 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4572ModelVersionSurroundedByWhitespaceTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4572ModelVersionSurroundedByWhitespaceTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4572ModelVersionSurroundedByWhitespaceTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4572ModelVersionSurroundedByWhitespaceTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4572ModelVersionSurroundedByWhitespaceTest() - { - super( "[3.0-alpha-3,)" ); + public MavenITmng4572ModelVersionSurroundedByWhitespaceTest() { + super("[3.0-alpha-3,)"); } /** @@ -46,16 +41,13 @@ public class MavenITmng4572ModelVersionSurroundedByWhitespaceTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4572" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4572"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4580ProjectLevelPluginDepUsedForCliInvocInReactorTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4580ProjectLevelPluginDepUsedForCliInvocInReactorTest.java index 66fd4808b7..3321705c9a 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4580ProjectLevelPluginDepUsedForCliInvocInReactorTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4580ProjectLevelPluginDepUsedForCliInvocInReactorTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4580ProjectLevelPluginDepUsedForCliInvocInReactorTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4580ProjectLevelPluginDepUsedForCliInvocInReactorTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4580ProjectLevelPluginDepUsedForCliInvocInReactorTest() - { - super( "[3.0-beta-1,)" ); + public MavenITmng4580ProjectLevelPluginDepUsedForCliInvocInReactorTest() { + super("[3.0-beta-1,)"); } /** @@ -49,28 +44,25 @@ public class MavenITmng4580ProjectLevelPluginDepUsedForCliInvocInReactorTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4580" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4580"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteDirectory( "sub/target" ); - verifier.addCliArgument( "org.apache.maven.its.plugins:maven-it-plugin-class-loader:load" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteDirectory("sub/target"); + verifier.addCliArgument("org.apache.maven.its.plugins:maven-it-plugin-class-loader:load"); verifier.execute(); verifier.verifyErrorFreeLog(); Properties pclProps; - pclProps = verifier.loadProperties( "target/pcl.properties" ); - assertNotNull( pclProps.getProperty( "org.apache.maven.plugin.coreit.ClassA" ) ); - assertNotNull( pclProps.getProperty( "org/apache/maven/plugin/coreit/a.properties" ) ); + pclProps = verifier.loadProperties("target/pcl.properties"); + assertNotNull(pclProps.getProperty("org.apache.maven.plugin.coreit.ClassA")); + assertNotNull(pclProps.getProperty("org/apache/maven/plugin/coreit/a.properties")); - pclProps = verifier.loadProperties( "sub/target/pcl.properties" ); - assertNull( pclProps.getProperty( "org.apache.maven.plugin.coreit.ClassA" ) ); - assertNull( pclProps.getProperty( "org/apache/maven/plugin/coreit/a.properties" ) ); + pclProps = verifier.loadProperties("sub/target/pcl.properties"); + assertNull(pclProps.getProperty("org.apache.maven.plugin.coreit.ClassA")); + assertNull(pclProps.getProperty("org/apache/maven/plugin/coreit/a.properties")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4586PluginPrefixResolutionFromVersionlessPluginMgmtTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4586PluginPrefixResolutionFromVersionlessPluginMgmtTest.java index 64d07e0601..2d2ed4f2f5 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4586PluginPrefixResolutionFromVersionlessPluginMgmtTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4586PluginPrefixResolutionFromVersionlessPluginMgmtTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,12 +30,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann */ public class MavenITmng4586PluginPrefixResolutionFromVersionlessPluginMgmtTest - extends AbstractMavenIntegrationTestCase -{ + extends AbstractMavenIntegrationTestCase { - public MavenITmng4586PluginPrefixResolutionFromVersionlessPluginMgmtTest() - { - super( "[3.0-beta-1,)" ); + public MavenITmng4586PluginPrefixResolutionFromVersionlessPluginMgmtTest() { + super("[3.0-beta-1,)"); } /** @@ -47,23 +43,20 @@ public class MavenITmng4586PluginPrefixResolutionFromVersionlessPluginMgmtTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4586" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4586"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4586" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "mng4586:touch" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4586"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("mng4586:touch"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/touch.txt" ); + verifier.verifyFilePresent("target/touch.txt"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4590ImportedPomUsesSystemAndUserPropertiesTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4590ImportedPomUsesSystemAndUserPropertiesTest.java index e90cd52997..49419ed81e 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4590ImportedPomUsesSystemAndUserPropertiesTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4590ImportedPomUsesSystemAndUserPropertiesTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4590ImportedPomUsesSystemAndUserPropertiesTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4590ImportedPomUsesSystemAndUserPropertiesTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4590ImportedPomUsesSystemAndUserPropertiesTest() - { - super( "[2.0.9,3.0-alpha-1),[3.0-beta-1,)" ); + public MavenITmng4590ImportedPomUsesSystemAndUserPropertiesTest() { + super("[2.0.9,3.0-alpha-1),[3.0-beta-1,)"); } /** @@ -47,29 +42,27 @@ public class MavenITmng4590ImportedPomUsesSystemAndUserPropertiesTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4590" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4590"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4590" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.setEnvironmentVariable( "MAVEN_OPTS", "-Dtest.file=pom.xml" ); - verifier.addCliArgument( "-Dtest.dir=" + testDir.getAbsolutePath() ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4590"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.setEnvironmentVariable("MAVEN_OPTS", "-Dtest.file=pom.xml"); + verifier.addCliArgument("-Dtest.dir=" + testDir.getAbsolutePath()); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/pom.properties" ); - assertEquals( "1", props.getProperty( "project.dependencyManagement.dependencies" ) ); - assertEquals( "dep-a", props.getProperty( "project.dependencyManagement.dependencies.0.artifactId" ) ); - assertEquals( new File( testDir, "pom.xml" ).getAbsoluteFile(), - new File( props.getProperty( "project.dependencyManagement.dependencies.0.systemPath" ) ) ); + Properties props = verifier.loadProperties("target/pom.properties"); + assertEquals("1", props.getProperty("project.dependencyManagement.dependencies")); + assertEquals("dep-a", props.getProperty("project.dependencyManagement.dependencies.0.artifactId")); + assertEquals( + new File(testDir, "pom.xml").getAbsoluteFile(), + new File(props.getProperty("project.dependencyManagement.dependencies.0.systemPath"))); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4600DependencyOptionalFlagManagementTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4600DependencyOptionalFlagManagementTest.java index 0ea357a927..d8da02c1d5 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4600DependencyOptionalFlagManagementTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4600DependencyOptionalFlagManagementTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4600DependencyOptionalFlagManagementTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4600DependencyOptionalFlagManagementTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4600DependencyOptionalFlagManagementTest() - { - super( "[2.0.3,3.0-alpha-1),[3.0-beta-1,)" ); + public MavenITmng4600DependencyOptionalFlagManagementTest() { + super("[2.0.3,3.0-alpha-1),[3.0-beta-1,)"); } /** @@ -49,21 +44,19 @@ public class MavenITmng4600DependencyOptionalFlagManagementTest * @throws Exception in case of failure */ @Test - public void testitModel() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4600/model" ); + public void testitModel() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4600/model"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/pom.properties" ); - assertEquals( "dep", props.getProperty( "project.dependencies.0.artifactId" ) ); - assertEquals( "false", props.getProperty( "project.dependencies.0.optional" ) ); + Properties props = verifier.loadProperties("target/pom.properties"); + assertEquals("dep", props.getProperty("project.dependencies.0.artifactId")); + assertEquals("false", props.getProperty("project.dependencies.0.optional")); } /** @@ -73,25 +66,22 @@ public class MavenITmng4600DependencyOptionalFlagManagementTest * @throws Exception in case of failure */ @Test - public void testitResolution() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4600/resolution" ); + public void testitResolution() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4600/resolution"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4600" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4600"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List classpath = verifier.loadLines( "target/classpath.txt", "UTF-8" ); - assertTrue( classpath.toString(), classpath.contains( "direct-0.2.jar" ) ); - assertTrue( classpath.toString(), classpath.contains( "transitive-0.1.jar" ) ); + List classpath = verifier.loadLines("target/classpath.txt", "UTF-8"); + assertTrue(classpath.toString(), classpath.contains("direct-0.2.jar")); + assertTrue(classpath.toString(), classpath.contains("transitive-0.1.jar")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4615ValidateRequiredPluginParameterTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4615ValidateRequiredPluginParameterTest.java index cdf1ee1dad..90b96cdef0 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4615ValidateRequiredPluginParameterTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4615ValidateRequiredPluginParameterTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4615ValidateRequiredPluginParameterTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4615ValidateRequiredPluginParameterTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4615ValidateRequiredPluginParameterTest() - { - super( "[2.0.3,3.0-alpha-1),[3.0-beta-2,)" ); + public MavenITmng4615ValidateRequiredPluginParameterTest() { + super("[2.0.3,3.0-alpha-1),[3.0-beta-2,)"); } /** @@ -49,21 +44,19 @@ public class MavenITmng4615ValidateRequiredPluginParameterTest * @throws Exception in case of failure */ @Test - public void testitAllSet() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4615/test-0" ); + public void testitAllSet() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4615/test-0"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/config.properties" ); - assertEquals( "one", props.get( "requiredParam" ) ); - assertEquals( "two", props.get( "requiredParamWithDefault" ) ); + Properties props = verifier.loadProperties("target/config.properties"); + assertEquals("one", props.get("requiredParam")); + assertEquals("two", props.get("requiredParamWithDefault")); } /** @@ -73,27 +66,21 @@ public class MavenITmng4615ValidateRequiredPluginParameterTest * @throws Exception in case of failure */ @Test - public void testitExprMissing() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4615/test-1" ); + public void testitExprMissing() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4615/test-1"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.setLogFileName( "log-a.txt" ); - try - { - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.setLogFileName("log-a.txt"); + try { + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - fail( "Build did not fail despite required plugin parameter missing" ); - } - catch ( VerificationException e ) - { + fail("Build did not fail despite required plugin parameter missing"); + } catch (VerificationException e) { // expected } - } /** @@ -103,23 +90,21 @@ public class MavenITmng4615ValidateRequiredPluginParameterTest * @throws Exception in case of failure */ @Test - public void testitExprSet() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4615/test-1" ); + public void testitExprSet() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4615/test-1"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "-Dconfig.requiredParam=CLI" ); - verifier.setLogFileName( "log-b.txt" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("-Dconfig.requiredParam=CLI"); + verifier.setLogFileName("log-b.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/config.properties" ); - assertEquals( "CLI", props.get( "requiredParam" ) ); - assertEquals( "two", props.get( "requiredParamWithDefault" ) ); + Properties props = verifier.loadProperties("target/config.properties"); + assertEquals("CLI", props.get("requiredParam")); + assertEquals("two", props.get("requiredParamWithDefault")); } /** @@ -129,29 +114,23 @@ public class MavenITmng4615ValidateRequiredPluginParameterTest * @throws Exception in case of failure */ @Test - public void testitPomValMissing() - throws Exception - { + public void testitPomValMissing() throws Exception { // cf. MNG-4764 - requiresMavenVersion( "[3.0-beta-2,)" ); + requiresMavenVersion("[3.0-beta-2,)"); - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4615/test-2a" ); + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4615/test-2a"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - try - { - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + try { + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - fail( "Build did not fail despite required plugin parameter missing" ); - } - catch ( VerificationException e ) - { + fail("Build did not fail despite required plugin parameter missing"); + } catch (VerificationException e) { // expected } - } /** @@ -161,21 +140,18 @@ public class MavenITmng4615ValidateRequiredPluginParameterTest * @throws Exception in case of failure */ @Test - public void testitPomValSet() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4615/test-2b" ); + public void testitPomValSet() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4615/test-2b"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/config.properties" ); - assertEquals( "one", props.get( "requiredParam" ) ); - assertEquals( "http://foo.bar/", props.get( "requiredParamWithDefault" ) ); + Properties props = verifier.loadProperties("target/config.properties"); + assertEquals("one", props.get("requiredParam")); + assertEquals("http://foo.bar/", props.get("requiredParamWithDefault")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4618AggregatorBuiltAfterModulesTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4618AggregatorBuiltAfterModulesTest.java index f1ba996f73..a9b7ac999f 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4618AggregatorBuiltAfterModulesTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4618AggregatorBuiltAfterModulesTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Arrays; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4618AggregatorBuiltAfterModulesTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4618AggregatorBuiltAfterModulesTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4618AggregatorBuiltAfterModulesTest() - { - super( "[2.0.3,3.0-alpha-1),[3.0-beta-1,)" ); + public MavenITmng4618AggregatorBuiltAfterModulesTest() { + super("[2.0.3,3.0-alpha-1),[3.0-beta-1,)"); } /** @@ -48,20 +43,17 @@ public class MavenITmng4618AggregatorBuiltAfterModulesTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4618" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4618"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List mods = verifier.loadLines( "target/log.txt", "UTF-8" ); - assertEquals( Arrays.asList( new String[] { "mod-a", "mod-b", "mod-c", "aggregator" } ), mods ); + List mods = verifier.loadLines("target/log.txt", "UTF-8"); + assertEquals(Arrays.asList(new String[] {"mod-a", "mod-b", "mod-c", "aggregator"}), mods); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4625SettingsXmlInterpolationWithXmlMarkupTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4625SettingsXmlInterpolationWithXmlMarkupTest.java index 520e7d408b..9c94227686 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4625SettingsXmlInterpolationWithXmlMarkupTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4625SettingsXmlInterpolationWithXmlMarkupTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.codehaus.plexus.util.Os; import org.junit.jupiter.api.Test; @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4625SettingsXmlInterpolationWithXmlMarkupTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4625SettingsXmlInterpolationWithXmlMarkupTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4625SettingsXmlInterpolationWithXmlMarkupTest() - { - super( "[3.0-beta-1,)" ); + public MavenITmng4625SettingsXmlInterpolationWithXmlMarkupTest() { + super("[3.0-beta-1,)"); } /** @@ -49,36 +44,30 @@ public class MavenITmng4625SettingsXmlInterpolationWithXmlMarkupTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4625" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4625"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); // http://bugs.java.com/bugdatabase/view_bug.do?bug_id=6468220 // A lot of bugs related to Windows arguments and quoting // Directly called from commandline succeeds, indirect often fails - if( Os.isFamily( Os.FAMILY_WINDOWS ) && !System.getProperties().contains( "CLASSWORLDS_LAUNCHER" ) ) - { - verifier.addCliArgument( "-Dtest.prop=\"&x=y<>\"" ); - verifier.setForkJvm( true ); // force forked JVM, since the workaround expects forked run - } - else - { - verifier.addCliArgument( "-Dtest.prop=&x=y<>" ); + if (Os.isFamily(Os.FAMILY_WINDOWS) && !System.getProperties().contains("CLASSWORLDS_LAUNCHER")) { + verifier.addCliArgument("-Dtest.prop=\"&x=y<>\""); + verifier.setForkJvm(true); // force forked JVM, since the workaround expects forked run + } else { + verifier.addCliArgument("-Dtest.prop=&x=y<>"); } - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/pom.properties" ); - assertEquals( "&x=y<>", props.getProperty( "project.properties.jdbcUrl" ) ); + Properties props = verifier.loadProperties("target/pom.properties"); + assertEquals("&x=y<>", props.getProperty("project.properties.jdbcUrl")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4629NoPomValidationErrorUponMissingSystemDepTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4629NoPomValidationErrorUponMissingSystemDepTest.java index 7a60f75d97..501fb6b7c7 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4629NoPomValidationErrorUponMissingSystemDepTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4629NoPomValidationErrorUponMissingSystemDepTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4629NoPomValidationErrorUponMissingSystemDepTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4629NoPomValidationErrorUponMissingSystemDepTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4629NoPomValidationErrorUponMissingSystemDepTest() - { - super( "[2.0.3,)" ); + public MavenITmng4629NoPomValidationErrorUponMissingSystemDepTest() { + super("[2.0.3,)"); } /** @@ -47,16 +42,13 @@ public class MavenITmng4629NoPomValidationErrorUponMissingSystemDepTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4629" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4629"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4633DualCompilerExecutionsWeaveModeTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4633DualCompilerExecutionsWeaveModeTest.java index 756406e6bf..cf840937a3 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4633DualCompilerExecutionsWeaveModeTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4633DualCompilerExecutionsWeaveModeTest.java @@ -1,10 +1,27 @@ +/* + * 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.it; -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; - import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; @@ -34,13 +51,10 @@ import org.junit.jupiter.api.Test; * @author Kristian Rosenvold */ @Disabled -public class MavenITmng4633DualCompilerExecutionsWeaveModeTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4633DualCompilerExecutionsWeaveModeTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4633DualCompilerExecutionsWeaveModeTest() - { - super( "[3.0-beta-2,)" ); + public MavenITmng4633DualCompilerExecutionsWeaveModeTest() { + super("[3.0-beta-2,)"); } /** @@ -50,18 +64,15 @@ public class MavenITmng4633DualCompilerExecutionsWeaveModeTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4633" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4633"); - Verifier verifier = newVerifier( testDir.getAbsolutePath(), "remote" ); - verifier.setAutoclean( false ); - verifier.addCliArgument( "-T" ); - verifier.addCliArgument( "2W" ); - verifier.addCliArgument( "install" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath(), "remote"); + verifier.setAutoclean(false); + verifier.addCliArgument("-T"); + verifier.addCliArgument("2W"); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4644StrictPomParsingRejectsMisplacedTextTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4644StrictPomParsingRejectsMisplacedTextTest.java index 1cceeab291..0e6f1b73cf 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4644StrictPomParsingRejectsMisplacedTextTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4644StrictPomParsingRejectsMisplacedTextTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4644StrictPomParsingRejectsMisplacedTextTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4644StrictPomParsingRejectsMisplacedTextTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4644StrictPomParsingRejectsMisplacedTextTest() - { - super( "[3.0-alpha-7,)" ); + public MavenITmng4644StrictPomParsingRejectsMisplacedTextTest() { + super("[3.0-alpha-7,)"); } /** @@ -47,25 +42,19 @@ public class MavenITmng4644StrictPomParsingRejectsMisplacedTextTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4644" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4644"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - try - { - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + try { + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - fail( "Should fail to validate the POM syntax due to misplaced text in element." ); - } - catch ( VerificationException e ) - { + fail("Should fail to validate the POM syntax due to misplaced text in element."); + } catch (VerificationException e) { // expected } } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4654ArtifactHandlerForMainArtifactTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4654ArtifactHandlerForMainArtifactTest.java index 50abe6d206..5d0c06a360 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4654ArtifactHandlerForMainArtifactTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4654ArtifactHandlerForMainArtifactTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4654ArtifactHandlerForMainArtifactTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4654ArtifactHandlerForMainArtifactTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4654ArtifactHandlerForMainArtifactTest() - { - super( "[3.0-alpha-3,)" ); + public MavenITmng4654ArtifactHandlerForMainArtifactTest() { + super("[3.0-alpha-3,)"); } /** @@ -47,24 +42,21 @@ public class MavenITmng4654ArtifactHandlerForMainArtifactTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4654" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4654"); - Verifier verifier = newVerifier( testDir.getAbsolutePath(), "remote" ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4654" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath(), "remote"); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4654"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFileNotPresent( "target/repo/org/apache/maven/its/mng4654/test/1.0/test-1.0.mng4654" ); - verifier.verifyFilePresent( "target/repo/org/apache/maven/its/mng4654/test/1.0/test-1.0.jar" ); + verifier.verifyFileNotPresent("target/repo/org/apache/maven/its/mng4654/test/1.0/test-1.0.mng4654"); + verifier.verifyFilePresent("target/repo/org/apache/maven/its/mng4654/test/1.0/test-1.0.jar"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4660OutdatedPackagedArtifact.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4660OutdatedPackagedArtifact.java index aa9f5637e8..e76130a87b 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4660OutdatedPackagedArtifact.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4660OutdatedPackagedArtifact.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,10 +16,7 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; import java.io.IOException; @@ -33,6 +28,9 @@ import java.nio.file.Paths; import java.nio.file.attribute.BasicFileAttributes; import org.apache.maven.shared.utils.io.FileUtils; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; import static java.nio.file.FileVisitResult.CONTINUE; @@ -45,9 +43,8 @@ import static java.nio.file.FileVisitResult.CONTINUE; * @author Martin Kanters */ public class MavenITmng4660OutdatedPackagedArtifact extends AbstractMavenIntegrationTestCase { - public MavenITmng4660OutdatedPackagedArtifact() - { - super( "[4.0.0-alpha-1,)" ); + public MavenITmng4660OutdatedPackagedArtifact() { + super("[4.0.0-alpha-1,)"); } /** @@ -57,119 +54,114 @@ public class MavenITmng4660OutdatedPackagedArtifact extends AbstractMavenIntegra * @throws Exception in case of failure */ @Test - public void testShouldWarnWhenPackagedArtifactIsOutdated() throws Exception - { - final File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4660-outdated-packaged-artifact" ); + public void testShouldWarnWhenPackagedArtifactIsOutdated() throws Exception { + final File testDir = + ResourceExtractor.simpleExtractResources(getClass(), "/mng-4660-outdated-packaged-artifact"); // 1. Package the whole project - final Verifier verifier1 = newVerifier( testDir.getAbsolutePath() ); - verifier1.deleteDirectory( "target" ); - verifier1.deleteArtifacts( "org.apache.maven.its.mng4660" ); + final Verifier verifier1 = newVerifier(testDir.getAbsolutePath()); + verifier1.deleteDirectory("target"); + verifier1.deleteArtifacts("org.apache.maven.its.mng4660"); - verifier1.addCliArgument( "package" ); + verifier1.addCliArgument("package"); verifier1.execute(); - Path module1Jar = testDir.toPath().resolve( "module-a/target/module-a-1.0.jar" ).toAbsolutePath(); + Path module1Jar = + testDir.toPath().resolve("module-a/target/module-a-1.0.jar").toAbsolutePath(); verifier1.verifyErrorFreeLog(); - verifier1.verifyFilePresent( module1Jar.toString() ); + verifier1.verifyFilePresent(module1Jar.toString()); - if ( System.getProperty( "java.version", "" ).startsWith( "1." ) ) - { + if (System.getProperty("java.version", "").startsWith("1.")) { // Simulating the delay between two invocations. It also makes sure we're not hit by tests that run so fast, // that the difference in file modification time (see below) is too small to observe. Java 8 on Linux and // macOS returns that value with "just" second precision, which is not detailed enough. - Thread.sleep( 1_000 ); + Thread.sleep(1_000); } // 2. Create a properties file with some content and compile only that module (module A). - final Verifier verifier2 = newVerifier( testDir.getAbsolutePath() ); - final Path resourcesDirectory = Files.createDirectories( Paths.get( testDir.toString(), "module-a", "src", "main", "resources" ) ); - final Path fileToWrite = resourcesDirectory.resolve( "example.properties" ); - FileUtils.fileWrite( fileToWrite.toString(), "x=42" ); + final Verifier verifier2 = newVerifier(testDir.getAbsolutePath()); + final Path resourcesDirectory = + Files.createDirectories(Paths.get(testDir.toString(), "module-a", "src", "main", "resources")); + final Path fileToWrite = resourcesDirectory.resolve("example.properties"); + FileUtils.fileWrite(fileToWrite.toString(), "x=42"); - verifier2.setAutoclean( false ); - verifier2.addCliArgument( "--projects" ); - verifier2.addCliArgument( ":module-a" ); - verifier2.addCliArgument( "compile" ); + verifier2.setAutoclean(false); + verifier2.addCliArgument("--projects"); + verifier2.addCliArgument(":module-a"); + verifier2.addCliArgument("compile"); verifier2.execute(); - Path module1PropertiesFile = testDir.toPath().resolve( "module-a/target/classes/example.properties" ) + Path module1PropertiesFile = testDir.toPath() + .resolve("module-a/target/classes/example.properties") .toAbsolutePath(); - verifier2.verifyFilePresent( module1PropertiesFile.toString() ); - assertTrue( Files.getLastModifiedTime( module1PropertiesFile ) - .compareTo( Files.getLastModifiedTime( module1Jar ) ) >= 0 ); + verifier2.verifyFilePresent(module1PropertiesFile.toString()); + assertTrue( + Files.getLastModifiedTime(module1PropertiesFile).compareTo(Files.getLastModifiedTime(module1Jar)) >= 0); - Path module1Class = testDir.toPath().resolve( "module-a/target/classes/org/apache/maven/it/Example.class" ) - .toAbsolutePath(); + Path module1Class = testDir.toPath() + .resolve("module-a/target/classes/org/apache/maven/it/Example.class") + .toAbsolutePath(); verifier2.verifyErrorFreeLog(); - verifier2.verifyFilePresent( module1Class.toString() ); + verifier2.verifyFilePresent(module1Class.toString()); // 3. Resume project build from module B, that depends on module A we just touched. Its packaged artifact // is no longer in sync with its compiled artifacts. - final Verifier verifier3 = newVerifier( testDir.getAbsolutePath() ); - verifier3.setAutoclean( false ); - verifier3.addCliArgument( "--resume-from" ); - verifier3.addCliArgument( ":module-b" ); - verifier3.addCliArgument( "compile" ); + final Verifier verifier3 = newVerifier(testDir.getAbsolutePath()); + verifier3.setAutoclean(false); + verifier3.addCliArgument("--resume-from"); + verifier3.addCliArgument(":module-b"); + verifier3.addCliArgument("compile"); verifier3.execute(); verifier3.verifyErrorFreeLog(); - try - { - verifier3.verifyTextInLog( "File '" - + Paths.get( "module-a", "target", "classes", "example.properties" ) - + "' is more recent than the packaged artifact for 'module-a', please run a full `mvn package` build" - ); - } - catch ( VerificationException e ) - { - final StringBuilder message = new StringBuilder( e.getMessage() ); - message.append( System.lineSeparator() ); + try { + verifier3.verifyTextInLog( + "File '" + + Paths.get("module-a", "target", "classes", "example.properties") + + "' is more recent than the packaged artifact for 'module-a', please run a full `mvn package` build"); + } catch (VerificationException e) { + final StringBuilder message = new StringBuilder(e.getMessage()); + message.append(System.lineSeparator()); - message.append( " " ) - .append( module1Jar.toAbsolutePath() ) - .append( " -> " ) - .append( Files.getLastModifiedTime( module1Jar ) ) - .append( System.lineSeparator() ); + message.append(" ") + .append(module1Jar.toAbsolutePath()) + .append(" -> ") + .append(Files.getLastModifiedTime(module1Jar)) + .append(System.lineSeparator()); - message.append( System.lineSeparator() ); + message.append(System.lineSeparator()); - Path outputDirectory = Paths.get( testDir.toString(), "module-a", "target", "classes" ); + Path outputDirectory = Paths.get(testDir.toString(), "module-a", "target", "classes"); - Files.walkFileTree( outputDirectory, new FileVisitor() - { + Files.walkFileTree(outputDirectory, new FileVisitor() { @Override - public FileVisitResult preVisitDirectory( Path dir, BasicFileAttributes attrs ) - { + public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) { return CONTINUE; } @Override - public FileVisitResult visitFile( Path file, BasicFileAttributes attrs ) - { - message.append( " " ) - .append( file.toAbsolutePath() ) - .append( " -> " ) - .append( attrs.lastModifiedTime() ) - .append( System.lineSeparator() ); + public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) { + message.append(" ") + .append(file.toAbsolutePath()) + .append(" -> ") + .append(attrs.lastModifiedTime()) + .append(System.lineSeparator()); return CONTINUE; } @Override - public FileVisitResult visitFileFailed( Path file, IOException exc ) - { + public FileVisitResult visitFileFailed(Path file, IOException exc) { return CONTINUE; } @Override - public FileVisitResult postVisitDirectory( Path dir, IOException exc ) - { + public FileVisitResult postVisitDirectory(Path dir, IOException exc) { return CONTINUE; } - } ); + }); - throw new VerificationException( message.toString(), e.getCause() ); + throw new VerificationException(message.toString(), e.getCause()); } } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4660ResumeFromTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4660ResumeFromTest.java index 722f2d6c70..11af77df21 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4660ResumeFromTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4660ResumeFromTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -34,9 +32,8 @@ import org.junit.jupiter.api.Test; * @author Martin Kanters */ public class MavenITmng4660ResumeFromTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4660ResumeFromTest() - { - super( "[4.0.0-alpha-1,)" ); + public MavenITmng4660ResumeFromTest() { + super("[4.0.0-alpha-1,)"); } /** @@ -48,30 +45,26 @@ public class MavenITmng4660ResumeFromTest extends AbstractMavenIntegrationTestCa * @throws Exception in case of failure */ @Test - public void testShouldResolveOutputDirectoryFromEarlierBuild() throws Exception - { - final File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4660-resume-from" ); + public void testShouldResolveOutputDirectoryFromEarlierBuild() throws Exception { + final File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4660-resume-from"); - final Verifier verifier1 = newVerifier( testDir.getAbsolutePath() ); - verifier1.deleteDirectory( "target" ); - verifier1.deleteArtifacts( "org.apache.maven.its.mng4660" ); + final Verifier verifier1 = newVerifier(testDir.getAbsolutePath()); + verifier1.deleteDirectory("target"); + verifier1.deleteArtifacts("org.apache.maven.its.mng4660"); - try - { - verifier1.addCliArgument( "test" ); // The test goal will not create a packaged artifact + try { + verifier1.addCliArgument("test"); // The test goal will not create a packaged artifact verifier1.execute(); - fail( "Expected this invocation to fail" ); // See TestCase.java - } - catch ( final VerificationException ve ) - { - verifier1.verifyTextInLog( "Deliberately fail test case" ); + fail("Expected this invocation to fail"); // See TestCase.java + } catch (final VerificationException ve) { + verifier1.verifyTextInLog("Deliberately fail test case"); } - final Verifier verifier2 = newVerifier( testDir.getAbsolutePath() ); - verifier2.setAutoclean( false ); - verifier2.addCliArgument( "--resume-from" ); - verifier2.addCliArgument( ":module-b" ); - verifier2.addCliArgument( "compile" ); + final Verifier verifier2 = newVerifier(testDir.getAbsolutePath()); + verifier2.setAutoclean(false); + verifier2.addCliArgument("--resume-from"); + verifier2.addCliArgument(":module-b"); + verifier2.addCliArgument("compile"); verifier2.execute(); // to prevent the unit test from failing (again) verifier2.verifyErrorFreeLog(); @@ -85,30 +78,26 @@ public class MavenITmng4660ResumeFromTest extends AbstractMavenIntegrationTestCa * @throws Exception in case of failure */ @Test - public void testShouldResolvePackagedArtifactFromEarlierBuild() throws Exception - { - final File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4660-resume-from" ); + public void testShouldResolvePackagedArtifactFromEarlierBuild() throws Exception { + final File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4660-resume-from"); - final Verifier verifier1 = newVerifier( testDir.getAbsolutePath() ); - verifier1.deleteDirectory( "target" ); - verifier1.deleteArtifacts( "org.apache.maven.its.mng4660" ); + final Verifier verifier1 = newVerifier(testDir.getAbsolutePath()); + verifier1.deleteDirectory("target"); + verifier1.deleteArtifacts("org.apache.maven.its.mng4660"); - try - { - verifier1.addCliArgument( "verify" ); // The verify goal will create a packaged artifact + try { + verifier1.addCliArgument("verify"); // The verify goal will create a packaged artifact verifier1.execute(); - fail( "Expected this invocation to fail" ); // See TestCase.java - } - catch ( final VerificationException ve ) - { - verifier1.verifyTextInLog( "Deliberately fail test case" ); + fail("Expected this invocation to fail"); // See TestCase.java + } catch (final VerificationException ve) { + verifier1.verifyTextInLog("Deliberately fail test case"); } - final Verifier verifier2 = newVerifier( testDir.getAbsolutePath() ); - verifier2.setAutoclean( false ); - verifier2.addCliArgument( "--resume-from" ); - verifier2.addCliArgument( ":module-b" ); - verifier2.addCliArgument( "compile" ); // to prevent the unit test from failing (again) + final Verifier verifier2 = newVerifier(testDir.getAbsolutePath()); + verifier2.setAutoclean(false); + verifier2.addCliArgument("--resume-from"); + verifier2.addCliArgument(":module-b"); + verifier2.addCliArgument("compile"); // to prevent the unit test from failing (again) verifier2.execute(); verifier2.verifyErrorFreeLog(); diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4666CoreRealmImportTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4666CoreRealmImportTest.java index 1e3c8275d9..b7f592b1e8 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4666CoreRealmImportTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4666CoreRealmImportTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,15 +16,15 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.ArrayList; import java.util.List; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -34,13 +32,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4666CoreRealmImportTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4666CoreRealmImportTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4666CoreRealmImportTest() - { - super( "[2.0.11,2.0.99),[2.1.0,3.0-alpha-1),[3.0-beta-2,)" ); + public MavenITmng4666CoreRealmImportTest() { + super("[2.0.11,2.0.99),[2.1.0,3.0-alpha-1),[3.0-beta-2,)"); } /** @@ -51,71 +46,62 @@ public class MavenITmng4666CoreRealmImportTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4666" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4666"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven", "maven-model", "0.1-stub" ); - verifier.deleteArtifacts( "org.apache.maven", "maven-settings", "0.1-stub" ); - verifier.deleteArtifacts( "org.apache.maven", "maven-project", "0.1-stub" ); - verifier.deleteArtifacts( "org.apache.maven", "maven-artifact", "0.1-stub" ); - verifier.deleteArtifacts( "org.apache.maven", "maven-core", "0.1-stub" ); - verifier.deleteArtifacts( "org.apache.maven", "maven-plugin-api", "0.1-stub" ); - verifier.deleteArtifacts( "org.apache.maven", "maven-plugin-descriptor", "0.1-stub" ); - verifier.deleteArtifacts( "plexus", "plexus-container-default", "0.1-stub" ); - verifier.deleteArtifacts( "org.codehaus.plexus", "plexus-container-default", "0.1-stub" ); - verifier.deleteArtifacts( "org.codehaus.plexus", "plexus-component-api", "0.1-stub" ); - verifier.deleteArtifacts( "org.codehaus.plexus", "plexus-utils", "0.1-stub" ); - verifier.deleteArtifacts( "org.codehaus.plexus", "plexus-classworlds", "0.1-stub" ); - verifier.deleteArtifacts( "org.sonatype.aether", "aether-api", "0.1-stub" ); - verifier.deleteArtifacts( "org.sonatype.aether", "aether-spi", "0.1-stub" ); - verifier.deleteArtifacts( "org.sonatype.aether", "aether-impl", "0.1-stub" ); - verifier.deleteArtifacts( "org.sonatype.sisu", "sisu-inject-plexus", "0.1-stub" ); - verifier.deleteArtifacts( "org.sonatype.spice", "spice-inject-plexus", "0.1-stub" ); - verifier.deleteArtifacts( "classworlds", "classworlds", "0.1-stub" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven", "maven-model", "0.1-stub"); + verifier.deleteArtifacts("org.apache.maven", "maven-settings", "0.1-stub"); + verifier.deleteArtifacts("org.apache.maven", "maven-project", "0.1-stub"); + verifier.deleteArtifacts("org.apache.maven", "maven-artifact", "0.1-stub"); + verifier.deleteArtifacts("org.apache.maven", "maven-core", "0.1-stub"); + verifier.deleteArtifacts("org.apache.maven", "maven-plugin-api", "0.1-stub"); + verifier.deleteArtifacts("org.apache.maven", "maven-plugin-descriptor", "0.1-stub"); + verifier.deleteArtifacts("plexus", "plexus-container-default", "0.1-stub"); + verifier.deleteArtifacts("org.codehaus.plexus", "plexus-container-default", "0.1-stub"); + verifier.deleteArtifacts("org.codehaus.plexus", "plexus-component-api", "0.1-stub"); + verifier.deleteArtifacts("org.codehaus.plexus", "plexus-utils", "0.1-stub"); + verifier.deleteArtifacts("org.codehaus.plexus", "plexus-classworlds", "0.1-stub"); + verifier.deleteArtifacts("org.sonatype.aether", "aether-api", "0.1-stub"); + verifier.deleteArtifacts("org.sonatype.aether", "aether-spi", "0.1-stub"); + verifier.deleteArtifacts("org.sonatype.aether", "aether-impl", "0.1-stub"); + verifier.deleteArtifacts("org.sonatype.sisu", "sisu-inject-plexus", "0.1-stub"); + verifier.deleteArtifacts("org.sonatype.spice", "spice-inject-plexus", "0.1-stub"); + verifier.deleteArtifacts("classworlds", "classworlds", "0.1-stub"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/type.properties" ); - List types = getTypes( props ); - if ( !matchesVersionRange( "[3.0-beta-4,)" ) ) - { + Properties props = verifier.loadProperties("target/type.properties"); + List types = getTypes(props); + if (!matchesVersionRange("[3.0-beta-4,)")) { // MNG-4725, MNG-4807 - types.remove( "org.codehaus.plexus.configuration.PlexusConfiguration" ); - types.remove( "org.codehaus.plexus.logging.Logger" ); + types.remove("org.codehaus.plexus.configuration.PlexusConfiguration"); + types.remove("org.codehaus.plexus.logging.Logger"); } - assertFalse( types.isEmpty() ); - for ( String type : types ) - { - assertEquals( type, props.get( "plugin." + type ), props.get( "core." + type ) ); + assertFalse(types.isEmpty()); + for (String type : types) { + assertEquals(type, props.get("plugin." + type), props.get("core." + type)); } } - private List getTypes( Properties props ) - { + private List getTypes(Properties props) { List types = new ArrayList<>(); - for ( Object o : props.keySet() ) - { + for (Object o : props.keySet()) { String key = o.toString(); - if ( key.startsWith( "core." ) ) - { - String type = key.substring( 5 ); - if ( props.getProperty( key, "" ).length() > 0 ) - { + if (key.startsWith("core.")) { + String type = key.substring(5); + if (props.getProperty(key, "").length() > 0) { // types not in the core realm can't be exported/shared, so ignore those - types.add( type ); + types.add(type); } } } return types; } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4677DisabledPluginConfigInheritanceTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4677DisabledPluginConfigInheritanceTest.java index 12e727fea7..3b5f237a7a 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4677DisabledPluginConfigInheritanceTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4677DisabledPluginConfigInheritanceTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Arrays; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4677DisabledPluginConfigInheritanceTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4677DisabledPluginConfigInheritanceTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4677DisabledPluginConfigInheritanceTest() - { - super( "[2.0.3,3.0-alpha-1),[3.0-beta-2,)" ); + public MavenITmng4677DisabledPluginConfigInheritanceTest() { + super("[2.0.3,3.0-alpha-1),[3.0-beta-2,)"); } /** @@ -48,28 +43,25 @@ public class MavenITmng4677DisabledPluginConfigInheritanceTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4677" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4677"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteDirectory( "child-1/target" ); - verifier.deleteDirectory( "child-2/target" ); - verifier.addCliArgument( "org.apache.maven.its.plugins:maven-it-plugin-log-file:2.1-SNAPSHOT:log-string" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteDirectory("child-1/target"); + verifier.deleteDirectory("child-2/target"); + verifier.addCliArgument("org.apache.maven.its.plugins:maven-it-plugin-log-file:2.1-SNAPSHOT:log-string"); verifier.execute(); verifier.verifyErrorFreeLog(); - List log = verifier.loadLines( "target/log.txt", "UTF-8" ); - assertEquals( Arrays.asList( new String[] { "parent-only" } ), log ); + List log = verifier.loadLines("target/log.txt", "UTF-8"); + assertEquals(Arrays.asList(new String[] {"parent-only"}), log); - log = verifier.loadLines( "child-1/target/log.txt", "UTF-8" ); - assertEquals( Arrays.asList( new String[] { "managed" } ), log ); + log = verifier.loadLines("child-1/target/log.txt", "UTF-8"); + assertEquals(Arrays.asList(new String[] {"managed"}), log); - log = verifier.loadLines( "child-2/target/log.txt", "UTF-8" ); - assertEquals( Arrays.asList( new String[] { "managed" } ), log ); + log = verifier.loadLines("child-2/target/log.txt", "UTF-8"); + assertEquals(Arrays.asList(new String[] {"managed"}), log); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4679SnapshotUpdateInPluginTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4679SnapshotUpdateInPluginTest.java index 9ed8d76435..6ed35c03e4 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4679SnapshotUpdateInPluginTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4679SnapshotUpdateInPluginTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Map; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4679SnapshotUpdateInPluginTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4679SnapshotUpdateInPluginTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4679SnapshotUpdateInPluginTest() - { - super( "[2.0.3,3.0-alpha-1),[3.0-beta-2,)" ); + public MavenITmng4679SnapshotUpdateInPluginTest() { + super("[2.0.3,3.0-alpha-1),[3.0-beta-2,)"); } /** @@ -48,49 +43,43 @@ public class MavenITmng4679SnapshotUpdateInPluginTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4679" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4679"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4679" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng4679"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); Map filterProps = verifier.newDefaultFilterMap(); - filterProps.put( "@repo@", "repo-1" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps ); - verifier.setLogFileName( "log-force-1.txt" ); - verifier.addCliArgument( "validate" ); + filterProps.put("@repo@", "repo-1"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8", filterProps); + verifier.setLogFileName("log-force-1.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - assertChecksum( verifier, "jar", "2ea5c3d713bbaba7b87746449b91cd00e876703d" ); - assertChecksum( verifier, "pom", "0b58dbbc61f81b85a70692ffdce88cf1892a8da4" ); + assertChecksum(verifier, "jar", "2ea5c3d713bbaba7b87746449b91cd00e876703d"); + assertChecksum(verifier, "pom", "0b58dbbc61f81b85a70692ffdce88cf1892a8da4"); - filterProps.put( "@repo@", "repo-2" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps ); - verifier.setLogFileName( "log-force-2.txt" ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "-U" ); - verifier.addCliArgument( "validate" ); + filterProps.put("@repo@", "repo-2"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8", filterProps); + verifier.setLogFileName("log-force-2.txt"); + verifier.deleteDirectory("target"); + verifier.addCliArgument("-U"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - - assertChecksum( verifier, "jar", "f3d46277c2ab45ff9bbd97605c942bed7fc27f97" ); - assertChecksum( verifier, "pom", "127f0dc26035352bb54890315ad7d2ada067756a" ); + assertChecksum(verifier, "jar", "f3d46277c2ab45ff9bbd97605c942bed7fc27f97"); + assertChecksum(verifier, "pom", "127f0dc26035352bb54890315ad7d2ada067756a"); } - private void assertChecksum( Verifier verifier, String ext, String checksum ) - throws Exception - { - String path = verifier.getArtifactPath( "org.apache.maven.its.mng4679", "dep", "0.1-SNAPSHOT", ext ); - String actual = ItUtils.calcHash( new File( path ), "SHA-1" ); - assertEquals( checksum, actual ); + private void assertChecksum(Verifier verifier, String ext, String checksum) throws Exception { + String path = verifier.getArtifactPath("org.apache.maven.its.mng4679", "dep", "0.1-SNAPSHOT", ext); + String actual = ItUtils.calcHash(new File(path), "SHA-1"); + assertEquals(checksum, actual); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4684DistMgmtOverriddenByProfileTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4684DistMgmtOverriddenByProfileTest.java index 199cfc3162..e41e9b0dd5 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4684DistMgmtOverriddenByProfileTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4684DistMgmtOverriddenByProfileTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4684DistMgmtOverriddenByProfileTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4684DistMgmtOverriddenByProfileTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4684DistMgmtOverriddenByProfileTest() - { - super( "[2.0.3,3.0-alpha-1),[3.0-beta-2,)" ); + public MavenITmng4684DistMgmtOverriddenByProfileTest() { + super("[2.0.3,3.0-alpha-1),[3.0-beta-2,)"); } /** @@ -47,36 +42,33 @@ public class MavenITmng4684DistMgmtOverriddenByProfileTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4684" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4684"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "-Pmng4684" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("-Pmng4684"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/pom.properties" ); + Properties props = verifier.loadProperties("target/pom.properties"); - assertEquals( "pr", props.getProperty( "project.distributionManagement.repository.id" ) ); - assertEquals( "http://localhost/r", props.getProperty( "project.distributionManagement.repository.url" ) ); - assertEquals( "", props.getProperty( "project.distributionManagement.repository.name", "" ) ); - assertEquals( "default", props.getProperty( "project.distributionManagement.repository.layout" ) ); - assertEquals( "true", props.getProperty( "project.distributionManagement.repository.uniqueVersion" ) ); + assertEquals("pr", props.getProperty("project.distributionManagement.repository.id")); + assertEquals("http://localhost/r", props.getProperty("project.distributionManagement.repository.url")); + assertEquals("", props.getProperty("project.distributionManagement.repository.name", "")); + assertEquals("default", props.getProperty("project.distributionManagement.repository.layout")); + assertEquals("true", props.getProperty("project.distributionManagement.repository.uniqueVersion")); - assertEquals( "psr", props.getProperty( "project.distributionManagement.snapshotRepository.id" ) ); - assertEquals( "http://localhost/sr", props.getProperty( "project.distributionManagement.snapshotRepository.url" ) ); - assertEquals( "", props.getProperty( "project.distributionManagement.snapshotRepository.name", "" ) ); - assertEquals( "default", props.getProperty( "project.distributionManagement.snapshotRepository.layout" ) ); - assertEquals( "true", props.getProperty( "project.distributionManagement.snapshotRepository.uniqueVersion" ) ); + assertEquals("psr", props.getProperty("project.distributionManagement.snapshotRepository.id")); + assertEquals("http://localhost/sr", props.getProperty("project.distributionManagement.snapshotRepository.url")); + assertEquals("", props.getProperty("project.distributionManagement.snapshotRepository.name", "")); + assertEquals("default", props.getProperty("project.distributionManagement.snapshotRepository.layout")); + assertEquals("true", props.getProperty("project.distributionManagement.snapshotRepository.uniqueVersion")); - assertEquals( "ps", props.getProperty( "project.distributionManagement.site.id" ) ); - assertEquals( "http://localhost/s", props.getProperty( "project.distributionManagement.site.url" ) ); - assertEquals( "passed", props.getProperty( "project.distributionManagement.site.name" ) ); + assertEquals("ps", props.getProperty("project.distributionManagement.site.id")); + assertEquals("http://localhost/s", props.getProperty("project.distributionManagement.site.url")); + assertEquals("passed", props.getProperty("project.distributionManagement.site.name")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4690InterdependentConflictResolutionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4690InterdependentConflictResolutionTest.java index a20d0ab190..f4ca2e0887 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4690InterdependentConflictResolutionTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4690InterdependentConflictResolutionTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,90 +30,72 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4690InterdependentConflictResolutionTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4690InterdependentConflictResolutionTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4690InterdependentConflictResolutionTest() - { - super( "[2.0.9,)" ); + public MavenITmng4690InterdependentConflictResolutionTest() { + super("[2.0.9,)"); } // Ideally, all six permutations of the three direct dependencies should yield the same result... @Test - public void testitADX() - throws Exception - { - requiresMavenVersion( "[3.0-beta-3,)" ); - testit( "test-adx" ); + public void testitADX() throws Exception { + requiresMavenVersion("[3.0-beta-3,)"); + testit("test-adx"); } @Test - public void testitAXD() - throws Exception - { - testit( "test-axd" ); + public void testitAXD() throws Exception { + testit("test-axd"); } @Test - public void testitDAX() - throws Exception - { - requiresMavenVersion( "[3.0-beta-3,)" ); - testit( "test-dax" ); + public void testitDAX() throws Exception { + requiresMavenVersion("[3.0-beta-3,)"); + testit("test-dax"); } @Test - public void testitDXA() - throws Exception - { - testit( "test-dxa" ); + public void testitDXA() throws Exception { + testit("test-dxa"); } @Test - public void testitXAD() - throws Exception - { - testit( "test-xad" ); + public void testitXAD() throws Exception { + testit("test-xad"); } @Test - public void testitXDA() - throws Exception - { - testit( "test-xda" ); + public void testitXDA() throws Exception { + testit("test-xda"); } /** * Verify that conflict resolution doesn't depend on the declaration order of dependencies (from distinct tree * levels) when the resolution of one conflict influences another conflict. */ - private void testit( String test ) - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4690" ); + private void testit(String test) throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4690"); - Verifier verifier = newVerifier( new File( testDir, test ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4690" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.filterFile( "../settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(new File(testDir, test).getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4690"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.filterFile("../settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List classpath = verifier.loadLines( "target/classpath.txt", "UTF-8" ); + List classpath = verifier.loadLines("target/classpath.txt", "UTF-8"); - assertTrue( test + " > " + classpath.toString(), classpath.contains( "a-1.jar" ) ); - assertTrue( test + " > " + classpath.toString(), classpath.contains( "b-1.jar" ) ); - assertTrue( test + " > " + classpath.toString(), classpath.contains( "c-1.jar" ) ); - assertTrue( test + " > " + classpath.toString(), classpath.contains( "d-1.jar" ) ); + assertTrue(test + " > " + classpath.toString(), classpath.contains("a-1.jar")); + assertTrue(test + " > " + classpath.toString(), classpath.contains("b-1.jar")); + assertTrue(test + " > " + classpath.toString(), classpath.contains("c-1.jar")); + assertTrue(test + " > " + classpath.toString(), classpath.contains("d-1.jar")); - assertTrue( test + " > " + classpath.toString(), classpath.contains( "x-1.jar" ) ); - assertTrue( test + " > " + classpath.toString(), classpath.contains( "y-2.jar" ) ); + assertTrue(test + " > " + classpath.toString(), classpath.contains("x-1.jar")); + assertTrue(test + " > " + classpath.toString(), classpath.contains("y-2.jar")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4696MavenProjectDependencyArtifactsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4696MavenProjectDependencyArtifactsTest.java index d3040e0667..bf3b08d38f 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4696MavenProjectDependencyArtifactsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4696MavenProjectDependencyArtifactsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.HashSet; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4696MavenProjectDependencyArtifactsTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4696MavenProjectDependencyArtifactsTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4696MavenProjectDependencyArtifactsTest() - { - super( "[2.0.3,3.0-alpha-1),[3.0-beta-2,)" ); + public MavenITmng4696MavenProjectDependencyArtifactsTest() { + super("[2.0.3,3.0-alpha-1),[3.0-beta-2,)"); } /** @@ -50,31 +45,28 @@ public class MavenITmng4696MavenProjectDependencyArtifactsTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4696" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4696"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4696" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "initialize" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng4696"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("initialize"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/artifact.properties" ); - assertEquals( "3", props.getProperty( "project.dependencyArtifacts.size" ) ); + Properties props = verifier.loadProperties("target/artifact.properties"); + assertEquals("3", props.getProperty("project.dependencyArtifacts.size")); HashSet ids = new HashSet<>(); - ids.add( props.getProperty( "project.dependencyArtifacts.0.artifactId" ) ); - ids.add( props.getProperty( "project.dependencyArtifacts.1.artifactId" ) ); - ids.add( props.getProperty( "project.dependencyArtifacts.2.artifactId" ) ); - assertTrue( ids.toString(), ids.contains( "b" ) ); - assertTrue( ids.toString(), ids.contains( "c" ) ); - assertTrue( ids.toString(), ids.contains( "d" ) ); + ids.add(props.getProperty("project.dependencyArtifacts.0.artifactId")); + ids.add(props.getProperty("project.dependencyArtifacts.1.artifactId")); + ids.add(props.getProperty("project.dependencyArtifacts.2.artifactId")); + assertTrue(ids.toString(), ids.contains("b")); + assertTrue(ids.toString(), ids.contains("c")); + assertTrue(ids.toString(), ids.contains("d")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4720DependencyManagementExclusionMergeTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4720DependencyManagementExclusionMergeTest.java index 9050ecb348..34810b4b3b 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4720DependencyManagementExclusionMergeTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4720DependencyManagementExclusionMergeTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4720DependencyManagementExclusionMergeTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4720DependencyManagementExclusionMergeTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4720DependencyManagementExclusionMergeTest() - { - super( "[2.0.6,)" ); + public MavenITmng4720DependencyManagementExclusionMergeTest() { + super("[2.0.6,)"); } /** @@ -48,30 +43,27 @@ public class MavenITmng4720DependencyManagementExclusionMergeTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4720" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4720"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4720" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng4720"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List classpath = verifier.loadLines( "target/classpath.txt", "UTF-8" ); + List classpath = verifier.loadLines("target/classpath.txt", "UTF-8"); - assertTrue( classpath.toString(), classpath.contains( "a-0.1.jar" ) ); - assertTrue( classpath.toString(), classpath.contains( "c-0.1.jar" ) ); + assertTrue(classpath.toString(), classpath.contains("a-0.1.jar")); + assertTrue(classpath.toString(), classpath.contains("c-0.1.jar")); - assertFalse( classpath.toString(), classpath.contains( "b-0.1.jar" ) ); + assertFalse(classpath.toString(), classpath.contains("b-0.1.jar")); // should better have been excluded as well, now it's a matter of backward-compat - assertTrue( classpath.toString(), classpath.contains( "d-0.1.jar" ) ); + assertTrue(classpath.toString(), classpath.contains("d-0.1.jar")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4721OptionalPluginDependencyTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4721OptionalPluginDependencyTest.java index 3be86f2030..eb2f2e9840 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4721OptionalPluginDependencyTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4721OptionalPluginDependencyTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4721OptionalPluginDependencyTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4721OptionalPluginDependencyTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4721OptionalPluginDependencyTest() - { - super( "[2.0.3,)" ); + public MavenITmng4721OptionalPluginDependencyTest() { + super("[2.0.3,)"); } /** @@ -47,25 +42,22 @@ public class MavenITmng4721OptionalPluginDependencyTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4721" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4721"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4721" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng4721"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/pcl.properties" ); - assertEquals( "1", props.get( "org/apache/maven/plugin/coreit/c.properties.count" ) ); - assertEquals( "1", props.get( "mng4721a.properties.count" ) ); - assertEquals( "0", props.get( "mng4721b.properties.count" ) ); + Properties props = verifier.loadProperties("target/pcl.properties"); + assertEquals("1", props.get("org/apache/maven/plugin/coreit/c.properties.count")); + assertEquals("1", props.get("mng4721a.properties.count")); + assertEquals("0", props.get("mng4721b.properties.count")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4729MirrorProxyAuthUsedByProjectBuilderTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4729MirrorProxyAuthUsedByProjectBuilderTest.java index caa49b7d38..370fde08e5 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4729MirrorProxyAuthUsedByProjectBuilderTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4729MirrorProxyAuthUsedByProjectBuilderTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Map; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.eclipse.jetty.security.ConstraintMapping; import org.eclipse.jetty.security.ConstraintSecurityHandler; import org.eclipse.jetty.security.HashLoginService; @@ -46,13 +44,10 @@ import static org.eclipse.jetty.util.security.Constraint.__BASIC_AUTH; * * @author Benjamin Bentmann */ -public class MavenITmng4729MirrorProxyAuthUsedByProjectBuilderTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4729MirrorProxyAuthUsedByProjectBuilderTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4729MirrorProxyAuthUsedByProjectBuilderTest() - { - super( "[2.0.3,3.0-alpha-1),[3.0-beta-2,)" ); + public MavenITmng4729MirrorProxyAuthUsedByProjectBuilderTest() { + super("[2.0.3,3.0-alpha-1),[3.0-beta-2,)"); } /** @@ -62,68 +57,62 @@ public class MavenITmng4729MirrorProxyAuthUsedByProjectBuilderTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4729" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4729"); Constraint constraint = new Constraint(); - constraint.setName( Constraint.__BASIC_AUTH ); - constraint.setRoles( new String[] { "user" } ); - constraint.setAuthenticate( true ); + constraint.setName(Constraint.__BASIC_AUTH); + constraint.setRoles(new String[] {"user"}); + constraint.setAuthenticate(true); ConstraintMapping constraintMapping = new ConstraintMapping(); - constraintMapping.setConstraint( constraint ); - constraintMapping.setPathSpec( "/*" ); + constraintMapping.setConstraint(constraint); + constraintMapping.setPathSpec("/*"); - HashLoginService userRealm = new HashLoginService( "TestRealm" ); + HashLoginService userRealm = new HashLoginService("TestRealm"); UserStore userStore = new UserStore(); - userStore.addUser( "testuser", new Password( "testtest" ), new String[] { "user" } ); - userRealm.setUserStore( userStore ); + userStore.addUser("testuser", new Password("testtest"), new String[] {"user"}); + userRealm.setUserStore(userStore); - Server server = new Server( 0 ); + Server server = new Server(0); ConstraintSecurityHandler securityHandler = new ConstraintSecurityHandler(); - securityHandler.setLoginService( userRealm ); - securityHandler.setAuthMethod( __BASIC_AUTH ); - securityHandler.setConstraintMappings( new ConstraintMapping[] { constraintMapping } ); + securityHandler.setLoginService(userRealm); + securityHandler.setAuthMethod(__BASIC_AUTH); + securityHandler.setConstraintMappings(new ConstraintMapping[] {constraintMapping}); ResourceHandler repoHandler = new ResourceHandler(); - repoHandler.setResourceBase( testDir.getAbsolutePath() ); + repoHandler.setResourceBase(testDir.getAbsolutePath()); HandlerList handlerList = new HandlerList(); - handlerList.addHandler( securityHandler ); - handlerList.addHandler( repoHandler ); - handlerList.addHandler( new DefaultHandler() ); + handlerList.addHandler(securityHandler); + handlerList.addHandler(repoHandler); + handlerList.addHandler(new DefaultHandler()); - server.setHandler( handlerList ); + server.setHandler(handlerList); server.start(); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - try - { - if ( server.isFailed() ) - { - fail( "Couldn't bind the server socket to a free port!" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + try { + if (server.isFailed()) { + fail("Couldn't bind the server socket to a free port!"); } - int port = ( (NetworkConnector) server.getConnectors()[0] ).getLocalPort(); - System.out.println( "Bound server socket to the port " + port ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4729" ); + int port = ((NetworkConnector) server.getConnectors()[0]).getLocalPort(); + System.out.println("Bound server socket to the port " + port); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4729"); Map filterProps = verifier.newDefaultFilterMap(); - filterProps.put( "@port@", Integer.toString( port ) ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + filterProps.put("@port@", Integer.toString(port)); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8", filterProps); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/pom.properties" ); - assertEquals( "PASSED", props.get( "org.apache.maven.its.mng4729:a:jar:0.1.project.name" ) ); - } - finally - { + Properties props = verifier.loadProperties("target/pom.properties"); + assertEquals("PASSED", props.get("org.apache.maven.its.mng4729:a:jar:0.1.project.name")); + } finally { server.stop(); server.join(); } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4745PluginVersionUpdateTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4745PluginVersionUpdateTest.java index d0e2cacb3d..70ca53e146 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4745PluginVersionUpdateTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4745PluginVersionUpdateTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,15 +16,15 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Map; import java.util.Properties; import org.apache.maven.shared.utils.io.FileUtils; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -34,13 +32,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4745PluginVersionUpdateTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4745PluginVersionUpdateTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4745PluginVersionUpdateTest() - { - super( "[2.0.3,3.0-alpha-1),[3.0-beta-2,)" ); + public MavenITmng4745PluginVersionUpdateTest() { + super("[2.0.3,3.0-alpha-1),[3.0-beta-2,)"); } /** @@ -49,35 +44,33 @@ public class MavenITmng4745PluginVersionUpdateTest * @throws Exception in case of failure */ @Test - public void testitRepoPolicyAlways() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4745" ); + public void testitRepoPolicyAlways() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4745"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.setForkJvm( true ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4745" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.setForkJvm(true); + verifier.deleteArtifacts("org.apache.maven.its.mng4745"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); Map filterProps = verifier.newDefaultFilterMap(); - filterProps.put( "@updates@", "always" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps ); + filterProps.put("@updates@", "always"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8", filterProps); - writeMetadata( testDir, "1.0", "20100729123455" ); - verifier.setLogFileName( "log-1a.txt" ); - verifier.addCliArgument( "org.apache.maven.its.mng4745:maven-it-plugin:touch" ); + writeMetadata(testDir, "1.0", "20100729123455"); + verifier.setLogFileName("log-1a.txt"); + verifier.addCliArgument("org.apache.maven.its.mng4745:maven-it-plugin:touch"); verifier.execute(); - writeMetadata( testDir, "1.1", "20100730123456" ); - verifier.setLogFileName( "log-1b.txt" ); - verifier.addCliArgument( "org.apache.maven.its.mng4745:maven-it-plugin:touch" ); + writeMetadata(testDir, "1.1", "20100730123456"); + verifier.setLogFileName("log-1b.txt"); + verifier.addCliArgument("org.apache.maven.its.mng4745:maven-it-plugin:touch"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/plugin.properties" ); - assertEquals( "1.1", props.get( "plugin.version" ) ); + Properties props = verifier.loadProperties("target/plugin.properties"); + assertEquals("1.1", props.get("plugin.version")); } /** @@ -86,35 +79,33 @@ public class MavenITmng4745PluginVersionUpdateTest * @throws Exception in case of failure */ @Test - public void testitRepoPolicyNever() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4745" ); + public void testitRepoPolicyNever() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4745"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.setForkJvm( true ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4745" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.setForkJvm(true); + verifier.deleteArtifacts("org.apache.maven.its.mng4745"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); Map filterProps = verifier.newDefaultFilterMap(); - filterProps.put( "@updates@", "never" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps ); + filterProps.put("@updates@", "never"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8", filterProps); - writeMetadata( testDir, "1.0", "20100729123455" ); - verifier.setLogFileName( "log-2a.txt" ); - verifier.addCliArgument( "org.apache.maven.its.mng4745:maven-it-plugin:touch" ); + writeMetadata(testDir, "1.0", "20100729123455"); + verifier.setLogFileName("log-2a.txt"); + verifier.addCliArgument("org.apache.maven.its.mng4745:maven-it-plugin:touch"); verifier.execute(); - writeMetadata( testDir, "1.1", "20100730123456" ); - verifier.setLogFileName( "log-2b.txt" ); - verifier.addCliArgument( "org.apache.maven.its.mng4745:maven-it-plugin:touch" ); + writeMetadata(testDir, "1.1", "20100730123456"); + verifier.setLogFileName("log-2b.txt"); + verifier.addCliArgument("org.apache.maven.its.mng4745:maven-it-plugin:touch"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/plugin.properties" ); - assertEquals( "1.0", props.get( "plugin.version" ) ); + Properties props = verifier.loadProperties("target/plugin.properties"); + assertEquals("1.0", props.get("plugin.version")); } /** @@ -123,59 +114,54 @@ public class MavenITmng4745PluginVersionUpdateTest * @throws Exception in case of failure */ @Test - public void testitForceUpdate() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4745" ); + public void testitForceUpdate() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4745"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.setForkJvm( true ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4745" ); - verifier.addCliArgument( "-U" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.setForkJvm(true); + verifier.deleteArtifacts("org.apache.maven.its.mng4745"); + verifier.addCliArgument("-U"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); Map filterProps = verifier.newDefaultFilterMap(); - filterProps.put( "@updates@", "never" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps ); + filterProps.put("@updates@", "never"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8", filterProps); - writeMetadata( testDir, "1.0", "20100729123455" ); - verifier.setLogFileName( "log-3a.txt" ); - verifier.addCliArgument( "org.apache.maven.its.mng4745:maven-it-plugin:touch" ); + writeMetadata(testDir, "1.0", "20100729123455"); + verifier.setLogFileName("log-3a.txt"); + verifier.addCliArgument("org.apache.maven.its.mng4745:maven-it-plugin:touch"); verifier.execute(); - writeMetadata( testDir, "1.1", "20100730123456" ); - verifier.setLogFileName( "log-3b.txt" ); - verifier.addCliArgument( "org.apache.maven.its.mng4745:maven-it-plugin:touch" ); + writeMetadata(testDir, "1.1", "20100730123456"); + verifier.setLogFileName("log-3b.txt"); + verifier.addCliArgument("org.apache.maven.its.mng4745:maven-it-plugin:touch"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/plugin.properties" ); - assertEquals( "1.1", props.get( "plugin.version" ) ); + Properties props = verifier.loadProperties("target/plugin.properties"); + assertEquals("1.1", props.get("plugin.version")); } - private static void writeMetadata( File testdir, String version, String timestamp ) - throws Exception - { - StringBuilder content = new StringBuilder( 1024 ); - content.append( "\n" ); - content.append( "\n" ); - content.append( " org.apache.maven.its.mng4745\n" ); - content.append( " maven-it-plugin\n" ); - content.append( " \n" ); - content.append( " " + version + "\n" ); - content.append( " " + version + "\n" ); - content.append( " \n" ); - content.append( " 1.0\n" ); - content.append( " \n" ); - content.append( " " + timestamp + "\n" ); - content.append( " \n" ); - content.append( "\n" ); + private static void writeMetadata(File testdir, String version, String timestamp) throws Exception { + StringBuilder content = new StringBuilder(1024); + content.append("\n"); + content.append("\n"); + content.append(" org.apache.maven.its.mng4745\n"); + content.append(" maven-it-plugin\n"); + content.append(" \n"); + content.append(" " + version + "\n"); + content.append(" " + version + "\n"); + content.append(" \n"); + content.append(" 1.0\n"); + content.append(" \n"); + content.append(" " + timestamp + "\n"); + content.append(" \n"); + content.append("\n"); - File metadata = new File( testdir, "repo/org/apache/maven/its/mng4745/maven-it-plugin/maven-metadata.xml" ); + File metadata = new File(testdir, "repo/org/apache/maven/its/mng4745/maven-it-plugin/maven-metadata.xml"); metadata.getParentFile().mkdirs(); - FileUtils.fileWrite( metadata.getAbsolutePath(), "UTF-8", content.toString() ); + FileUtils.fileWrite(metadata.getAbsolutePath(), "UTF-8", content.toString()); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4747JavaAgentUsedByPluginTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4747JavaAgentUsedByPluginTest.java index b34304daef..b5eb4cd936 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4747JavaAgentUsedByPluginTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4747JavaAgentUsedByPluginTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4747JavaAgentUsedByPluginTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4747JavaAgentUsedByPluginTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4747JavaAgentUsedByPluginTest() - { - super( "[2.0.3,3.0-alpha-1),[3.0-beta-2,)" ); + public MavenITmng4747JavaAgentUsedByPluginTest() { + super("[2.0.3,3.0-alpha-1),[3.0-beta-2,)"); } /** @@ -48,25 +43,22 @@ public class MavenITmng4747JavaAgentUsedByPluginTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - requiresJavaVersion( "[1.5,)" ); + public void testit() throws Exception { + requiresJavaVersion("[1.5,)"); - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4747" ); + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4747"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.setEnvironmentVariable( "MAVEN_OPTS", "-javaagent:agent.jar" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.setEnvironmentVariable("MAVEN_OPTS", "-javaagent:agent.jar"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props1 = verifier.loadProperties( "target/agent.properties" ); - Properties props2 = verifier.loadProperties( "target/plugin.properties" ); - assertNotNull( props1.get( "Mng4747Agent" ) ); - assertEquals( props1.get( "Mng4747Agent" ), props2.get( "Mng4747Agent" ) ); + Properties props1 = verifier.loadProperties("target/agent.properties"); + Properties props2 = verifier.loadProperties("target/plugin.properties"); + assertNotNull(props1.get("Mng4747Agent")); + assertEquals(props1.get("Mng4747Agent"), props2.get("Mng4747Agent")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4750ResolvedMavenProjectDependencyArtifactsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4750ResolvedMavenProjectDependencyArtifactsTest.java index 50b0f13044..105437f1a4 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4750ResolvedMavenProjectDependencyArtifactsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4750ResolvedMavenProjectDependencyArtifactsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4750ResolvedMavenProjectDependencyArtifactsTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4750ResolvedMavenProjectDependencyArtifactsTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4750ResolvedMavenProjectDependencyArtifactsTest() - { - super( "[2.0.3,3.0-alpha-1),[3.0,)" ); + public MavenITmng4750ResolvedMavenProjectDependencyArtifactsTest() { + super("[2.0.3,3.0-alpha-1),[3.0,)"); } /** @@ -49,30 +44,27 @@ public class MavenITmng4750ResolvedMavenProjectDependencyArtifactsTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4750" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4750"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4750" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "initialize" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng4750"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("initialize"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/artifact.properties" ); - assertEquals( "1", props.getProperty( "project.dependencyArtifacts.size" ) ); + Properties props = verifier.loadProperties("target/artifact.properties"); + assertEquals("1", props.getProperty("project.dependencyArtifacts.size")); - String path = props.getProperty( "project.dependencyArtifacts.0.file" ); - assertNotNull( path ); - assertTrue( path, new File( path ).isFile() ); + String path = props.getProperty("project.dependencyArtifacts.0.file"); + assertNotNull(path); + assertTrue(path, new File(path).isFile()); - String version = props.getProperty( "project.dependencyArtifacts.0.version" ); - assertEquals( "0.1", version ); + String version = props.getProperty("project.dependencyArtifacts.0.version"); + assertEquals("0.1", version); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4755FetchRemoteMetadataForVersionRangeTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4755FetchRemoteMetadataForVersionRangeTest.java index 87358a984f..513b016a95 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4755FetchRemoteMetadataForVersionRangeTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4755FetchRemoteMetadataForVersionRangeTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4755FetchRemoteMetadataForVersionRangeTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4755FetchRemoteMetadataForVersionRangeTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4755FetchRemoteMetadataForVersionRangeTest() - { - super( "[2.0.3,3.0-alpha-1),[3.0-beta-3,)" ); + public MavenITmng4755FetchRemoteMetadataForVersionRangeTest() { + super("[2.0.3,3.0-alpha-1),[3.0-beta-3,)"); } /** @@ -48,33 +43,30 @@ public class MavenITmng4755FetchRemoteMetadataForVersionRangeTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4755" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4755"); // setup: install a local version - Verifier verifier = newVerifier( new File( testDir, "dependency" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4755" ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(new File(testDir, "dependency").getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng4755"); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); // test: resolve remote version - verifier = newVerifier( new File( testDir, "test" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "validate" ); + verifier = newVerifier(new File(testDir, "test").getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List cp = verifier.loadLines( "target/classpath.txt", "UTF-8" ); - assertTrue( cp.toString(), cp.contains( "dep-1.jar" ) ); + List cp = verifier.loadLines("target/classpath.txt", "UTF-8"); + assertTrue(cp.toString(), cp.contains("dep-1.jar")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4761PluginLevelDependencyScopesTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4761PluginLevelDependencyScopesTest.java index 783fad554c..9b282653f6 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4761PluginLevelDependencyScopesTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4761PluginLevelDependencyScopesTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author jdcasey */ @Tag("disabled") -public class MavenITmng4761PluginLevelDependencyScopesTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4761PluginLevelDependencyScopesTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4761PluginLevelDependencyScopesTest() - { - super( "(2.2.1,2.99)(3.0-beta-2,)" ); + public MavenITmng4761PluginLevelDependencyScopesTest() { + super("(2.2.1,2.99)(3.0-beta-2,)"); } /** @@ -52,21 +47,18 @@ public class MavenITmng4761PluginLevelDependencyScopesTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - final File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4761" ); + public void testit() throws Exception { + final File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4761"); - final Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4761" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + final Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4761"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4765LocalPomProjectBuilderTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4765LocalPomProjectBuilderTest.java index 1e1f28426b..9295741a26 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4765LocalPomProjectBuilderTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4765LocalPomProjectBuilderTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4765LocalPomProjectBuilderTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4765LocalPomProjectBuilderTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4765LocalPomProjectBuilderTest() - { - super( "[2.0.3,3.0-alpha-1),[3.0-beta-3,)" ); + public MavenITmng4765LocalPomProjectBuilderTest() { + super("[2.0.3,3.0-alpha-1),[3.0-beta-3,)"); } /** @@ -47,21 +42,18 @@ public class MavenITmng4765LocalPomProjectBuilderTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4765" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4765"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "-Duser.prop=OK" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("-Duser.prop=OK"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/pom.properties" ); - assertEquals( "PASSED - OK", props.get( "test.xml.project.name" ) ); + Properties props = verifier.loadProperties("target/pom.properties"); + assertEquals("PASSED - OK", props.get("test.xml.project.name")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4768NearestMatchConflictResolutionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4768NearestMatchConflictResolutionTest.java index c1d2e552e9..07a17c46d2 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4768NearestMatchConflictResolutionTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4768NearestMatchConflictResolutionTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,59 +30,44 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4768NearestMatchConflictResolutionTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4768NearestMatchConflictResolutionTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4768NearestMatchConflictResolutionTest() - { - super( "[2.0.9,)" ); + public MavenITmng4768NearestMatchConflictResolutionTest() { + super("[2.0.9,)"); } // Ideally, all six permutations of the three direct dependencies should yield the same result... @Test - public void testitABD() - throws Exception - { - testit( "test-abd" ); + public void testitABD() throws Exception { + testit("test-abd"); } @Test - public void testitADB() - throws Exception - { - requiresMavenVersion( "[3.0-beta-3,)" ); - testit( "test-adb" ); + public void testitADB() throws Exception { + requiresMavenVersion("[3.0-beta-3,)"); + testit("test-adb"); } @Test - public void testitBAD() - throws Exception - { - testit( "test-bad" ); + public void testitBAD() throws Exception { + testit("test-bad"); } @Test - public void testitBDA() - throws Exception - { - testit( "test-bda" ); + public void testitBDA() throws Exception { + testit("test-bda"); } @Test - public void testitDAB() - throws Exception - { - requiresMavenVersion( "[3.0-beta-3,)" ); - testit( "test-dab" ); + public void testitDAB() throws Exception { + requiresMavenVersion("[3.0-beta-3,)"); + testit("test-dab"); } @Test - public void testitDBA() - throws Exception - { - testit( "test-dba" ); + public void testitDBA() throws Exception { + testit("test-dba"); } /** @@ -92,31 +75,28 @@ public class MavenITmng4768NearestMatchConflictResolutionTest * And for conflicting dependencies on distinct tree levels, "nearest" shouldn't be subject to the dependency * order. */ - private void testit( String test ) - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4768" ); + private void testit(String test) throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4768"); - Verifier verifier = newVerifier( new File( testDir, test ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4768" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.filterFile( "../settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(new File(testDir, test).getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4768"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.filterFile("../settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List classpath = verifier.loadLines( "target/classpath.txt", "UTF-8" ); + List classpath = verifier.loadLines("target/classpath.txt", "UTF-8"); - assertTrue( test + " > " + classpath.toString(), classpath.contains( "a-2.0.jar" ) ); - assertTrue( test + " > " + classpath.toString(), classpath.contains( "b-0.1.jar" ) ); - assertTrue( test + " > " + classpath.toString(), classpath.contains( "c-0.1.jar" ) ); - assertTrue( test + " > " + classpath.toString(), classpath.contains( "d-0.1.jar" ) ); + assertTrue(test + " > " + classpath.toString(), classpath.contains("a-2.0.jar")); + assertTrue(test + " > " + classpath.toString(), classpath.contains("b-0.1.jar")); + assertTrue(test + " > " + classpath.toString(), classpath.contains("c-0.1.jar")); + assertTrue(test + " > " + classpath.toString(), classpath.contains("d-0.1.jar")); - assertFalse( test + " > " + classpath.toString(), classpath.contains( "a-2.1.jar" ) ); - assertFalse( test + " > " + classpath.toString(), classpath.contains( "a-1.0.jar" ) ); + assertFalse(test + " > " + classpath.toString(), classpath.contains("a-2.1.jar")); + assertFalse(test + " > " + classpath.toString(), classpath.contains("a-1.0.jar")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4771PluginPrefixResolutionDoesntTouchDisabledRepoTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4771PluginPrefixResolutionDoesntTouchDisabledRepoTest.java index ed12e3c337..1de286411d 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4771PluginPrefixResolutionDoesntTouchDisabledRepoTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4771PluginPrefixResolutionDoesntTouchDisabledRepoTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,10 +16,7 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -31,6 +26,9 @@ import java.util.Deque; import java.util.Map; import java.util.concurrent.ConcurrentLinkedDeque; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.eclipse.jetty.server.NetworkConnector; import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.Server; @@ -44,13 +42,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4771PluginPrefixResolutionDoesntTouchDisabledRepoTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4771PluginPrefixResolutionDoesntTouchDisabledRepoTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4771PluginPrefixResolutionDoesntTouchDisabledRepoTest() - { - super( "[2.0.3,3.0-alpha-1),[3.0-beta-3,)" ); + public MavenITmng4771PluginPrefixResolutionDoesntTouchDisabledRepoTest() { + super("[2.0.3,3.0-alpha-1),[3.0-beta-3,)"); } /** @@ -60,63 +55,53 @@ public class MavenITmng4771PluginPrefixResolutionDoesntTouchDisabledRepoTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4771" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4771"); final Deque requestedUris = new ConcurrentLinkedDeque<>(); - AbstractHandler logHandler = new AbstractHandler() - { + AbstractHandler logHandler = new AbstractHandler() { @Override - public void handle( String target, Request baseRequest, HttpServletRequest request, - HttpServletResponse response ) - { - requestedUris.add( request.getRequestURI() ); + public void handle( + String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) { + requestedUris.add(request.getRequestURI()); } }; HandlerList handlerList = new HandlerList(); - handlerList.addHandler( logHandler ); - handlerList.addHandler( new DefaultHandler() ); + handlerList.addHandler(logHandler); + handlerList.addHandler(new DefaultHandler()); - Server server = new Server( 0 ); - server.setHandler( handlerList ); + Server server = new Server(0); + server.setHandler(handlerList); server.start(); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - try - { - if ( server.isFailed() ) - { - fail( "Couldn't bind the server socket to a free port!" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + try { + if (server.isFailed()) { + fail("Couldn't bind the server socket to a free port!"); } - int port = ( (NetworkConnector) server.getConnectors()[0] ).getLocalPort(); - System.out.println( "Bound server socket to the port " + port ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); + int port = ((NetworkConnector) server.getConnectors()[0]).getLocalPort(); + System.out.println("Bound server socket to the port " + port); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); Map filterProps = verifier.newDefaultFilterMap(); - filterProps.put( "@port@", Integer.toString( port ) ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps ); - verifier.addCliArgument( "-U" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "mng4771:touch" ); + filterProps.put("@port@", Integer.toString(port)); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8", filterProps); + verifier.addCliArgument("-U"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("mng4771:touch"); verifier.execute(); verifier.verifyErrorFreeLog(); - fail( "Build should have failed to resolve unknown prefix" ); - } - catch ( VerificationException e ) - { + fail("Build should have failed to resolve unknown prefix"); + } catch (VerificationException e) { // expected - } - finally - { + } finally { server.stop(); server.join(); } - assertTrue( requestedUris.toString(), requestedUris.isEmpty() ); + assertTrue(requestedUris.toString(), requestedUris.isEmpty()); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4772PluginVersionResolutionDoesntTouchDisabledRepoTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4772PluginVersionResolutionDoesntTouchDisabledRepoTest.java index a9a1290e69..011a18b780 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4772PluginVersionResolutionDoesntTouchDisabledRepoTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4772PluginVersionResolutionDoesntTouchDisabledRepoTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,10 +16,7 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -32,6 +27,9 @@ import java.util.Collections; import java.util.List; import java.util.Map; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.eclipse.jetty.server.NetworkConnector; import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.Server; @@ -45,13 +43,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4772PluginVersionResolutionDoesntTouchDisabledRepoTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4772PluginVersionResolutionDoesntTouchDisabledRepoTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4772PluginVersionResolutionDoesntTouchDisabledRepoTest() - { - super( "[2.0.3,3.0-alpha-1),[3.0-beta-3,)" ); + public MavenITmng4772PluginVersionResolutionDoesntTouchDisabledRepoTest() { + super("[2.0.3,3.0-alpha-1),[3.0-beta-3,)"); } /** @@ -61,63 +56,53 @@ public class MavenITmng4772PluginVersionResolutionDoesntTouchDisabledRepoTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4772" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4772"); - final List requestedUris = Collections.synchronizedList( new ArrayList() ); + final List requestedUris = Collections.synchronizedList(new ArrayList()); - AbstractHandler logHandler = new AbstractHandler() - { + AbstractHandler logHandler = new AbstractHandler() { @Override - public void handle( String target, Request baseRequest, HttpServletRequest request, - HttpServletResponse response ) - { - requestedUris.add( request.getRequestURI() ); + public void handle( + String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) { + requestedUris.add(request.getRequestURI()); } }; HandlerList handlerList = new HandlerList(); - handlerList.addHandler( logHandler ); - handlerList.addHandler( new DefaultHandler() ); + handlerList.addHandler(logHandler); + handlerList.addHandler(new DefaultHandler()); - Server server = new Server( 0 ); - server.setHandler( handlerList ); + Server server = new Server(0); + server.setHandler(handlerList); server.start(); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - try - { - if ( server.isFailed() ) - { - fail( "Couldn't bind the server socket to a free port!" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + try { + if (server.isFailed()) { + fail("Couldn't bind the server socket to a free port!"); } - int port = ( (NetworkConnector) server.getConnectors()[0] ).getLocalPort(); - System.out.println( "Bound server socket to the port " + port ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); + int port = ((NetworkConnector) server.getConnectors()[0]).getLocalPort(); + System.out.println("Bound server socket to the port " + port); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); Map filterProps = verifier.newDefaultFilterMap(); - filterProps.put( "@port@", Integer.toString( port ) ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps ); - verifier.addCliArgument( "-U" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "org.apache.maven.its.mng4772:maven-it-plugin:touch" ); + filterProps.put("@port@", Integer.toString(port)); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8", filterProps); + verifier.addCliArgument("-U"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("org.apache.maven.its.mng4772:maven-it-plugin:touch"); verifier.execute(); verifier.verifyErrorFreeLog(); - fail( "Build should have failed to resolve version for unknown plugin" ); - } - catch ( VerificationException e ) - { + fail("Build should have failed to resolve version for unknown plugin"); + } catch (VerificationException e) { // expected - } - finally - { + } finally { server.stop(); server.join(); } - assertTrue( requestedUris.toString(), requestedUris.isEmpty() ); + assertTrue(requestedUris.toString(), requestedUris.isEmpty()); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4776ForkedReactorPluginVersionResolutionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4776ForkedReactorPluginVersionResolutionTest.java index ec775190b7..956b660125 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4776ForkedReactorPluginVersionResolutionTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4776ForkedReactorPluginVersionResolutionTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4776ForkedReactorPluginVersionResolutionTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4776ForkedReactorPluginVersionResolutionTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4776ForkedReactorPluginVersionResolutionTest() - { - super( "[2.0.3,3.0-alpha-1),[3.0-beta-3,)" ); + public MavenITmng4776ForkedReactorPluginVersionResolutionTest() { + super("[2.0.3,3.0-alpha-1),[3.0-beta-3,)"); } /** @@ -48,21 +43,19 @@ public class MavenITmng4776ForkedReactorPluginVersionResolutionTest * @throws Exception in case of failure */ @Test - public void testitLifecycle() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4776" ); + public void testitLifecycle() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4776"); - Verifier verifier = newVerifier( testDir.getAbsolutePath(), "remote" ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteDirectory( "sub/target" ); - verifier.setLogFileName( "log-lifecycle.txt" ); - verifier.addCliArgument( "test" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath(), "remote"); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteDirectory("sub/target"); + verifier.setLogFileName("log-lifecycle.txt"); + verifier.addCliArgument("test"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "sub/target/log.txt" ); + verifier.verifyFilePresent("sub/target/log.txt"); } /** @@ -73,21 +66,19 @@ public class MavenITmng4776ForkedReactorPluginVersionResolutionTest * @throws Exception in case of failure */ @Test - public void testitCmdLine() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4776" ); + public void testitCmdLine() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4776"); - Verifier verifier = newVerifier( testDir.getAbsolutePath(), "remote" ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteDirectory( "sub/target" ); - verifier.setLogFileName( "log-cli.txt" ); - verifier.addCliArgument( "org.apache.maven.its.plugins:maven-it-plugin-fork:2.1-SNAPSHOT:fork-lifecycle-aggregator" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath(), "remote"); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteDirectory("sub/target"); + verifier.setLogFileName("log-cli.txt"); + verifier.addCliArgument( + "org.apache.maven.its.plugins:maven-it-plugin-fork:2.1-SNAPSHOT:fork-lifecycle-aggregator"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "sub/target/log.txt" ); + verifier.verifyFilePresent("sub/target/log.txt"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4779MultipleDepsWithVersionRangeFromLocalRepoTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4779MultipleDepsWithVersionRangeFromLocalRepoTest.java index d41af61c06..4224a30fd2 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4779MultipleDepsWithVersionRangeFromLocalRepoTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4779MultipleDepsWithVersionRangeFromLocalRepoTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4779MultipleDepsWithVersionRangeFromLocalRepoTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4779MultipleDepsWithVersionRangeFromLocalRepoTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4779MultipleDepsWithVersionRangeFromLocalRepoTest() - { - super( "[2.0.3,)" ); + public MavenITmng4779MultipleDepsWithVersionRangeFromLocalRepoTest() { + super("[2.0.3,)"); } /** @@ -48,22 +43,19 @@ public class MavenITmng4779MultipleDepsWithVersionRangeFromLocalRepoTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4779" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4779"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "test/target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4779" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("test/target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4779"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List classpath = verifier.loadLines( "test/target/classpath.txt", "UTF-8" ); + List classpath = verifier.loadLines("test/target/classpath.txt", "UTF-8"); - assertEquals( classpath.toString(), 4, classpath.size() ); + assertEquals(classpath.toString(), 4, classpath.size()); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4781DeploymentToNexusStagingRepoTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4781DeploymentToNexusStagingRepoTest.java index 0e1829a2e9..2c93aa7f77 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4781DeploymentToNexusStagingRepoTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4781DeploymentToNexusStagingRepoTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,9 +16,7 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -29,6 +25,8 @@ import java.io.File; import java.util.Deque; import java.util.concurrent.ConcurrentLinkedDeque; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.eclipse.jetty.server.Handler; import org.eclipse.jetty.server.NetworkConnector; import org.eclipse.jetty.server.Request; @@ -44,9 +42,7 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4781DeploymentToNexusStagingRepoTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4781DeploymentToNexusStagingRepoTest extends AbstractMavenIntegrationTestCase { private Server server; private int port; @@ -55,64 +51,51 @@ public class MavenITmng4781DeploymentToNexusStagingRepoTest private final Deque deployedUris = new ConcurrentLinkedDeque<>(); - public MavenITmng4781DeploymentToNexusStagingRepoTest() - { - super( "[2.0.3,)" ); + public MavenITmng4781DeploymentToNexusStagingRepoTest() { + super("[2.0.3,)"); } @BeforeEach - public void setUp() - throws Exception - { - Handler repoHandler = new AbstractHandler() - { + public void setUp() throws Exception { + Handler repoHandler = new AbstractHandler() { private volatile boolean putSeen; @Override - public void handle( String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response ) - { - System.out.println( "Handling " + request.getMethod() + " " + request.getRequestURL() ); + public void handle( + String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) { + System.out.println("Handling " + request.getMethod() + " " + request.getRequestURL()); - if ( "PUT".equalsIgnoreCase( request.getMethod() ) ) - { - response.setStatus( HttpServletResponse.SC_CREATED ); - deployedUris.add( request.getRequestURI() ); + if ("PUT".equalsIgnoreCase(request.getMethod())) { + response.setStatus(HttpServletResponse.SC_CREATED); + deployedUris.add(request.getRequestURI()); putSeen = true; - } - else if ( !putSeen ) - { - response.setStatus( HttpServletResponse.SC_BAD_REQUEST ); - } - else - { - response.setStatus( HttpServletResponse.SC_NOT_FOUND ); - requestedUris.add( request.getRequestURI() ); + } else if (!putSeen) { + response.setStatus(HttpServletResponse.SC_BAD_REQUEST); + } else { + response.setStatus(HttpServletResponse.SC_NOT_FOUND); + requestedUris.add(request.getRequestURI()); } - ( (Request) request ).setHandled( true ); + ((Request) request).setHandled(true); } }; HandlerList handlerList = new HandlerList(); - handlerList.addHandler( repoHandler ); + handlerList.addHandler(repoHandler); - server = new Server( 0 ); - server.setHandler( handlerList ); + server = new Server(0); + server.setHandler(handlerList); server.start(); - if ( server.isFailed() ) - { - fail( "Couldn't bind the server socket to a free port!" ); + if (server.isFailed()) { + fail("Couldn't bind the server socket to a free port!"); } - port = ( (NetworkConnector) server.getConnectors()[0] ).getLocalPort(); - System.out.println( "Bound server socket to the port " + port ); + port = ((NetworkConnector) server.getConnectors()[0]).getLocalPort(); + System.out.println("Bound server socket to the port " + port); } @AfterEach - protected void tearDown() - throws Exception - { - if ( server != null ) - { + protected void tearDown() throws Exception { + if (server != null) { server.stop(); server.join(); } @@ -130,21 +113,19 @@ public class MavenITmng4781DeploymentToNexusStagingRepoTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4781" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4781"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.addCliArgument( "-DdeploymentPort=" + port ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.addCliArgument("-DdeploymentPort=" + port); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - assertTrue( deployedUris.contains( "/repo/org/apache/maven/its/mng4781/release/1.0/release-1.0.jar" ) ); - assertTrue( deployedUris.contains( "/repo/org/apache/maven/its/mng4781/release/1.0/release-1.0.pom" ) ); - assertTrue( deployedUris.contains( "/repo/org/apache/maven/its/mng4781/release/maven-metadata.xml" ) ); - assertTrue( requestedUris.contains( "/repo/org/apache/maven/its/mng4781/release/maven-metadata.xml" ) ); + assertTrue(deployedUris.contains("/repo/org/apache/maven/its/mng4781/release/1.0/release-1.0.jar")); + assertTrue(deployedUris.contains("/repo/org/apache/maven/its/mng4781/release/1.0/release-1.0.pom")); + assertTrue(deployedUris.contains("/repo/org/apache/maven/its/mng4781/release/maven-metadata.xml")); + assertTrue(requestedUris.contains("/repo/org/apache/maven/its/mng4781/release/maven-metadata.xml")); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4785TransitiveResolutionInForkedThreadTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4785TransitiveResolutionInForkedThreadTest.java index ea2505fa1a..144504a936 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4785TransitiveResolutionInForkedThreadTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4785TransitiveResolutionInForkedThreadTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4785TransitiveResolutionInForkedThreadTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4785TransitiveResolutionInForkedThreadTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4785TransitiveResolutionInForkedThreadTest() - { - super( "[2.0.3,3.0-alpha-1),[3.0-beta-4,)" ); + public MavenITmng4785TransitiveResolutionInForkedThreadTest() { + super("[2.0.3,3.0-alpha-1),[3.0-beta-4,)"); } /** @@ -48,25 +43,22 @@ public class MavenITmng4785TransitiveResolutionInForkedThreadTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4785" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4785"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4785" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4785"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/artifacts.properties" ); - String path = props.getProperty( "org.apache.maven.its.mng4785:dep:jar:0.1-SNAPSHOT", "" ); - assertTrue( path, path.endsWith( "dep-0.1-SNAPSHOT.jar" ) ); + Properties props = verifier.loadProperties("target/artifacts.properties"); + String path = props.getProperty("org.apache.maven.its.mng4785:dep:jar:0.1-SNAPSHOT", ""); + assertTrue(path, path.endsWith("dep-0.1-SNAPSHOT.jar")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4786AntBased21xMojoSupportTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4786AntBased21xMojoSupportTest.java index 8b37c351a9..ae39710ca9 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4786AntBased21xMojoSupportTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4786AntBased21xMojoSupportTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4786AntBased21xMojoSupportTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4786AntBased21xMojoSupportTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4786AntBased21xMojoSupportTest() - { - super( "[2.0.3,3.0-alpha-1),[3.0-beta-4,)" ); + public MavenITmng4786AntBased21xMojoSupportTest() { + super("[2.0.3,3.0-alpha-1),[3.0-beta-4,)"); } /** @@ -49,19 +44,16 @@ public class MavenITmng4786AntBased21xMojoSupportTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4786" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4786"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/ant.txt" ); + verifier.verifyFilePresent("target/ant.txt"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4788InstallationToCustomLocalRepoTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4788InstallationToCustomLocalRepoTest.java index 2605c29f44..f69f1be2fa 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4788InstallationToCustomLocalRepoTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4788InstallationToCustomLocalRepoTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4788InstallationToCustomLocalRepoTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4788InstallationToCustomLocalRepoTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4788InstallationToCustomLocalRepoTest() - { - super( "[2.0.3,3.0-alpha-1),[3.0-beta-4,)" ); + public MavenITmng4788InstallationToCustomLocalRepoTest() { + super("[2.0.3,3.0-alpha-1),[3.0-beta-4,)"); } /** @@ -46,20 +41,18 @@ public class MavenITmng4788InstallationToCustomLocalRepoTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4788" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4788"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/local-repo/test-0.1-SNAPSHOT.jar" ); - verifier.verifyFileNotPresent( "target/local-repo/org/apache/maven/its/mng4788/test/0.1-SNAPSHOT/test-0.1-SNAPSHOT.jar" ); + verifier.verifyFilePresent("target/local-repo/test-0.1-SNAPSHOT.jar"); + verifier.verifyFileNotPresent( + "target/local-repo/org/apache/maven/its/mng4788/test/0.1-SNAPSHOT/test-0.1-SNAPSHOT.jar"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4789ScopeInheritanceMeetsConflictTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4789ScopeInheritanceMeetsConflictTest.java index 0350c1a48f..b1124331f9 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4789ScopeInheritanceMeetsConflictTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4789ScopeInheritanceMeetsConflictTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4789ScopeInheritanceMeetsConflictTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4789ScopeInheritanceMeetsConflictTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4789ScopeInheritanceMeetsConflictTest() - { - super( "[2.0.3,3.0-alpha-1),[3.0-beta-4,)" ); + public MavenITmng4789ScopeInheritanceMeetsConflictTest() { + super("[2.0.3,3.0-alpha-1),[3.0-beta-4,)"); } /** @@ -48,36 +43,33 @@ public class MavenITmng4789ScopeInheritanceMeetsConflictTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4789" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4789"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4789" ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteArtifacts("org.apache.maven.its.mng4789"); + verifier.deleteDirectory("target"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List compile = verifier.loadLines( "target/compile.txt", "UTF-8" ); - assertFalse( compile.toString(), compile.contains( "a-0.1.jar" ) ); - assertTrue( compile.toString(), compile.contains( "b-0.1.jar" ) ); - assertFalse( compile.toString(), compile.contains( "x-0.1.jar" ) ); + List compile = verifier.loadLines("target/compile.txt", "UTF-8"); + assertFalse(compile.toString(), compile.contains("a-0.1.jar")); + assertTrue(compile.toString(), compile.contains("b-0.1.jar")); + assertFalse(compile.toString(), compile.contains("x-0.1.jar")); - List runtime = verifier.loadLines( "target/runtime.txt", "UTF-8" ); - assertFalse( runtime.toString(), runtime.contains( "a-0.1.jar" ) ); - assertTrue( runtime.toString(), runtime.contains( "b-0.1.jar" ) ); - assertFalse( runtime.toString(), runtime.contains( "x-0.1.jar" ) ); + List runtime = verifier.loadLines("target/runtime.txt", "UTF-8"); + assertFalse(runtime.toString(), runtime.contains("a-0.1.jar")); + assertTrue(runtime.toString(), runtime.contains("b-0.1.jar")); + assertFalse(runtime.toString(), runtime.contains("x-0.1.jar")); - List test = verifier.loadLines( "target/test.txt", "UTF-8" ); - assertTrue( test.toString(), test.contains( "a-0.1.jar" ) ); - assertTrue( test.toString(), test.contains( "b-0.1.jar" ) ); - assertTrue( test.toString(), test.contains( "x-0.1.jar" ) ); + List test = verifier.loadLines("target/test.txt", "UTF-8"); + assertTrue(test.toString(), test.contains("a-0.1.jar")); + assertTrue(test.toString(), test.contains("b-0.1.jar")); + assertTrue(test.toString(), test.contains("x-0.1.jar")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4791ProjectBuilderResolvesRemotePomArtifactTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4791ProjectBuilderResolvesRemotePomArtifactTest.java index 3abc13347e..c27ec69710 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4791ProjectBuilderResolvesRemotePomArtifactTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4791ProjectBuilderResolvesRemotePomArtifactTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4791ProjectBuilderResolvesRemotePomArtifactTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4791ProjectBuilderResolvesRemotePomArtifactTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4791ProjectBuilderResolvesRemotePomArtifactTest() - { - super( "[2.0.3,3.0-alpha-1),[3.0-beta-4,)" ); + public MavenITmng4791ProjectBuilderResolvesRemotePomArtifactTest() { + super("[2.0.3,3.0-alpha-1),[3.0-beta-4,)"); } /** @@ -48,28 +43,25 @@ public class MavenITmng4791ProjectBuilderResolvesRemotePomArtifactTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4791" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4791"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4791" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4791"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/pom.properties" ); + Properties props = verifier.loadProperties("target/pom.properties"); - assertEquals( "0.1-20100902.190819-1", - props.getProperty( "org.apache.maven.its.mng4791:a:pom:0.1-SNAPSHOT.version" ) ); - String path = props.getProperty( "org.apache.maven.its.mng4791:a:pom:0.1-SNAPSHOT.file" ); - assertTrue( path, path.endsWith( ".pom" ) ); + assertEquals( + "0.1-20100902.190819-1", props.getProperty("org.apache.maven.its.mng4791:a:pom:0.1-SNAPSHOT.version")); + String path = props.getProperty("org.apache.maven.its.mng4791:a:pom:0.1-SNAPSHOT.file"); + assertTrue(path, path.endsWith(".pom")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4795DepResolutionInReactorProjectForkedByLifecycleTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4795DepResolutionInReactorProjectForkedByLifecycleTest.java index 75fc0a19c7..7c08213caa 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4795DepResolutionInReactorProjectForkedByLifecycleTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4795DepResolutionInReactorProjectForkedByLifecycleTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4795DepResolutionInReactorProjectForkedByLifecycleTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4795DepResolutionInReactorProjectForkedByLifecycleTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4795DepResolutionInReactorProjectForkedByLifecycleTest() - { - super( "[2.0.3,3.0-alpha-1),[3.0-beta-4,)" ); + public MavenITmng4795DepResolutionInReactorProjectForkedByLifecycleTest() { + super("[2.0.3,3.0-alpha-1),[3.0-beta-4,)"); } /** @@ -48,24 +43,21 @@ public class MavenITmng4795DepResolutionInReactorProjectForkedByLifecycleTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4795" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4795"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteDirectory( "sub/target" ); - verifier.addCliArgument( "process-sources" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteDirectory("sub/target"); + verifier.addCliArgument("process-sources"); verifier.execute(); verifier.verifyErrorFreeLog(); - List compile0 = verifier.loadLines( "sub/target/compile-0.txt", "UTF-8" ); - assertTrue( compile0.toString(), compile0.contains( "maven-core-it-support-1.0.jar" ) ); + List compile0 = verifier.loadLines("sub/target/compile-0.txt", "UTF-8"); + assertTrue(compile0.toString(), compile0.contains("maven-core-it-support-1.0.jar")); - List compile1 = verifier.loadLines( "sub/target/compile-1.txt", "UTF-8" ); - assertTrue( compile1.toString(), compile1.contains( "maven-core-it-support-1.0.jar" ) ); + List compile1 = verifier.loadLines("sub/target/compile-1.txt", "UTF-8"); + assertTrue(compile1.toString(), compile1.contains("maven-core-it-support-1.0.jar")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4800NearestWinsVsScopeWideningTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4800NearestWinsVsScopeWideningTest.java index 81fd14c37b..fae02a1afd 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4800NearestWinsVsScopeWideningTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4800NearestWinsVsScopeWideningTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,27 +30,20 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4800NearestWinsVsScopeWideningTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4800NearestWinsVsScopeWideningTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4800NearestWinsVsScopeWideningTest() - { - super( "[3.0-beta-4,)" ); + public MavenITmng4800NearestWinsVsScopeWideningTest() { + super("[3.0-beta-4,)"); } @Test - public void testitAB() - throws Exception - { - testit( "test-ab" ); + public void testitAB() throws Exception { + testit("test-ab"); } @Test - public void testitBA() - throws Exception - { - testit( "test-ba" ); + public void testitBA() throws Exception { + testit("test-ba"); } /** @@ -60,41 +51,38 @@ public class MavenITmng4800NearestWinsVsScopeWideningTest * a wider scope than the nearer dependency, i.e. one should still end up with the nearer dependency (s:1) and * its subtree (x) but in the wider scope (compile). */ - private void testit( String test ) - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4800" ); + private void testit(String test) throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4800"); - Verifier verifier = newVerifier( new File( testDir, test ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4800" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.filterFile( "../settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(new File(testDir, test).getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4800"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.filterFile("../settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List compile = verifier.loadLines( "target/compile.txt", "UTF-8" ); + List compile = verifier.loadLines("target/compile.txt", "UTF-8"); - assertTrue( test + " > " + compile.toString(), compile.contains( "b-0.1.jar" ) ); - assertTrue( test + " > " + compile.toString(), compile.contains( "c-0.1.jar" ) ); - assertTrue( test + " > " + compile.toString(), compile.contains( "s-0.1.jar" ) ); - assertTrue( test + " > " + compile.toString(), compile.contains( "x-0.1.jar" ) ); - assertFalse( test + " > " + compile.toString(), compile.contains( "a-0.1.jar" ) ); - assertFalse( test + " > " + compile.toString(), compile.contains( "s-0.2.jar" ) ); - assertFalse( test + " > " + compile.toString(), compile.contains( "y-0.1.jar" ) ); + assertTrue(test + " > " + compile.toString(), compile.contains("b-0.1.jar")); + assertTrue(test + " > " + compile.toString(), compile.contains("c-0.1.jar")); + assertTrue(test + " > " + compile.toString(), compile.contains("s-0.1.jar")); + assertTrue(test + " > " + compile.toString(), compile.contains("x-0.1.jar")); + assertFalse(test + " > " + compile.toString(), compile.contains("a-0.1.jar")); + assertFalse(test + " > " + compile.toString(), compile.contains("s-0.2.jar")); + assertFalse(test + " > " + compile.toString(), compile.contains("y-0.1.jar")); - List runtime = verifier.loadLines( "target/runtime.txt", "UTF-8" ); + List runtime = verifier.loadLines("target/runtime.txt", "UTF-8"); - assertTrue( test + " > " + runtime.toString(), runtime.contains( "b-0.1.jar" ) ); - assertTrue( test + " > " + runtime.toString(), runtime.contains( "c-0.1.jar" ) ); - assertTrue( test + " > " + runtime.toString(), runtime.contains( "s-0.1.jar" ) ); - assertTrue( test + " > " + runtime.toString(), runtime.contains( "x-0.1.jar" ) ); - assertTrue( test + " > " + runtime.toString(), runtime.contains( "a-0.1.jar" ) ); - assertFalse( test + " > " + runtime.toString(), runtime.contains( "s-0.2.jar" ) ); - assertFalse( test + " > " + runtime.toString(), runtime.contains( "y-0.1.jar" ) ); + assertTrue(test + " > " + runtime.toString(), runtime.contains("b-0.1.jar")); + assertTrue(test + " > " + runtime.toString(), runtime.contains("c-0.1.jar")); + assertTrue(test + " > " + runtime.toString(), runtime.contains("s-0.1.jar")); + assertTrue(test + " > " + runtime.toString(), runtime.contains("x-0.1.jar")); + assertTrue(test + " > " + runtime.toString(), runtime.contains("a-0.1.jar")); + assertFalse(test + " > " + runtime.toString(), runtime.contains("s-0.2.jar")); + assertFalse(test + " > " + runtime.toString(), runtime.contains("y-0.1.jar")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4811CustomComponentConfiguratorTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4811CustomComponentConfiguratorTest.java index a81b094004..8d238034dd 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4811CustomComponentConfiguratorTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4811CustomComponentConfiguratorTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,25 +16,22 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** * This is a test set for MNG-4811. */ -public class MavenITmng4811CustomComponentConfiguratorTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4811CustomComponentConfiguratorTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4811CustomComponentConfiguratorTest() - { - super( "[2.0.3,3.0-alpha-1)[3.0,)" ); + public MavenITmng4811CustomComponentConfiguratorTest() { + super("[2.0.3,3.0-alpha-1)[3.0,)"); } /** @@ -45,21 +40,18 @@ public class MavenITmng4811CustomComponentConfiguratorTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4811" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4811"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/config.properties" ); - assertEquals( "PASSED", props.getProperty( "stringParam" ) ); - assertEquals( "configured", props.getProperty( "customParam" ) ); + Properties props = verifier.loadProperties("target/config.properties"); + assertEquals("PASSED", props.getProperty("stringParam")); + assertEquals("configured", props.getProperty("customParam")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4814ReResolutionOfDependenciesDuringReactorTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4814ReResolutionOfDependenciesDuringReactorTest.java index 8a92a4ec42..e70267c28a 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4814ReResolutionOfDependenciesDuringReactorTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4814ReResolutionOfDependenciesDuringReactorTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; -import java.util.ArrayList; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4814ReResolutionOfDependenciesDuringReactorTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4814ReResolutionOfDependenciesDuringReactorTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4814ReResolutionOfDependenciesDuringReactorTest() - { - super( "[3.0,)" ); + public MavenITmng4814ReResolutionOfDependenciesDuringReactorTest() { + super("[3.0,)"); } /** @@ -50,28 +44,26 @@ public class MavenITmng4814ReResolutionOfDependenciesDuringReactorTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4814" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4814"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteDirectory( "consumer/target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4814" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArguments( "validate", - "org.apache.maven.its.plugins:maven-it-plugin-dependency-resolution:2.1-SNAPSHOT:aggregate-test" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteDirectory("consumer/target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4814"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArguments( + "validate", + "org.apache.maven.its.plugins:maven-it-plugin-dependency-resolution:2.1-SNAPSHOT:aggregate-test"); verifier.execute(); verifier.verifyErrorFreeLog(); - List compile = verifier.loadLines( "consumer/target/compile.txt", "UTF-8" ); + List compile = verifier.loadLines("consumer/target/compile.txt", "UTF-8"); - assertFalse( compile.toString(), compile.contains( "0.1-SNAPSHOT/producer-0.1-SNAPSHOT.jar" ) ); - assertTrue( compile.toString(), compile.contains( "producer/pom.xml" ) ); + assertFalse(compile.toString(), compile.contains("0.1-SNAPSHOT/producer-0.1-SNAPSHOT.jar")); + assertTrue(compile.toString(), compile.contains("producer/pom.xml")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4829ChecksumFailureWarningTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4829ChecksumFailureWarningTest.java index 2d22b51000..e678b0e228 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4829ChecksumFailureWarningTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4829ChecksumFailureWarningTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4829ChecksumFailureWarningTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4829ChecksumFailureWarningTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4829ChecksumFailureWarningTest() - { - super( "[2.0.3,3.0-alpha-1)[3.0,)" ); + public MavenITmng4829ChecksumFailureWarningTest() { + super("[2.0.3,3.0-alpha-1)[3.0,)"); } /** @@ -47,40 +42,34 @@ public class MavenITmng4829ChecksumFailureWarningTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4829" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4829"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4829" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4829"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List lines = verifier.loadFile( new File( testDir, verifier.getLogFileName() ), false ); + List lines = verifier.loadFile(new File(testDir, verifier.getLogFileName()), false); boolean foundWarningJar = false, foundWarningPom = false; - for ( String line : lines ) - { - if ( line.matches( "(?i)\\[WARNING\\].*Checksum.*failed.*fa23720355eead3906fdf4ffd2a1a5f5.*" ) ) - { + for (String line : lines) { + if (line.matches("(?i)\\[WARNING\\].*Checksum.*failed.*fa23720355eead3906fdf4ffd2a1a5f5.*")) { foundWarningPom = true; - } - else if ( line.matches( "(?i)\\[WARNING\\].*Checksum.*failed.*d912aa49cba88e7e9c578e042953f7ce307daac5.*" ) ) - { + } else if (line.matches( + "(?i)\\[WARNING\\].*Checksum.*failed.*d912aa49cba88e7e9c578e042953f7ce307daac5.*")) { foundWarningJar = true; } } - assertTrue( "Checksum warning for corrupt.pom has not been logged.", foundWarningPom ); - assertTrue( "Checksum warning for corrupt.jar has not been logged.", foundWarningJar ); + assertTrue("Checksum warning for corrupt.pom has not been logged.", foundWarningPom); + assertTrue("Checksum warning for corrupt.jar has not been logged.", foundWarningJar); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4834ParentProjectResolvedFromRemoteReposTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4834ParentProjectResolvedFromRemoteReposTest.java index 8778475e81..2bdefe27bb 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4834ParentProjectResolvedFromRemoteReposTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4834ParentProjectResolvedFromRemoteReposTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4834ParentProjectResolvedFromRemoteReposTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4834ParentProjectResolvedFromRemoteReposTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4834ParentProjectResolvedFromRemoteReposTest() - { - super( "[2.0.3,3.0-alpha-1),[3.0,)" ); + public MavenITmng4834ParentProjectResolvedFromRemoteReposTest() { + super("[2.0.3,3.0-alpha-1),[3.0,)"); } /** @@ -48,24 +43,21 @@ public class MavenITmng4834ParentProjectResolvedFromRemoteReposTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4834" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4834"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4834" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4834"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/pom.properties" ); - assertEquals( "PASSED", props.getProperty( "project.parent.description" ) ); + Properties props = verifier.loadProperties("target/pom.properties"); + assertEquals("PASSED", props.getProperty("project.parent.description")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4840MavenPrerequisiteTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4840MavenPrerequisiteTest.java index b572e4052c..802548298b 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4840MavenPrerequisiteTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4840MavenPrerequisiteTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4840MavenPrerequisiteTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4840MavenPrerequisiteTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4840MavenPrerequisiteTest() - { - super( "[2.1.0,3.0-alpha-1),[3.0.2,)" ); + public MavenITmng4840MavenPrerequisiteTest() { + super("[2.1.0,3.0-alpha-1),[3.0.2,)"); } /** @@ -46,27 +41,22 @@ public class MavenITmng4840MavenPrerequisiteTest * @throws Exception in case of failure */ @Test - public void testitMojoExecution() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4840" ); + public void testitMojoExecution() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4840"); - Verifier verifier = newVerifier( new File( testDir, "test-1" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4840" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.filterFile( "../settings-template.xml", "settings.xml", "UTF-8" ); - try - { - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(new File(testDir, "test-1").getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4840"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.filterFile("../settings-template.xml", "settings.xml", "UTF-8"); + try { + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - fail( "Build did not fail despite unsatisfied prerequisite of plugin on Maven version." ); - } - catch ( Exception e ) - { + fail("Build did not fail despite unsatisfied prerequisite of plugin on Maven version."); + } catch (Exception e) { // expected, unsolvable version conflict } } @@ -78,24 +68,21 @@ public class MavenITmng4840MavenPrerequisiteTest * @throws Exception in case of failure */ @Test - public void testitPluginVersionResolution() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4840" ); + public void testitPluginVersionResolution() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4840"); - Verifier verifier = newVerifier( new File( testDir, "test-2" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4840" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.filterFile( "../settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "org.apache.maven.its.mng4840:maven-mng4840-plugin:touch" ); + Verifier verifier = newVerifier(new File(testDir, "test-2").getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4840"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.filterFile("../settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("org.apache.maven.its.mng4840:maven-mng4840-plugin:touch"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/touch-1.txt" ); - verifier.verifyFileNotPresent( "target/touch-2.txt" ); + verifier.verifyFilePresent("target/touch-1.txt"); + verifier.verifyFileNotPresent("target/touch-2.txt"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4842ParentResolutionOfDependencyPomTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4842ParentResolutionOfDependencyPomTest.java index 62c0bfb038..f4bf7c337f 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4842ParentResolutionOfDependencyPomTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4842ParentResolutionOfDependencyPomTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4842ParentResolutionOfDependencyPomTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4842ParentResolutionOfDependencyPomTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4842ParentResolutionOfDependencyPomTest() - { - super( "[2.0.3,3.0-alpha-1),[3.0,)" ); + public MavenITmng4842ParentResolutionOfDependencyPomTest() { + super("[2.0.3,3.0-alpha-1),[3.0,)"); } /** @@ -49,26 +44,24 @@ public class MavenITmng4842ParentResolutionOfDependencyPomTest * @throws Exception in case of failure */ @Test - public void testitCore() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4842" ); + public void testitCore() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4842"); - Verifier verifier = newVerifier( new File( testDir, "core" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4842" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.filterFile( "../settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(new File(testDir, "core").getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4842"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.filterFile("../settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List compile = verifier.loadLines( "target/compile.txt", "UTF-8" ); + List compile = verifier.loadLines("target/compile.txt", "UTF-8"); - assertTrue( compile.toString(), compile.contains( "dep-0.1.jar" ) ); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng4842", "parent", "0.1", "pom" ); + assertTrue(compile.toString(), compile.contains("dep-0.1.jar")); + verifier.verifyArtifactPresent("org.apache.maven.its.mng4842", "parent", "0.1", "pom"); } /** @@ -79,23 +72,20 @@ public class MavenITmng4842ParentResolutionOfDependencyPomTest * @throws Exception in case of failure */ @Test - public void testitPlugin() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4842" ); + public void testitPlugin() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4842"); - Verifier verifier = newVerifier( new File( testDir, "plugin" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4842" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.filterFile( "../settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(new File(testDir, "plugin").getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4842"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.filterFile("../settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng4842", "parent", "0.1", "pom" ); + verifier.verifyArtifactPresent("org.apache.maven.its.mng4842", "parent", "0.1", "pom"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4872ReactorResolutionAttachedWithExclusionsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4872ReactorResolutionAttachedWithExclusionsTest.java index aae05d6779..dc56b62445 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4872ReactorResolutionAttachedWithExclusionsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4872ReactorResolutionAttachedWithExclusionsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4872ReactorResolutionAttachedWithExclusionsTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4872ReactorResolutionAttachedWithExclusionsTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4872ReactorResolutionAttachedWithExclusionsTest() - { - super( "[3.0-beta-1,)" ); + public MavenITmng4872ReactorResolutionAttachedWithExclusionsTest() { + super("[3.0-beta-1,)"); } /** @@ -47,24 +42,21 @@ public class MavenITmng4872ReactorResolutionAttachedWithExclusionsTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4872" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4872"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "consumer/target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4872" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("consumer/target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4872"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List artifacts = verifier.loadLines( "consumer/target/artifacts.txt", "UTF-8" ); + List artifacts = verifier.loadLines("consumer/target/artifacts.txt", "UTF-8"); - assertTrue( artifacts.toString(), artifacts.contains( "org.apache.maven.its.mng4872:producer:jar:0.1" ) ); - assertTrue( artifacts.toString(), artifacts.contains( "org.apache.maven.its.mng4872:producer:jar:shaded:0.1" ) ); - assertFalse( artifacts.toString(), artifacts.contains( "org.apache.maven.its.mng4872:excluded:jar:0.1" ) ); + assertTrue(artifacts.toString(), artifacts.contains("org.apache.maven.its.mng4872:producer:jar:0.1")); + assertTrue(artifacts.toString(), artifacts.contains("org.apache.maven.its.mng4872:producer:jar:shaded:0.1")); + assertFalse(artifacts.toString(), artifacts.contains("org.apache.maven.its.mng4872:excluded:jar:0.1")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4874UpdateLatestPluginVersionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4874UpdateLatestPluginVersionTest.java index f55216ca32..7f5b3aa9ce 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4874UpdateLatestPluginVersionTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4874UpdateLatestPluginVersionTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import org.apache.maven.shared.utils.io.FileUtils; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4874UpdateLatestPluginVersionTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4874UpdateLatestPluginVersionTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4874UpdateLatestPluginVersionTest() - { - super( "[2.0.3,3.0-alpha-1),[3.0.1,)" ); + public MavenITmng4874UpdateLatestPluginVersionTest() { + super("[2.0.3,3.0-alpha-1),[3.0.1,)"); } /** @@ -47,22 +42,19 @@ public class MavenITmng4874UpdateLatestPluginVersionTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4874" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4874"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4874" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4874"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - File metadataFile = new File( testDir, "target/repo/org/apache/maven/its/mng4874/test/maven-metadata.xml" ); - String xml = FileUtils.fileRead( metadataFile, "UTF-8" ); - assertTrue( xml, xml.matches( "(?s).*0\\.1-SNAPSHOT.*" ) ); + File metadataFile = new File(testDir, "target/repo/org/apache/maven/its/mng4874/test/maven-metadata.xml"); + String xml = FileUtils.fileRead(metadataFile, "UTF-8"); + assertTrue(xml, xml.matches("(?s).*0\\.1-SNAPSHOT.*")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4877DeployUsingPrivateKeyTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4877DeployUsingPrivateKeyTest.java index ab11e9dea1..bc993f957b 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4877DeployUsingPrivateKeyTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4877DeployUsingPrivateKeyTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4877DeployUsingPrivateKeyTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4877DeployUsingPrivateKeyTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4877DeployUsingPrivateKeyTest() - { - super( "[2.0.3,3.0-alpha-1),[3.0.1,)" ); + public MavenITmng4877DeployUsingPrivateKeyTest() { + super("[2.0.3,3.0-alpha-1),[3.0.1,)"); } /** @@ -47,25 +42,22 @@ public class MavenITmng4877DeployUsingPrivateKeyTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4877" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4877"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/wagon.properties" ); - assertEquals( "testuser", props.get( "username" ) ); - assertEquals( "testpass", props.get( "password" ) ); - assertEquals( "testkey", props.get( "privateKey" ) ); - assertEquals( "testphrase", props.get( "passphrase" ) ); + Properties props = verifier.loadProperties("target/wagon.properties"); + assertEquals("testuser", props.get("username")); + assertEquals("testpass", props.get("password")); + assertEquals("testkey", props.get("privateKey")); + assertEquals("testphrase", props.get("passphrase")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4883FailUponOverconstrainedVersionRangesTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4883FailUponOverconstrainedVersionRangesTest.java index e3e85c45f1..38a1055f16 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4883FailUponOverconstrainedVersionRangesTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4883FailUponOverconstrainedVersionRangesTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4883FailUponOverconstrainedVersionRangesTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4883FailUponOverconstrainedVersionRangesTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4883FailUponOverconstrainedVersionRangesTest() - { - super( "[2.0.3,3.0-alpha-1),[3.0.1,)" ); + public MavenITmng4883FailUponOverconstrainedVersionRangesTest() { + super("[2.0.3,3.0-alpha-1),[3.0.1,)"); } /** @@ -46,29 +41,23 @@ public class MavenITmng4883FailUponOverconstrainedVersionRangesTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4883" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4883"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4883" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - try - { - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4883"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + try { + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - fail( "Build did not fail despite over constrained version ranges" ); - } - catch ( Exception e ) - { + fail("Build did not fail despite over constrained version ranges"); + } catch (Exception e) { // expected, unsolvable version conflict } } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4890MakeLikeReactorConsidersVersionsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4890MakeLikeReactorConsidersVersionsTest.java index d675b5bb94..b97ed2d8ea 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4890MakeLikeReactorConsidersVersionsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4890MakeLikeReactorConsidersVersionsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4890MakeLikeReactorConsidersVersionsTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4890MakeLikeReactorConsidersVersionsTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4890MakeLikeReactorConsidersVersionsTest() - { - super( "[3.0,)" ); + public MavenITmng4890MakeLikeReactorConsidersVersionsTest() { + super("[3.0,)"); } /** @@ -47,27 +42,25 @@ public class MavenITmng4890MakeLikeReactorConsidersVersionsTest * @throws Exception in case of failure */ @Test - public void testitAM() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4890" ); + public void testitAM() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4890"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteDirectory( "mod-a/target" ); - verifier.deleteDirectory( "mod-b/target" ); - verifier.addCliArgument( "--projects" ); - verifier.addCliArgument( "mod-b" ); - verifier.addCliArgument( "--also-make" ); - verifier.setLogFileName( "log-am.txt" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteDirectory("mod-a/target"); + verifier.deleteDirectory("mod-b/target"); + verifier.addCliArgument("--projects"); + verifier.addCliArgument("mod-b"); + verifier.addCliArgument("--also-make"); + verifier.setLogFileName("log-am.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "mod-b/target/touch.txt" ); - verifier.verifyFileNotPresent( "mod-a/target/touch.txt" ); - verifier.verifyFileNotPresent( "target/touch.txt" ); + verifier.verifyFilePresent("mod-b/target/touch.txt"); + verifier.verifyFileNotPresent("mod-a/target/touch.txt"); + verifier.verifyFileNotPresent("target/touch.txt"); } /** @@ -77,27 +70,24 @@ public class MavenITmng4890MakeLikeReactorConsidersVersionsTest * @throws Exception in case of failure */ @Test - public void testitAMD() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4890" ); + public void testitAMD() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4890"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteDirectory( "mod-a/target" ); - verifier.deleteDirectory( "mod-b/target" ); - verifier.addCliArgument( "--projects" ); - verifier.addCliArgument( "mod-a" ); - verifier.addCliArgument( "--also-make-dependents" ); - verifier.setLogFileName( "log-amd.txt" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteDirectory("mod-a/target"); + verifier.deleteDirectory("mod-b/target"); + verifier.addCliArgument("--projects"); + verifier.addCliArgument("mod-a"); + verifier.addCliArgument("--also-make-dependents"); + verifier.setLogFileName("log-amd.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "mod-a/target/touch.txt" ); - verifier.verifyFileNotPresent( "mod-b/target/touch.txt" ); - verifier.verifyFileNotPresent( "target/touch.txt" ); + verifier.verifyFilePresent("mod-a/target/touch.txt"); + verifier.verifyFileNotPresent("mod-b/target/touch.txt"); + verifier.verifyFileNotPresent("target/touch.txt"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4891RobustSnapshotResolutionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4891RobustSnapshotResolutionTest.java index c8b34cdb25..83fb0dba35 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4891RobustSnapshotResolutionTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4891RobustSnapshotResolutionTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4891RobustSnapshotResolutionTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4891RobustSnapshotResolutionTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4891RobustSnapshotResolutionTest() - { - super( "[2.0.3,3.0-alpha-1),[3.0.1,)" ); + public MavenITmng4891RobustSnapshotResolutionTest() { + super("[2.0.3,3.0-alpha-1),[3.0.1,)"); } /** @@ -48,29 +43,26 @@ public class MavenITmng4891RobustSnapshotResolutionTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4891" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4891"); - Verifier verifier = newVerifier( new File( testDir, "producer" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4891" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(new File(testDir, "producer").getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4891"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier = newVerifier( new File( testDir, "consumer" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + verifier = newVerifier(new File(testDir, "consumer").getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List artifacts = verifier.loadLines( "target/artifacts.txt", "UTF-8" ); + List artifacts = verifier.loadLines("target/artifacts.txt", "UTF-8"); - assertTrue( artifacts.toString(), artifacts.contains( "org.apache.maven.its.mng4891:producer:jar:0.1-SNAPSHOT" ) ); + assertTrue(artifacts.toString(), artifacts.contains("org.apache.maven.its.mng4891:producer:jar:0.1-SNAPSHOT")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4895PluginDepWithNonRelocatedMavenApiTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4895PluginDepWithNonRelocatedMavenApiTest.java index 2edde45f64..10989807a5 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4895PluginDepWithNonRelocatedMavenApiTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4895PluginDepWithNonRelocatedMavenApiTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4895PluginDepWithNonRelocatedMavenApiTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4895PluginDepWithNonRelocatedMavenApiTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4895PluginDepWithNonRelocatedMavenApiTest() - { - super( "[3.0.1,)" ); + public MavenITmng4895PluginDepWithNonRelocatedMavenApiTest() { + super("[3.0.1,)"); } /** @@ -47,23 +42,20 @@ public class MavenITmng4895PluginDepWithNonRelocatedMavenApiTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4895" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4895"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4895" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4895"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/classpath.txt" ); + verifier.verifyFilePresent("target/classpath.txt"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4913UserPropertyVsDependencyPomPropertyTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4913UserPropertyVsDependencyPomPropertyTest.java index 26eb10d387..e16f90d155 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4913UserPropertyVsDependencyPomPropertyTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4913UserPropertyVsDependencyPomPropertyTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4913UserPropertyVsDependencyPomPropertyTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4913UserPropertyVsDependencyPomPropertyTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4913UserPropertyVsDependencyPomPropertyTest() - { - super( "[2.0.9,3.0-alpha-1),[3.0.2,)" ); + public MavenITmng4913UserPropertyVsDependencyPomPropertyTest() { + super("[2.0.9,3.0-alpha-1),[3.0.2,)"); } /** @@ -47,28 +42,25 @@ public class MavenITmng4913UserPropertyVsDependencyPomPropertyTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4913" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4913"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4913" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "-Dmng4913.version=98.76" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4913"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("-Dmng4913.version=98.76"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List classpath = verifier.loadLines( "target/classpath.txt", "UTF-8" ); + List classpath = verifier.loadLines("target/classpath.txt", "UTF-8"); - assertTrue( classpath.toString(), classpath.contains( "a-0.1.jar" ) ); - assertTrue( classpath.toString(), classpath.contains( "b-0.1.jar" ) ); - assertFalse( classpath.toString(), classpath.contains( "a-98.76.jar" ) ); + assertTrue(classpath.toString(), classpath.contains("a-0.1.jar")); + assertTrue(classpath.toString(), classpath.contains("b-0.1.jar")); + assertFalse(classpath.toString(), classpath.contains("a-98.76.jar")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4919LifecycleMappingWithSameGoalTwiceTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4919LifecycleMappingWithSameGoalTwiceTest.java index f269cac54d..ecf9df1f0b 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4919LifecycleMappingWithSameGoalTwiceTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4919LifecycleMappingWithSameGoalTwiceTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Arrays; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4919LifecycleMappingWithSameGoalTwiceTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4919LifecycleMappingWithSameGoalTwiceTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4919LifecycleMappingWithSameGoalTwiceTest() - { - super( "[2.0.3,3.0-alpha-1),[3.0.2,)" ); + public MavenITmng4919LifecycleMappingWithSameGoalTwiceTest() { + super("[2.0.3,3.0-alpha-1),[3.0.2,)"); } /** @@ -48,20 +43,17 @@ public class MavenITmng4919LifecycleMappingWithSameGoalTwiceTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4919" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4919"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArguments("clean", "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArguments("clean", "validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List lines = verifier.loadLines( "target/log.txt", "UTF-8" ); - assertEquals( Arrays.asList( new String[] { "check", "check" } ), lines ); + List lines = verifier.loadLines("target/log.txt", "UTF-8"); + assertEquals(Arrays.asList(new String[] {"check", "check"}), lines); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4925ContainerLookupRealmDuringMojoExecTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4925ContainerLookupRealmDuringMojoExecTest.java index 02c389465f..191e13544c 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4925ContainerLookupRealmDuringMojoExecTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4925ContainerLookupRealmDuringMojoExecTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4925ContainerLookupRealmDuringMojoExecTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4925ContainerLookupRealmDuringMojoExecTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4925ContainerLookupRealmDuringMojoExecTest() - { - super( "[3.0.2,)" ); + public MavenITmng4925ContainerLookupRealmDuringMojoExecTest() { + super("[3.0.2,)"); } /** @@ -47,23 +42,20 @@ public class MavenITmng4925ContainerLookupRealmDuringMojoExecTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4925" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4925"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4925" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4925"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/touch.txt" ); + verifier.verifyFilePresent("target/touch.txt"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4936EventSpyTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4936EventSpyTest.java index c97c251465..b9b597de92 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4936EventSpyTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4936EventSpyTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4936EventSpyTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4936EventSpyTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4936EventSpyTest() - { - super( "[3.0.2,)" ); + public MavenITmng4936EventSpyTest() { + super("[3.0.2,)"); } /** @@ -47,34 +42,31 @@ public class MavenITmng4936EventSpyTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4936" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4936"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setForkJvm( true ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "-Dmaven.ext.class.path=spy-0.1.jar" ); - verifier.addCliArgument( "-X" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setForkJvm(true); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("-Dmaven.ext.class.path=spy-0.1.jar"); + verifier.addCliArgument("-X"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List lines = verifier.loadLines( "target/spy.log", "UTF-8" ); - assertTrue( lines.toString(), lines.get( 0 ).toString().startsWith( "init" ) ); - assertTrue( lines.toString(), lines.get( lines.size() - 1 ).toString().startsWith( "close" ) ); - assertTrue( lines.toString(), - lines.contains( "event: org.apache.maven.settings.building.DefaultSettingsBuildingRequest" ) ); - assertTrue( lines.toString(), - lines.contains( "event: org.apache.maven.settings.building.DefaultSettingsBuildingResult" ) ); - assertTrue( lines.toString(), - lines.contains( "event: org.apache.maven.execution.DefaultMavenExecutionRequest" ) ); - assertTrue( lines.toString(), - lines.contains( "event: org.apache.maven.execution.DefaultMavenExecutionResult" ) ); - assertTrue( lines.toString(), - lines.contains( "event: org.apache.maven.lifecycle.internal.DefaultExecutionEvent" ) ); + List lines = verifier.loadLines("target/spy.log", "UTF-8"); + assertTrue(lines.toString(), lines.get(0).toString().startsWith("init")); + assertTrue(lines.toString(), lines.get(lines.size() - 1).toString().startsWith("close")); + assertTrue( + lines.toString(), + lines.contains("event: org.apache.maven.settings.building.DefaultSettingsBuildingRequest")); + assertTrue( + lines.toString(), + lines.contains("event: org.apache.maven.settings.building.DefaultSettingsBuildingResult")); + assertTrue(lines.toString(), lines.contains("event: org.apache.maven.execution.DefaultMavenExecutionRequest")); + assertTrue(lines.toString(), lines.contains("event: org.apache.maven.execution.DefaultMavenExecutionResult")); + assertTrue( + lines.toString(), lines.contains("event: org.apache.maven.lifecycle.internal.DefaultExecutionEvent")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4952MetadataReleaseInfoUpdateTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4952MetadataReleaseInfoUpdateTest.java index ffaee38752..77b84dc1c5 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4952MetadataReleaseInfoUpdateTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4952MetadataReleaseInfoUpdateTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Map; import org.apache.maven.shared.utils.io.FileUtils; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4952MetadataReleaseInfoUpdateTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4952MetadataReleaseInfoUpdateTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4952MetadataReleaseInfoUpdateTest() - { - super( "[2.0.3,3.0-alpha-1),[3.0.2,)" ); + public MavenITmng4952MetadataReleaseInfoUpdateTest() { + super("[2.0.3,3.0-alpha-1),[3.0.2,)"); } /** @@ -48,36 +43,32 @@ public class MavenITmng4952MetadataReleaseInfoUpdateTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4952" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4952"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4952" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4952"); Map props = verifier.newDefaultFilterMap(); - props.put( "@version@", "1.0" ); - verifier.filterFile( "pom-template.xml", "pom.xml", "UTF-8", props ); - verifier.setLogFileName( "log-1.txt" ); - verifier.addCliArgument( "validate" ); + props.put("@version@", "1.0"); + verifier.filterFile("pom-template.xml", "pom.xml", "UTF-8", props); + verifier.setLogFileName("log-1.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - props.put( "@version@", "2.0" ); - verifier.filterFile( "pom-template.xml", "pom.xml", "UTF-8", props ); - verifier.setLogFileName( "log-2.txt" ); - verifier.addCliArgument( "validate" ); + props.put("@version@", "2.0"); + verifier.filterFile("pom-template.xml", "pom.xml", "UTF-8", props); + verifier.setLogFileName("log-2.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - - File metadataFile = new File( testDir, "target/repo/org/apache/maven/its/mng4952/test/maven-metadata.xml" ); - String xml = FileUtils.fileRead( metadataFile, "UTF-8" ); - assertTrue( xml, xml.matches( "(?s).*2\\.0.*" ) ); + File metadataFile = new File(testDir, "target/repo/org/apache/maven/its/mng4952/test/maven-metadata.xml"); + String xml = FileUtils.fileRead(metadataFile, "UTF-8"); + assertTrue(xml, xml.matches("(?s).*2\\.0.*")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4955LocalVsRemoteSnapshotResolutionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4955LocalVsRemoteSnapshotResolutionTest.java index a1df8e13d9..a119b465c9 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4955LocalVsRemoteSnapshotResolutionTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4955LocalVsRemoteSnapshotResolutionTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4955LocalVsRemoteSnapshotResolutionTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4955LocalVsRemoteSnapshotResolutionTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4955LocalVsRemoteSnapshotResolutionTest() - { - super( "[2.0.10,2.0.99),[2.1.0,3.0-alpha-1),[3.0.2,)" ); + public MavenITmng4955LocalVsRemoteSnapshotResolutionTest() { + super("[2.0.10,2.0.99),[2.1.0,3.0-alpha-1),[3.0.2,)"); } /** @@ -48,33 +43,30 @@ public class MavenITmng4955LocalVsRemoteSnapshotResolutionTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4955" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4955"); - Verifier verifier = newVerifier( new File( testDir, "dep" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4955" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(new File(testDir, "dep").getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4955"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "validate" ); + verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List classpath = verifier.loadLines( "target/classpath.txt", "UTF-8" ); + List classpath = verifier.loadLines("target/classpath.txt", "UTF-8"); - File jarFile = new File( classpath.get( 1 ).toString() ); - assertEquals( "eeff09b1b80e823eeb2a615b1d4b09e003e86fd3", ItUtils.calcHash( jarFile, "SHA-1" ) ); + File jarFile = new File(classpath.get(1).toString()); + assertEquals("eeff09b1b80e823eeb2a615b1d4b09e003e86fd3", ItUtils.calcHash(jarFile, "SHA-1")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4960MakeLikeReactorResumeTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4960MakeLikeReactorResumeTest.java index 0cc587479a..5b57225b8d 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4960MakeLikeReactorResumeTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4960MakeLikeReactorResumeTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4960MakeLikeReactorResumeTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4960MakeLikeReactorResumeTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4960MakeLikeReactorResumeTest() - { - super( "[2.1.0,3.0-alpha-1),[3.0.2,)" ); + public MavenITmng4960MakeLikeReactorResumeTest() { + super("[2.1.0,3.0-alpha-1),[3.0.2,)"); } /** @@ -47,29 +42,27 @@ public class MavenITmng4960MakeLikeReactorResumeTest * @throws Exception in case of failure */ @Test - public void testitFromUpstream() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4960" ); + public void testitFromUpstream() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4960"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteDirectory( "mod-a/target" ); - verifier.deleteDirectory( "mod-b/target" ); - verifier.addCliArgument( "--projects" ); - verifier.addCliArgument( "mod-b" ); - verifier.addCliArgument( "--also-make" ); - verifier.addCliArgument( "--resume-from" ); - verifier.addCliArgument( "mod-a" ); - verifier.setLogFileName( "log-up.txt" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteDirectory("mod-a/target"); + verifier.deleteDirectory("mod-b/target"); + verifier.addCliArgument("--projects"); + verifier.addCliArgument("mod-b"); + verifier.addCliArgument("--also-make"); + verifier.addCliArgument("--resume-from"); + verifier.addCliArgument("mod-a"); + verifier.setLogFileName("log-up.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "mod-a/target/touch.txt" ); - verifier.verifyFilePresent( "mod-b/target/touch.txt" ); - verifier.verifyFileNotPresent( "target/touch.txt" ); + verifier.verifyFilePresent("mod-a/target/touch.txt"); + verifier.verifyFilePresent("mod-b/target/touch.txt"); + verifier.verifyFileNotPresent("target/touch.txt"); } /** @@ -79,29 +72,26 @@ public class MavenITmng4960MakeLikeReactorResumeTest * @throws Exception in case of failure */ @Test - public void testitFromDownstream() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4960" ); + public void testitFromDownstream() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4960"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteDirectory( "mod-a/target" ); - verifier.deleteDirectory( "mod-b/target" ); - verifier.addCliArgument( "--projects" ); - verifier.addCliArgument( "mod-a" ); - verifier.addCliArgument( "--also-make-dependents" ); - verifier.addCliArgument( "--resume-from" ); - verifier.addCliArgument( "mod-b" ); - verifier.setLogFileName( "log-down.txt" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteDirectory("mod-a/target"); + verifier.deleteDirectory("mod-b/target"); + verifier.addCliArgument("--projects"); + verifier.addCliArgument("mod-a"); + verifier.addCliArgument("--also-make-dependents"); + verifier.addCliArgument("--resume-from"); + verifier.addCliArgument("mod-b"); + verifier.setLogFileName("log-down.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFileNotPresent( "mod-a/target/touch.txt" ); - verifier.verifyFilePresent( "mod-b/target/touch.txt" ); - verifier.verifyFileNotPresent( "target/touch.txt" ); + verifier.verifyFileNotPresent("mod-a/target/touch.txt"); + verifier.verifyFilePresent("mod-b/target/touch.txt"); + verifier.verifyFileNotPresent("target/touch.txt"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4963ParentResolutionFromMirrorTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4963ParentResolutionFromMirrorTest.java index 24fbca5b95..b3a839de39 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4963ParentResolutionFromMirrorTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4963ParentResolutionFromMirrorTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4963ParentResolutionFromMirrorTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4963ParentResolutionFromMirrorTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4963ParentResolutionFromMirrorTest() - { - super( "[2.0.5,3.0-alpha-1),[3.0.3,)" ); + public MavenITmng4963ParentResolutionFromMirrorTest() { + super("[2.0.5,3.0-alpha-1),[3.0.3,)"); } /** @@ -48,21 +43,18 @@ public class MavenITmng4963ParentResolutionFromMirrorTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4963" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4963"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4963" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4963"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4966AbnormalUrlPreservationTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4966AbnormalUrlPreservationTest.java index 400f19d31a..e225bebd3a 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4966AbnormalUrlPreservationTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4966AbnormalUrlPreservationTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4966AbnormalUrlPreservationTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4966AbnormalUrlPreservationTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4966AbnormalUrlPreservationTest() - { - super( "[2.0.3,3.0-alpha-1),[3.0.2,)" ); + public MavenITmng4966AbnormalUrlPreservationTest() { + super("[2.0.3,3.0-alpha-1),[3.0.2,)"); } /** @@ -47,24 +42,22 @@ public class MavenITmng4966AbnormalUrlPreservationTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4966" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4966"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/pom.properties" ); - assertEquals( "file:////UNC/server/dir/", props.getProperty( "project.url" ) ); - assertEquals( "ssh://localhost//home/user/", props.getProperty( "project.scm.url" ) ); - assertEquals( "scm:hg:ssh://localhost//home/user/", props.getProperty( "project.scm.connection" ) ); - assertEquals( "[fetch=]http://server.org/[push=]ssh://server.org/", - props.getProperty( "project.scm.developerConnection" ) ); + Properties props = verifier.loadProperties("target/pom.properties"); + assertEquals("file:////UNC/server/dir/", props.getProperty("project.url")); + assertEquals("ssh://localhost//home/user/", props.getProperty("project.scm.url")); + assertEquals("scm:hg:ssh://localhost//home/user/", props.getProperty("project.scm.connection")); + assertEquals( + "[fetch=]http://server.org/[push=]ssh://server.org/", + props.getProperty("project.scm.developerConnection")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4973ExtensionVisibleToPluginInReactorTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4973ExtensionVisibleToPluginInReactorTest.java index 452233222c..1931875779 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4973ExtensionVisibleToPluginInReactorTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4973ExtensionVisibleToPluginInReactorTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4973ExtensionVisibleToPluginInReactorTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4973ExtensionVisibleToPluginInReactorTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4973ExtensionVisibleToPluginInReactorTest() - { - super( "[2.0.3,3.0-alpha-1),[3.0.3,)" ); + public MavenITmng4973ExtensionVisibleToPluginInReactorTest() { + super("[2.0.3,3.0-alpha-1),[3.0.3,)"); } /** @@ -49,24 +44,21 @@ public class MavenITmng4973ExtensionVisibleToPluginInReactorTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4973" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4973"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "sub-b/target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4973" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("sub-b/target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4973"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "sub-b/target/artifact.properties" ); - assertNotNull( props.get( "org.apache.maven.its.mng4973:dep:it-artifact:it:0.1" ) ); + Properties props = verifier.loadProperties("sub-b/target/artifact.properties"); + assertNotNull(props.get("org.apache.maven.its.mng4973:dep:it-artifact:it:0.1")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4975ProfileInjectedPluginExecutionOrderTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4975ProfileInjectedPluginExecutionOrderTest.java index 98bdf0dc50..415862763d 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4975ProfileInjectedPluginExecutionOrderTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4975ProfileInjectedPluginExecutionOrderTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Arrays; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4975ProfileInjectedPluginExecutionOrderTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4975ProfileInjectedPluginExecutionOrderTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4975ProfileInjectedPluginExecutionOrderTest() - { - super( "[2.0.7,3.0-alpha-1),[3.0.3,)" ); + public MavenITmng4975ProfileInjectedPluginExecutionOrderTest() { + super("[2.0.7,3.0-alpha-1),[3.0.3,)"); } /** @@ -48,22 +43,19 @@ public class MavenITmng4975ProfileInjectedPluginExecutionOrderTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4975" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4975"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "-Pprofile2,profile1" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("-Pprofile2,profile1"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List lines = verifier.loadLines( "target/exec.log", "UTF-8" ); - List expected = Arrays.asList( new String[] { "1", "2", "3", "4", "5" } ); - assertEquals( expected, lines ); + List lines = verifier.loadLines("target/exec.log", "UTF-8"); + List expected = Arrays.asList(new String[] {"1", "2", "3", "4", "5"}); + assertEquals(expected, lines); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4987TimestampBasedSnapshotSelectionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4987TimestampBasedSnapshotSelectionTest.java index f8a4fe5f83..0bd58022b5 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4987TimestampBasedSnapshotSelectionTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4987TimestampBasedSnapshotSelectionTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4987TimestampBasedSnapshotSelectionTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4987TimestampBasedSnapshotSelectionTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4987TimestampBasedSnapshotSelectionTest() - { - super( "[2.0.3,3.0-alpha-1),[3.0.3,)" ); + public MavenITmng4987TimestampBasedSnapshotSelectionTest() { + super("[2.0.3,3.0-alpha-1),[3.0.3,)"); } /** @@ -48,25 +43,22 @@ public class MavenITmng4987TimestampBasedSnapshotSelectionTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4987" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4987"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4987" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4987"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List compile = verifier.loadLines( "target/compile.txt", "UTF-8" ); + List compile = verifier.loadLines("target/compile.txt", "UTF-8"); - assertTrue( compile.toString(), compile.get( 1 ).toString().startsWith( "dep-0.1-" ) ); + assertTrue(compile.toString(), compile.get(1).toString().startsWith("dep-0.1-")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4991NonProxyHostsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4991NonProxyHostsTest.java index 7d3ce1be94..c5c1a33f7b 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4991NonProxyHostsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4991NonProxyHostsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,15 +16,15 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.net.InetAddress; import java.util.List; import java.util.Map; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.eclipse.jetty.server.Handler; import org.eclipse.jetty.server.NetworkConnector; import org.eclipse.jetty.server.Server; @@ -40,13 +38,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng4991NonProxyHostsTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4991NonProxyHostsTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4991NonProxyHostsTest() - { - super( "[2.0.3,3.0-alpha-1),[3.0.3,)" ); + public MavenITmng4991NonProxyHostsTest() { + super("[2.0.3,3.0-alpha-1),[3.0.3,)"); } /** @@ -55,68 +50,61 @@ public class MavenITmng4991NonProxyHostsTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4991" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4991"); ResourceHandler resourceHandler = new ResourceHandler(); - resourceHandler.setResourceBase( new File( testDir, "repo" ).getAbsolutePath() ); + resourceHandler.setResourceBase(new File(testDir, "repo").getAbsolutePath()); HandlerList handlers = new HandlerList(); - handlers.setHandlers( new Handler[] { resourceHandler, new DefaultHandler() } ); + handlers.setHandlers(new Handler[] {resourceHandler, new DefaultHandler()}); - Server server = new Server( 0 ); - server.setHandler( handlers ); + Server server = new Server(0); + server.setHandler(handlers); /* * NOTE: To guard against automatic fallback to direct connection when the proxy is unreachable, we set up * a dummy proxy as trap to catch the erroneous proxy usage in all cases. */ - Server proxy = new Server( 0 ); - proxy.setHandler( new DefaultHandler() ); + Server proxy = new Server(0); + proxy.setHandler(new DefaultHandler()); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - try - { + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + try { server.start(); - if ( server.isFailed() ) - { - fail( "Couldn't bind the server socket to a free port!" ); + if (server.isFailed()) { + fail("Couldn't bind the server socket to a free port!"); } proxy.start(); - if ( proxy.isFailed() ) - { - fail( "Couldn't bind the server socket to a free port!" ); + if (proxy.isFailed()) { + fail("Couldn't bind the server socket to a free port!"); } - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng4991" ); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng4991"); Map filterProps = verifier.newDefaultFilterMap(); - int port = ( (NetworkConnector) server.getConnectors()[0] ).getLocalPort(); - filterProps.put( "@port@", Integer.toString( port ) ); - int proxyPort = ( (NetworkConnector) proxy.getConnectors()[0] ).getLocalPort(); - filterProps.put( "@proxyPort@", Integer.toString( proxyPort ) ); - filterProps.put( "@localhost@", InetAddress.getLoopbackAddress().getCanonicalHostName() ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "validate" ); + int port = ((NetworkConnector) server.getConnectors()[0]).getLocalPort(); + filterProps.put("@port@", Integer.toString(port)); + int proxyPort = ((NetworkConnector) proxy.getConnectors()[0]).getLocalPort(); + filterProps.put("@proxyPort@", Integer.toString(proxyPort)); + filterProps.put("@localhost@", InetAddress.getLoopbackAddress().getCanonicalHostName()); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8", filterProps); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - } - finally - { + } finally { server.stop(); proxy.stop(); server.join(); proxy.join(); } - List compile = verifier.loadLines( "target/compile.txt", "UTF-8" ); + List compile = verifier.loadLines("target/compile.txt", "UTF-8"); - assertTrue( compile.toString(), compile.contains( "dep-0.1.jar" ) ); + assertTrue(compile.toString(), compile.contains("dep-0.1.jar")); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4992MapStylePropertiesParamConfigTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4992MapStylePropertiesParamConfigTest.java index a3673bbf54..606feeaf82 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4992MapStylePropertiesParamConfigTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4992MapStylePropertiesParamConfigTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,25 +16,22 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** * This is a test set for MNG-4992. */ -public class MavenITmng4992MapStylePropertiesParamConfigTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng4992MapStylePropertiesParamConfigTest extends AbstractMavenIntegrationTestCase { - public MavenITmng4992MapStylePropertiesParamConfigTest() - { - super( "[3.0.3,)" ); + public MavenITmng4992MapStylePropertiesParamConfigTest() { + super("[3.0.3,)"); } /** @@ -45,21 +40,18 @@ public class MavenITmng4992MapStylePropertiesParamConfigTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4992" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4992"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/config.properties" ); - assertEquals( "mapValue", props.getProperty( "mapParam.mapKey" ) ); - assertEquals( "propValue", props.getProperty( "propertiesParam.propKey" ) ); + Properties props = verifier.loadProperties("target/config.properties"); + assertEquals("mapValue", props.getProperty("mapParam.mapKey")); + assertEquals("propValue", props.getProperty("propertiesParam.propKey")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5000ChildPathAwareUrlInheritanceTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5000ChildPathAwareUrlInheritanceTest.java index 54bdf2962e..36a2e44632 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5000ChildPathAwareUrlInheritanceTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5000ChildPathAwareUrlInheritanceTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -34,13 +32,10 @@ import org.junit.jupiter.api.Test; * @author Benjamin Bentmann * */ -public class MavenITmng5000ChildPathAwareUrlInheritanceTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng5000ChildPathAwareUrlInheritanceTest extends AbstractMavenIntegrationTestCase { - public MavenITmng5000ChildPathAwareUrlInheritanceTest() - { - super( "[2.0.11,2.0.99),[2.2.0,3.0-alpha-1),[3.0.3,)" ); + public MavenITmng5000ChildPathAwareUrlInheritanceTest() { + super("[2.0.11,2.0.99),[2.2.0,3.0-alpha-1),[3.0.3,)"); } /** @@ -50,24 +45,21 @@ public class MavenITmng5000ChildPathAwareUrlInheritanceTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5000" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5000"); - Verifier verifier = newVerifier( new File( testDir, "different-from-artifactId" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(new File(testDir, "different-from-artifactId").getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/pom.properties" ); - assertEquals( "http://project.url/child", props.getProperty( "project.url" ) ); - assertEquals( "http://viewvc.project.url/child", props.getProperty( "project.scm.url" ) ); - assertEquals( "http://scm.project.url/child", props.getProperty( "project.scm.connection" ) ); - assertEquals( "https://scm.project.url/child", props.getProperty( "project.scm.developerConnection" ) ); - assertEquals( "http://site.project.url/child", props.getProperty( "project.distributionManagement.site.url" ) ); + Properties props = verifier.loadProperties("target/pom.properties"); + assertEquals("http://project.url/child", props.getProperty("project.url")); + assertEquals("http://viewvc.project.url/child", props.getProperty("project.scm.url")); + assertEquals("http://scm.project.url/child", props.getProperty("project.scm.connection")); + assertEquals("https://scm.project.url/child", props.getProperty("project.scm.developerConnection")); + assertEquals("http://site.project.url/child", props.getProperty("project.distributionManagement.site.url")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5006VersionRangeDependencyParentResolutionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5006VersionRangeDependencyParentResolutionTest.java index bfa0cf22f4..117f7ebfb6 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5006VersionRangeDependencyParentResolutionTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5006VersionRangeDependencyParentResolutionTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng5006VersionRangeDependencyParentResolutionTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng5006VersionRangeDependencyParentResolutionTest extends AbstractMavenIntegrationTestCase { - public MavenITmng5006VersionRangeDependencyParentResolutionTest() - { - super( "[2.0.3,3.0-alpha-1),[3.0.3,)" ); + public MavenITmng5006VersionRangeDependencyParentResolutionTest() { + super("[2.0.3,3.0-alpha-1),[3.0.3,)"); } /** @@ -50,26 +45,23 @@ public class MavenITmng5006VersionRangeDependencyParentResolutionTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5006" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5006"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng5006" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng5006"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List compile = verifier.loadLines( "target/compile.txt", "UTF-8" ); + List compile = verifier.loadLines("target/compile.txt", "UTF-8"); - assertTrue( compile.toString(), compile.contains( "a-0.1.jar" ) ); - assertTrue( compile.toString(), compile.contains( "b-0.1.jar" ) ); + assertTrue(compile.toString(), compile.contains("a-0.1.jar")); + assertTrue(compile.toString(), compile.contains("b-0.1.jar")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5009AggregationCycleTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5009AggregationCycleTest.java index 36963dd734..893ca3bb09 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5009AggregationCycleTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5009AggregationCycleTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,24 +16,21 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** * This is a test set for MNG-5009. */ -public class MavenITmng5009AggregationCycleTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng5009AggregationCycleTest extends AbstractMavenIntegrationTestCase { - public MavenITmng5009AggregationCycleTest() - { - super( "[3.0.3,)" ); + public MavenITmng5009AggregationCycleTest() { + super("[3.0.3,)"); } /** @@ -44,25 +39,19 @@ public class MavenITmng5009AggregationCycleTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5009" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5009"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - try - { - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + try { + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - fail( "Build did not fail despite cycle in POM aggregation" ); - } - catch ( Exception e ) - { - verifier.verifyTextInLog( " cycle " ); + fail("Build did not fail despite cycle in POM aggregation"); + } catch (Exception e) { + verifier.verifyTextInLog(" cycle "); } } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5011ConfigureCollectionArrayFromUserPropertiesTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5011ConfigureCollectionArrayFromUserPropertiesTest.java index 7d136f7bf0..353d1c5ad7 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5011ConfigureCollectionArrayFromUserPropertiesTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5011ConfigureCollectionArrayFromUserPropertiesTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,25 +16,22 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** * This is a test set for MNG-5011. */ -public class MavenITmng5011ConfigureCollectionArrayFromUserPropertiesTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng5011ConfigureCollectionArrayFromUserPropertiesTest extends AbstractMavenIntegrationTestCase { - public MavenITmng5011ConfigureCollectionArrayFromUserPropertiesTest() - { - super( "[3.0.3,)" ); + public MavenITmng5011ConfigureCollectionArrayFromUserPropertiesTest() { + super("[3.0.3,)"); } /** @@ -45,37 +40,36 @@ public class MavenITmng5011ConfigureCollectionArrayFromUserPropertiesTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5011" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5011"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "-Dconfig.stringParams=" ); - verifier.addCliArgument( "-Dconfig.fileParams=foo,bar" ); - verifier.addCliArgument( "-Dconfig.listParam=,two,,four," ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("-Dconfig.stringParams="); + verifier.addCliArgument("-Dconfig.fileParams=foo,bar"); + verifier.addCliArgument("-Dconfig.listParam=,two,,four,"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/config.properties" ); + Properties props = verifier.loadProperties("target/config.properties"); - assertEquals( "0", props.getProperty( "stringParams" ) ); + assertEquals("0", props.getProperty("stringParams")); - assertEquals( "2", props.getProperty( "fileParams" ) ); - assertEquals( new File( testDir, "foo" ).getCanonicalFile(), - new File( props.getProperty( "fileParams.0" ) ).getCanonicalFile() ); - assertEquals( new File( testDir, "bar" ).getCanonicalFile(), - new File( props.getProperty( "fileParams.1" ) ).getCanonicalFile() ); + assertEquals("2", props.getProperty("fileParams")); + assertEquals( + new File(testDir, "foo").getCanonicalFile(), + new File(props.getProperty("fileParams.0")).getCanonicalFile()); + assertEquals( + new File(testDir, "bar").getCanonicalFile(), + new File(props.getProperty("fileParams.1")).getCanonicalFile()); - assertEquals( "5", props.getProperty( "listParam" ) ); - assertEquals( "", props.getProperty( "listParam.0", "" ) ); - assertEquals( "two", props.getProperty( "listParam.1", "" ) ); - assertEquals( "", props.getProperty( "listParam.2", "" ) ); - assertEquals( "four", props.getProperty( "listParam.3", "" ) ); - assertEquals( "", props.getProperty( "listParam.4", "" ) ); + assertEquals("5", props.getProperty("listParam")); + assertEquals("", props.getProperty("listParam.0", "")); + assertEquals("two", props.getProperty("listParam.1", "")); + assertEquals("", props.getProperty("listParam.2", "")); + assertEquals("four", props.getProperty("listParam.3", "")); + assertEquals("", props.getProperty("listParam.4", "")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5012CollectionVsArrayParamCoercionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5012CollectionVsArrayParamCoercionTest.java index 00e97ec38a..449bc96ca9 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5012CollectionVsArrayParamCoercionTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5012CollectionVsArrayParamCoercionTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,25 +16,22 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** * This is a test set for MNG-5012. */ -public class MavenITmng5012CollectionVsArrayParamCoercionTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng5012CollectionVsArrayParamCoercionTest extends AbstractMavenIntegrationTestCase { - public MavenITmng5012CollectionVsArrayParamCoercionTest() - { - super( "[3.0.3,)" ); + public MavenITmng5012CollectionVsArrayParamCoercionTest() { + super("[3.0.3,)"); } /** @@ -46,21 +41,19 @@ public class MavenITmng5012CollectionVsArrayParamCoercionTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5012" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5012"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/config.properties" ); - assertEquals( new File( testDir, "src/main/java" ).getCanonicalFile(), - new File( props.getProperty( "stringParams.0" ) ).getCanonicalFile() ); + Properties props = verifier.loadProperties("target/config.properties"); + assertEquals( + new File(testDir, "src/main/java").getCanonicalFile(), + new File(props.getProperty("stringParams.0")).getCanonicalFile()); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5013ConfigureParamBeanFromScalarValueTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5013ConfigureParamBeanFromScalarValueTest.java index 0c0e15ae39..64366ec94a 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5013ConfigureParamBeanFromScalarValueTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5013ConfigureParamBeanFromScalarValueTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,25 +16,22 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** * This is a test set for MNG-5013. */ -public class MavenITmng5013ConfigureParamBeanFromScalarValueTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng5013ConfigureParamBeanFromScalarValueTest extends AbstractMavenIntegrationTestCase { - public MavenITmng5013ConfigureParamBeanFromScalarValueTest() - { - super( "[3.0.3,)" ); + public MavenITmng5013ConfigureParamBeanFromScalarValueTest() { + super("[3.0.3,)"); } /** @@ -45,21 +40,18 @@ public class MavenITmng5013ConfigureParamBeanFromScalarValueTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5013" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5013"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/config.properties" ); - assertEquals( "PASSED", props.getProperty( "beanParam.fieldParam" ) ); - assertEquals( "true", props.getProperty( "beanParam.setterCalled" ) ); + Properties props = verifier.loadProperties("target/config.properties"); + assertEquals("PASSED", props.getProperty("beanParam.fieldParam")); + assertEquals("true", props.getProperty("beanParam.setterCalled")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5019StringBasedCompLookupFromChildPluginRealmTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5019StringBasedCompLookupFromChildPluginRealmTest.java index 9e8d215e5a..41bf371986 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5019StringBasedCompLookupFromChildPluginRealmTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5019StringBasedCompLookupFromChildPluginRealmTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,24 +16,21 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** * This is a test set for MNG-5019. */ -public class MavenITmng5019StringBasedCompLookupFromChildPluginRealmTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng5019StringBasedCompLookupFromChildPluginRealmTest extends AbstractMavenIntegrationTestCase { - public MavenITmng5019StringBasedCompLookupFromChildPluginRealmTest() - { - super( "[3.0.3,)" ); + public MavenITmng5019StringBasedCompLookupFromChildPluginRealmTest() { + super("[3.0.3,)"); } /** @@ -46,23 +41,20 @@ public class MavenITmng5019StringBasedCompLookupFromChildPluginRealmTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5019" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5019"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng5019" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng5019"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/touch.txt" ); + verifier.verifyFilePresent("target/touch.txt"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5064SuppressSnapshotUpdatesTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5064SuppressSnapshotUpdatesTest.java index 4c60d9aba2..8102015622 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5064SuppressSnapshotUpdatesTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5064SuppressSnapshotUpdatesTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,9 +16,7 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -31,6 +27,8 @@ import java.util.Collections; import java.util.List; import java.util.Map; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.eclipse.jetty.server.NetworkConnector; import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.Server; @@ -45,13 +43,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng5064SuppressSnapshotUpdatesTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng5064SuppressSnapshotUpdatesTest extends AbstractMavenIntegrationTestCase { - public MavenITmng5064SuppressSnapshotUpdatesTest() - { - super( "[3.0.4,)" ); + public MavenITmng5064SuppressSnapshotUpdatesTest() { + super("[3.0.4,)"); } /** @@ -61,81 +56,72 @@ public class MavenITmng5064SuppressSnapshotUpdatesTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5064" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5064"); String metadataUri = "org/apache/maven/its/mng5064/dep/0.1-SNAPSHOT/maven-metadata.xml"; - final List requestedUris = Collections.synchronizedList( new ArrayList() ); + final List requestedUris = Collections.synchronizedList(new ArrayList()); - AbstractHandler logHandler = new AbstractHandler() - { + AbstractHandler logHandler = new AbstractHandler() { @Override - public void handle( String target, Request baseRequest, HttpServletRequest request, - HttpServletResponse response ) - { - if ( request.getRequestURI().startsWith( "/repo/" ) ) - { - requestedUris.add( request.getRequestURI().substring( 6 ) ); + public void handle( + String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) { + if (request.getRequestURI().startsWith("/repo/")) { + requestedUris.add(request.getRequestURI().substring(6)); } } }; ResourceHandler repoHandler = new ResourceHandler(); - repoHandler.setResourceBase( testDir.getAbsolutePath() ); + repoHandler.setResourceBase(testDir.getAbsolutePath()); HandlerList handlerList = new HandlerList(); - handlerList.addHandler( logHandler ); - handlerList.addHandler( repoHandler ); - handlerList.addHandler( new DefaultHandler() ); + handlerList.addHandler(logHandler); + handlerList.addHandler(repoHandler); + handlerList.addHandler(new DefaultHandler()); - Server server = new Server( 0 ); - server.setHandler( handlerList ); + Server server = new Server(0); + server.setHandler(handlerList); server.start(); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - try - { - if ( server.isFailed() ) - { - fail( "Couldn't bind the server socket to a free port!" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + try { + if (server.isFailed()) { + fail("Couldn't bind the server socket to a free port!"); } - int port = ( (NetworkConnector) server.getConnectors()[0] ).getLocalPort(); - System.out.println( "Bound server socket to the port " + port ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng5064" ); + int port = ((NetworkConnector) server.getConnectors()[0]).getLocalPort(); + System.out.println("Bound server socket to the port " + port); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng5064"); Map filterProps = verifier.newDefaultFilterMap(); - filterProps.put( "@port@", Integer.toString( port ) ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps ); - verifier.addCliArgument( "-nsu" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); + filterProps.put("@port@", Integer.toString(port)); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8", filterProps); + verifier.addCliArgument("-nsu"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); - verifier.setLogFileName( "log-1.txt" ); - verifier.addCliArgument( "validate" ); + verifier.setLogFileName("log-1.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List classpath = verifier.loadLines( "target/classpath.txt", "UTF-8" ); - assertTrue( classpath.toString(), classpath.contains( "dep-0.1-SNAPSHOT.jar" ) ); - assertTrue( requestedUris.toString(), requestedUris.contains( metadataUri ) ); + List classpath = verifier.loadLines("target/classpath.txt", "UTF-8"); + assertTrue(classpath.toString(), classpath.contains("dep-0.1-SNAPSHOT.jar")); + assertTrue(requestedUris.toString(), requestedUris.contains(metadataUri)); requestedUris.clear(); - verifier.setLogFileName( "log-2.txt" ); - verifier.addCliArgument( "validate" ); + verifier.setLogFileName("log-2.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - classpath = verifier.loadLines( "target/classpath.txt", "UTF-8" ); - assertTrue( classpath.toString(), classpath.contains( "dep-0.1-SNAPSHOT.jar" ) ); - assertFalse( requestedUris.toString(), requestedUris.contains( metadataUri ) ); - } - finally - { + classpath = verifier.loadLines("target/classpath.txt", "UTF-8"); + assertTrue(classpath.toString(), classpath.contains("dep-0.1-SNAPSHOT.jar")); + assertFalse(requestedUris.toString(), requestedUris.contains(metadataUri)); + } finally { server.stop(); server.join(); } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5096ExclusionAtDependencyWithImpliedClassifierTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5096ExclusionAtDependencyWithImpliedClassifierTest.java index 9bdc417890..ee0a028186 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5096ExclusionAtDependencyWithImpliedClassifierTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5096ExclusionAtDependencyWithImpliedClassifierTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng5096ExclusionAtDependencyWithImpliedClassifierTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng5096ExclusionAtDependencyWithImpliedClassifierTest extends AbstractMavenIntegrationTestCase { - public MavenITmng5096ExclusionAtDependencyWithImpliedClassifierTest() - { - super( "[2.0.9,3.0-alpha-1),[3.0.4,)" ); + public MavenITmng5096ExclusionAtDependencyWithImpliedClassifierTest() { + super("[2.0.9,3.0-alpha-1),[3.0.4,)"); } /** @@ -49,26 +44,23 @@ public class MavenITmng5096ExclusionAtDependencyWithImpliedClassifierTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5096" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5096"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng5096" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng5096"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List compile = verifier.loadLines( "target/compile.txt", "UTF-8" ); + List compile = verifier.loadLines("target/compile.txt", "UTF-8"); - assertFalse( compile.toString(), compile.contains( "a-0.1.jar" ) ); - assertTrue( compile.toString(), compile.contains( "b-0.1.jar" ) ); + assertFalse(compile.toString(), compile.contains("a-0.1.jar")); + assertTrue(compile.toString(), compile.contains("b-0.1.jar")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5135AggregatorDepResolutionModuleExtensionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5135AggregatorDepResolutionModuleExtensionTest.java index 9f17c88110..b08ccd3bc6 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5135AggregatorDepResolutionModuleExtensionTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5135AggregatorDepResolutionModuleExtensionTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng5135AggregatorDepResolutionModuleExtensionTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng5135AggregatorDepResolutionModuleExtensionTest extends AbstractMavenIntegrationTestCase { - public MavenITmng5135AggregatorDepResolutionModuleExtensionTest() - { - super( "[2.0.9,3.0-alpha-1),[3.0.4,)" ); + public MavenITmng5135AggregatorDepResolutionModuleExtensionTest() { + super("[2.0.9,3.0-alpha-1),[3.0.4,)"); } /** @@ -47,25 +42,22 @@ public class MavenITmng5135AggregatorDepResolutionModuleExtensionTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5135" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5135"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng5135" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "org.apache.maven.its.plugins:maven-it-plugin-dependency-resolution:aggregate-test" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng5135"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("org.apache.maven.its.plugins:maven-it-plugin-dependency-resolution:aggregate-test"); verifier.execute(); verifier.verifyErrorFreeLog(); - List compile = verifier.loadLines( "target/module.txt", "UTF-8" ); + List compile = verifier.loadLines("target/module.txt", "UTF-8"); - assertTrue( compile.toString(), compile.contains( "dep-0.1-it.jar" ) ); + assertTrue(compile.toString(), compile.contains("dep-0.1-it.jar")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5137ReactorResolutionInForkedBuildTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5137ReactorResolutionInForkedBuildTest.java index e976cfa641..57b3c23801 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5137ReactorResolutionInForkedBuildTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5137ReactorResolutionInForkedBuildTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,13 +30,10 @@ import org.junit.jupiter.api.Test; * * @author Benjamin Bentmann */ -public class MavenITmng5137ReactorResolutionInForkedBuildTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng5137ReactorResolutionInForkedBuildTest extends AbstractMavenIntegrationTestCase { - public MavenITmng5137ReactorResolutionInForkedBuildTest() - { - super( "[3.0.4,)" ); + public MavenITmng5137ReactorResolutionInForkedBuildTest() { + super("[3.0.4,)"); } /** @@ -49,25 +44,22 @@ public class MavenITmng5137ReactorResolutionInForkedBuildTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5137" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5137"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteDirectory( "producer/target" ); - verifier.deleteDirectory( "consumer/target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng5137" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteDirectory("producer/target"); + verifier.deleteDirectory("consumer/target"); + verifier.deleteArtifacts("org.apache.maven.its.mng5137"); verifier.addCliArgument( - "org.apache.maven.its.plugins:maven-it-plugin-fork:2.1-SNAPSHOT:fork-lifecycle-aggregator" ); + "org.apache.maven.its.plugins:maven-it-plugin-fork:2.1-SNAPSHOT:fork-lifecycle-aggregator"); verifier.execute(); verifier.verifyErrorFreeLog(); - List compile = verifier.loadLines( "consumer/target/compile.txt", "UTF-8" ); + List compile = verifier.loadLines("consumer/target/compile.txt", "UTF-8"); - assertTrue( compile.toString(), compile.contains( "producer/pom.xml" ) ); + assertTrue(compile.toString(), compile.contains("producer/pom.xml")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5175WagonHttpTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5175WagonHttpTest.java index 13d483afb6..60a93dd8da 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5175WagonHttpTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5175WagonHttpTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,9 +16,7 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; @@ -31,6 +27,8 @@ import java.io.IOException; import java.util.HashMap; import java.util.Map; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.eclipse.jetty.server.Handler; import org.eclipse.jetty.server.NetworkConnector; import org.eclipse.jetty.server.Request; @@ -46,64 +44,50 @@ import org.junit.jupiter.api.Test; * * */ -public class MavenITmng5175WagonHttpTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng5175WagonHttpTest extends AbstractMavenIntegrationTestCase { private Server server; private int port; - public MavenITmng5175WagonHttpTest() - { - super( "[3.0.4,)" ); // 3.0.4+ + public MavenITmng5175WagonHttpTest() { + super("[3.0.4,)"); // 3.0.4+ } @BeforeEach - protected void setUp() - throws Exception - { - Handler handler = new AbstractHandler() - { + protected void setUp() throws Exception { + Handler handler = new AbstractHandler() { @Override - public void handle( String target, Request baseRequest, HttpServletRequest request, - HttpServletResponse response ) - throws IOException, ServletException - { - try - { + public void handle( + String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException { + try { // wait long enough for read timeout to happen in client - Thread.sleep( 100 ); + Thread.sleep(100); + } catch (InterruptedException e) { + throw new ServletException(e.getMessage()); } - catch ( InterruptedException e ) - { - throw new ServletException( e.getMessage() ); - } - response.setContentType( "text/plain" ); - response.setStatus( HttpServletResponse.SC_OK ); - response.getWriter().println( "some content" ); + response.setContentType("text/plain"); + response.setStatus(HttpServletResponse.SC_OK); + response.getWriter().println("some content"); response.getWriter().println(); - ( (Request) request ).setHandled( true ); + ((Request) request).setHandled(true); } }; - server = new Server( 0 ); - server.setHandler( handler ); + server = new Server(0); + server.setHandler(handler); server.start(); - if ( server.isFailed() ) - { - fail( "Couldn't bind the server socket to a free port!" ); + if (server.isFailed()) { + fail("Couldn't bind the server socket to a free port!"); } - port = ( (NetworkConnector) server.getConnectors()[0] ).getLocalPort(); - System.out.println( "Bound server socket to the port " + port ); + port = ((NetworkConnector) server.getConnectors()[0]).getLocalPort(); + System.out.println("Bound server socket to the port " + port); } @AfterEach - protected void tearDown() - throws Exception - { - if ( server != null ) - { + protected void tearDown() throws Exception { + if (server != null) { server.stop(); server.join(); } @@ -116,29 +100,27 @@ public class MavenITmng5175WagonHttpTest * @throws Exception in case of failure */ @Test - public void testmng5175_ReadTimeOutFromSettings() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5175" ); + public void testmng5175_ReadTimeOutFromSettings() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5175"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); Map filterProps = new HashMap<>(); - filterProps.put( "@port@", Integer.toString( port ) ); + filterProps.put("@port@", Integer.toString(port)); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps ); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8", filterProps); - verifier.addCliArgument( "-U" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "--fail-never" ); - verifier.addCliArgument( "--errors" ); - verifier.addCliArgument( "-X" ); - verifier.addCliArgument( "validate" ); + verifier.addCliArgument("-U"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("--fail-never"); + verifier.addCliArgument("--errors"); + verifier.addCliArgument("-X"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyTextInLog( - "Could not transfer artifact org.apache.maven.its.mng5175:fake-dependency:pom:1.0-SNAPSHOT" ); - verifier.verifyTextInLog( "Read timed out" ); + "Could not transfer artifact org.apache.maven.its.mng5175:fake-dependency:pom:1.0-SNAPSHOT"); + verifier.verifyTextInLog("Read timed out"); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5206PlexusLifecycleHonoured.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5206PlexusLifecycleHonoured.java index a2c3e2f6f0..52cacec1df 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5206PlexusLifecycleHonoured.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5206PlexusLifecycleHonoured.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Olivier Lamy */ @Tag("disabled") -public class MavenITmng5206PlexusLifecycleHonoured - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng5206PlexusLifecycleHonoured extends AbstractMavenIntegrationTestCase { - public MavenITmng5206PlexusLifecycleHonoured() - { - super( "[2.0.7,)" ); + public MavenITmng5206PlexusLifecycleHonoured() { + super("[2.0.7,)"); } /** @@ -48,24 +43,21 @@ public class MavenITmng5206PlexusLifecycleHonoured * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5206" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5206"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng5206" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng5206"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyTextInLog( "MojoWithPlexusLifecycle :: contextualize" ); - verifier.verifyTextInLog( "DefaultFakeComponent :: contextualize" ); - verifier.verifyTextInLog( "MojoWithPlexusLifecycle :: dispose" ); + verifier.verifyTextInLog("MojoWithPlexusLifecycle :: contextualize"); + verifier.verifyTextInLog("DefaultFakeComponent :: contextualize"); + verifier.verifyTextInLog("MojoWithPlexusLifecycle :: dispose"); // olamy dispose on injected component is not called - //verifier.verifyTextInLog( "DefaultFakeComponent :: dispose" ); + // verifier.verifyTextInLog( "DefaultFakeComponent :: dispose" ); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5208EventSpyParallelTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5208EventSpyParallelTest.java index 1cc42ca538..5e2017a5e2 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5208EventSpyParallelTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5208EventSpyParallelTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,23 +16,20 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; @Disabled -public class MavenITmng5208EventSpyParallelTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng5208EventSpyParallelTest extends AbstractMavenIntegrationTestCase { - public MavenITmng5208EventSpyParallelTest() - { - super( "[3.0.5,)" ); + public MavenITmng5208EventSpyParallelTest() { + super("[3.0.5,)"); } /** @@ -43,27 +38,24 @@ public class MavenITmng5208EventSpyParallelTest * @throws Exception in case of failure */ @Test - public void testCorrectModuleFails() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5208" ); + public void testCorrectModuleFails() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5208"); - Verifier spy = newVerifier( testDir.getAbsolutePath() + "/spy"); - spy.addCliArgument( "install" ); + Verifier spy = newVerifier(testDir.getAbsolutePath() + "/spy"); + spy.addCliArgument("install"); spy.execute(); - Verifier verifier = newVerifier( testDir.getAbsolutePath() + "/project" ); - verifier.setForkJvm( true ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "-Dmaven.ext.class.path=../spy/target/event-spy-0.0.1-SNAPSHOT.jar" ); - verifier.addCliArgument( "-X" ); - verifier.addCliArgument( "-T" ); - verifier.addCliArgument( "2" ); - verifier.addCliArgument( "-fn" ); - verifier.addCliArgument( "compile" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath() + "/project"); + verifier.setForkJvm(true); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("-Dmaven.ext.class.path=../spy/target/event-spy-0.0.1-SNAPSHOT.jar"); + verifier.addCliArgument("-X"); + verifier.addCliArgument("-T"); + verifier.addCliArgument("2"); + verifier.addCliArgument("-fn"); + verifier.addCliArgument("compile"); verifier.execute(); - verifier.verifyTextInLog( "ProjectFailed/org.apache.maven.its.mng5208:sub-2" ); + verifier.verifyTextInLog("ProjectFailed/org.apache.maven.its.mng5208:sub-2"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5214DontMapWsdlToJar.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5214DontMapWsdlToJar.java index 9c9fffdc54..0d7dc6cc6b 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5214DontMapWsdlToJar.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5214DontMapWsdlToJar.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,21 +16,18 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; -public class MavenITmng5214DontMapWsdlToJar - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng5214DontMapWsdlToJar() - { - super( "[3.1,)" ); +public class MavenITmng5214DontMapWsdlToJar extends AbstractMavenIntegrationTestCase { + public MavenITmng5214DontMapWsdlToJar() { + super("[3.1,)"); } /** @@ -42,40 +37,36 @@ public class MavenITmng5214DontMapWsdlToJar * @throws Exception in case of failure */ @Test - public void testitTestPhase() - throws Exception - { - File setupDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5214/dependency" ); + public void testitTestPhase() throws Exception { + File setupDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5214/dependency"); - Verifier setupVerifier = newVerifier( setupDir.getAbsolutePath() ); - setupVerifier.setAutoclean( false ); - setupVerifier.addCliArgument( "-X" ); - setupVerifier.deleteDirectory( "target" ); - setupVerifier.deleteArtifacts( "org.apache.maven.its.mng5214" ); - setupVerifier.setLogFileName( "log-setup.txt" ); - setupVerifier.addCliArgument( "-PcreateWsdl" ); - setupVerifier.addCliArgument( "generate-resources" ); + Verifier setupVerifier = newVerifier(setupDir.getAbsolutePath()); + setupVerifier.setAutoclean(false); + setupVerifier.addCliArgument("-X"); + setupVerifier.deleteDirectory("target"); + setupVerifier.deleteArtifacts("org.apache.maven.its.mng5214"); + setupVerifier.setLogFileName("log-setup.txt"); + setupVerifier.addCliArgument("-PcreateWsdl"); + setupVerifier.addCliArgument("generate-resources"); setupVerifier.execute(); - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5214" ); + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5214"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "consumer/target" ); - verifier.deleteDirectory( "dependency/target" ); - verifier.setLogFileName( "log-test.txt" ); - verifier.addCliArgument( "test" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("consumer/target"); + verifier.deleteDirectory("dependency/target"); + verifier.setLogFileName("log-test.txt"); + verifier.addCliArgument("test"); verifier.execute(); verifier.verifyErrorFreeLog(); - List lines = verifier.loadFile( verifier.getBasedir(), verifier.getLogFileName(), false ); + List lines = verifier.loadFile(verifier.getBasedir(), verifier.getLogFileName(), false); // RESOLVE-ONE-DEPENDENCY org.apache.maven.its.mng5214:dependency:wsdl:1.0-SNAPSHOT $ /tmp/it // .repo/org/apache/maven/its/mng5214/dependency/1.0-SNAPSHOT/dependency-1.0-SNAPSHOT.wsdl - for ( String line : lines ) - { - if ( line.contains( "RESOLVE-ONE-DEPENDENCY org.apache.maven.its.mng5214:dependency:wsdl:1.0-SNAPSHOT" ) ) - { - assertFalse( line.contains( "classes-main" ) ); - assertTrue( line.endsWith( ".wsdl" ) ); + for (String line : lines) { + if (line.contains("RESOLVE-ONE-DEPENDENCY org.apache.maven.its.mng5214:dependency:wsdl:1.0-SNAPSHOT")) { + assertFalse(line.contains("classes-main")); + assertTrue(line.endsWith(".wsdl")); } } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5222MojoDeprecatedTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5222MojoDeprecatedTest.java index a6ab0f0818..62fe81c32f 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5222MojoDeprecatedTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5222MojoDeprecatedTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,9 +16,7 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.ArrayList; @@ -28,6 +24,8 @@ import java.util.List; import java.util.Properties; import java.util.regex.Pattern; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -35,12 +33,9 @@ import org.junit.jupiter.api.Test; * MNG-5222 * MNG-7457 */ -public class MavenITmng5222MojoDeprecatedTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng5222MojoDeprecatedTest() - { - super( "[3.9.0,)" ); +public class MavenITmng5222MojoDeprecatedTest extends AbstractMavenIntegrationTestCase { + public MavenITmng5222MojoDeprecatedTest() { + super("[3.9.0,)"); } /** @@ -49,45 +44,44 @@ public class MavenITmng5222MojoDeprecatedTest * @throws Exception in case of failure */ @Test - public void testEmptyConfiguration() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5222-mojo-deprecated-params" ); + public void testEmptyConfiguration() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5222-mojo-deprecated-params"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.setLogFileName( "log-empty-configuration.txt" ); - verifier.addCliArgument( "-Dmaven.plugin.validation=verbose" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.setLogFileName("log-empty-configuration.txt"); + verifier.addCliArgument("-Dmaven.plugin.validation=verbose"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List logLines = verifier.loadFile( verifier.getBasedir(), verifier.getLogFileName(), false ); - List warnLines = findDeprecationWarning( logLines ); + List logLines = verifier.loadFile(verifier.getBasedir(), verifier.getLogFileName(), false); + List warnLines = findDeprecationWarning(logLines); - assertTrue( warnLines.stream().anyMatch(s -> s.contains("Goal 'deprecated-config' is deprecated: This goal is deprecated")) ); + assertTrue(warnLines.stream() + .anyMatch(s -> s.contains("Goal 'deprecated-config' is deprecated: This goal is deprecated"))); - Properties configProps = verifier.loadProperties( "target/config.properties" ); + Properties configProps = verifier.loadProperties("target/config.properties"); - assertEquals( "0", configProps.remove( "deprecatedArray" ) ); + assertEquals("0", configProps.remove("deprecatedArray")); - assertEquals( "3", configProps.remove( "deprecatedArrayWithDefaults" ) ); - assertEquals( "a1 ", configProps.remove( "deprecatedArrayWithDefaults.0" ) ); - assertEquals( "a2", configProps.remove( "deprecatedArrayWithDefaults.1" ) ); - assertEquals( " a3", configProps.remove( "deprecatedArrayWithDefaults.2" ) ); + assertEquals("3", configProps.remove("deprecatedArrayWithDefaults")); + assertEquals("a1 ", configProps.remove("deprecatedArrayWithDefaults.0")); + assertEquals("a2", configProps.remove("deprecatedArrayWithDefaults.1")); + assertEquals(" a3", configProps.remove("deprecatedArrayWithDefaults.2")); - assertEquals( "0", configProps.remove( "deprecatedList" ) ); + assertEquals("0", configProps.remove("deprecatedList")); - assertEquals( "3", configProps.remove( "deprecatedListWithDefaults" ) ); - assertEquals( "l1", configProps.remove( "deprecatedListWithDefaults.0" ) ); - assertEquals( "l2", configProps.remove( "deprecatedListWithDefaults.1" ) ); - assertEquals( "l3", configProps.remove( "deprecatedListWithDefaults.2" ) ); + assertEquals("3", configProps.remove("deprecatedListWithDefaults")); + assertEquals("l1", configProps.remove("deprecatedListWithDefaults.0")); + assertEquals("l2", configProps.remove("deprecatedListWithDefaults.1")); + assertEquals("l3", configProps.remove("deprecatedListWithDefaults.2")); - assertEquals( "testValue", configProps.remove( "deprecatedParamWithDefaultConstant" ) ); - assertEquals( "https://www.test.org", configProps.remove( "deprecatedParamWithDefaultEvaluate" ) ); + assertEquals("testValue", configProps.remove("deprecatedParamWithDefaultConstant")); + assertEquals("https://www.test.org", configProps.remove("deprecatedParamWithDefaultEvaluate")); - assertTrue( "not checked config properties: " + configProps, configProps.isEmpty() ); + assertTrue("not checked config properties: " + configProps, configProps.isEmpty()); } /** @@ -96,60 +90,71 @@ public class MavenITmng5222MojoDeprecatedTest * @throws Exception in case of failure */ @Test - public void testDeprecatedProperty() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5222-mojo-deprecated-params" ); + public void testDeprecatedProperty() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5222-mojo-deprecated-params"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.addCliArgument( "-Dconfig.deprecatedParam2=deprecatedValueInProps" ); - verifier.addCliArgument( "-Dconfig.deprecatedArray=3,2,4,deprecated" ); - verifier.addCliArgument( "-Dconfig.deprecatedList=4,5,deprecated" ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.setLogFileName( "log-deprecated-property.txt" ); - verifier.addCliArgument( "-Dmaven.plugin.validation=verbose" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.addCliArgument("-Dconfig.deprecatedParam2=deprecatedValueInProps"); + verifier.addCliArgument("-Dconfig.deprecatedArray=3,2,4,deprecated"); + verifier.addCliArgument("-Dconfig.deprecatedList=4,5,deprecated"); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.setLogFileName("log-deprecated-property.txt"); + verifier.addCliArgument("-Dmaven.plugin.validation=verbose"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List logLines = verifier.loadFile( verifier.getBasedir(), verifier.getLogFileName(), false ); - List warnLines = findDeprecationWarning( logLines ); + List logLines = verifier.loadFile(verifier.getBasedir(), verifier.getLogFileName(), false); + List warnLines = findDeprecationWarning(logLines); - assertTrue( warnLines.stream().anyMatch(s -> s.contains("Goal 'deprecated-config' is deprecated: This goal is deprecated")) ); - assertTrue( warnLines.stream().anyMatch(s -> s.contains("Parameter 'deprecatedParam2' (user property 'config.deprecatedParam2') is deprecated: No reason given")) ); - assertTrue( warnLines.stream().anyMatch(s -> s.contains("Parameter 'deprecatedArray' (user property 'config.deprecatedArray') is deprecated: deprecated array")) ); - assertTrue( warnLines.stream().anyMatch(s -> s.contains("Parameter 'deprecatedList' (user property 'config.deprecatedList') is deprecated: deprecated list")) ); + assertTrue(warnLines.stream() + .anyMatch(s -> s.contains("Goal 'deprecated-config' is deprecated: This goal is deprecated"))); + assertTrue( + warnLines.stream() + .anyMatch( + s -> s.contains( + "Parameter 'deprecatedParam2' (user property 'config.deprecatedParam2') is deprecated: No reason given"))); + assertTrue( + warnLines.stream() + .anyMatch( + s -> s.contains( + "Parameter 'deprecatedArray' (user property 'config.deprecatedArray') is deprecated: deprecated array"))); + assertTrue( + warnLines.stream() + .anyMatch( + s -> s.contains( + "Parameter 'deprecatedList' (user property 'config.deprecatedList') is deprecated: deprecated list"))); - Properties configProps = verifier.loadProperties( "target/config.properties" ); + Properties configProps = verifier.loadProperties("target/config.properties"); - assertEquals( "deprecatedValueInProps", configProps.remove( "deprecatedParam2" ) ); + assertEquals("deprecatedValueInProps", configProps.remove("deprecatedParam2")); - assertEquals( "4", configProps.remove( "deprecatedArray" ) ); - assertEquals( "3", configProps.remove( "deprecatedArray.0" ) ); - assertEquals( "2", configProps.remove( "deprecatedArray.1" ) ); - assertEquals( "4", configProps.remove( "deprecatedArray.2" ) ); - assertEquals( "deprecated", configProps.remove( "deprecatedArray.3" ) ); + assertEquals("4", configProps.remove("deprecatedArray")); + assertEquals("3", configProps.remove("deprecatedArray.0")); + assertEquals("2", configProps.remove("deprecatedArray.1")); + assertEquals("4", configProps.remove("deprecatedArray.2")); + assertEquals("deprecated", configProps.remove("deprecatedArray.3")); - assertEquals( "3", configProps.remove( "deprecatedArrayWithDefaults" ) ); - assertEquals( "a1 ", configProps.remove( "deprecatedArrayWithDefaults.0" ) ); - assertEquals( "a2", configProps.remove( "deprecatedArrayWithDefaults.1" ) ); - assertEquals( " a3", configProps.remove( "deprecatedArrayWithDefaults.2" ) ); + assertEquals("3", configProps.remove("deprecatedArrayWithDefaults")); + assertEquals("a1 ", configProps.remove("deprecatedArrayWithDefaults.0")); + assertEquals("a2", configProps.remove("deprecatedArrayWithDefaults.1")); + assertEquals(" a3", configProps.remove("deprecatedArrayWithDefaults.2")); - assertEquals( "3", configProps.remove( "deprecatedList" ) ); - assertEquals( "4", configProps.remove( "deprecatedList.0" ) ); - assertEquals( "5", configProps.remove( "deprecatedList.1" ) ); - assertEquals( "deprecated", configProps.remove( "deprecatedList.2" ) ); + assertEquals("3", configProps.remove("deprecatedList")); + assertEquals("4", configProps.remove("deprecatedList.0")); + assertEquals("5", configProps.remove("deprecatedList.1")); + assertEquals("deprecated", configProps.remove("deprecatedList.2")); - assertEquals( "3", configProps.remove( "deprecatedListWithDefaults" ) ); - assertEquals( "l1", configProps.remove( "deprecatedListWithDefaults.0" ) ); - assertEquals( "l2", configProps.remove( "deprecatedListWithDefaults.1" ) ); - assertEquals( "l3", configProps.remove( "deprecatedListWithDefaults.2" ) ); + assertEquals("3", configProps.remove("deprecatedListWithDefaults")); + assertEquals("l1", configProps.remove("deprecatedListWithDefaults.0")); + assertEquals("l2", configProps.remove("deprecatedListWithDefaults.1")); + assertEquals("l3", configProps.remove("deprecatedListWithDefaults.2")); - assertEquals( "testValue", configProps.remove( "deprecatedParamWithDefaultConstant" ) ); - assertEquals( "https://www.test.org", configProps.remove( "deprecatedParamWithDefaultEvaluate" ) ); + assertEquals("testValue", configProps.remove("deprecatedParamWithDefaultConstant")); + assertEquals("https://www.test.org", configProps.remove("deprecatedParamWithDefaultEvaluate")); - assertTrue( "not checked config properties: " + configProps, configProps.isEmpty() ); + assertTrue("not checked config properties: " + configProps, configProps.isEmpty()); } /** @@ -158,79 +163,100 @@ public class MavenITmng5222MojoDeprecatedTest * @throws Exception in case of failure */ @Test - public void testDeprecatedConfig() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5222-mojo-deprecated-params" ); + public void testDeprecatedConfig() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5222-mojo-deprecated-params"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.addCliArgument( "-Pconfig-values" ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.setLogFileName( "log-deprecated-config.txt" ); - verifier.addCliArgument( "-Dmaven.plugin.validation=verbose" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.addCliArgument("-Pconfig-values"); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.setLogFileName("log-deprecated-config.txt"); + verifier.addCliArgument("-Dmaven.plugin.validation=verbose"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List logLines = verifier.loadFile( verifier.getBasedir(), verifier.getLogFileName(), false ); - List warnLines = findDeprecationWarning( logLines ); + List logLines = verifier.loadFile(verifier.getBasedir(), verifier.getLogFileName(), false); + List warnLines = findDeprecationWarning(logLines); - assertTrue( warnLines.stream().anyMatch(s -> s.contains("Goal 'deprecated-config' is deprecated: This goal is deprecated")) ); - assertTrue( warnLines.stream().anyMatch(s -> s.contains("Parameter 'deprecatedParam' is deprecated: I'm deprecated param")) ); - assertTrue( warnLines.stream().anyMatch(s -> s.contains("Parameter 'deprecatedParam2' (user property 'config.deprecatedParam2') is deprecated: No reason given")) ); - assertTrue( warnLines.stream().anyMatch(s -> s.contains("Parameter 'deprecatedParamWithDefaultConstant' is deprecated: deprecated with constant value")) ); - assertTrue( warnLines.stream().anyMatch(s -> s.contains("Parameter 'deprecatedParamWithDefaultEvaluate' is deprecated: deprecated with evaluate value")) ); - assertTrue( warnLines.stream().anyMatch(s -> s.contains("Parameter 'deprecatedArray' (user property 'config.deprecatedArray') is deprecated: deprecated array")) ); - assertTrue( warnLines.stream().anyMatch(s -> s.contains("Parameter 'deprecatedArrayWithDefaults' is deprecated: deprecated array")) ); - assertTrue( warnLines.stream().anyMatch(s -> s.contains("Parameter 'deprecatedList' (user property 'config.deprecatedList') is deprecated: deprecated list")) ); - assertTrue( warnLines.stream().anyMatch(s -> s.contains("Parameter 'deprecatedListWithDefaults' is deprecated: deprecated list")) ); - assertTrue( warnLines.stream().anyMatch(s -> s.contains("Parameter 'deprecatedProperties' is deprecated: deprecated properties")) ); - assertTrue( warnLines.stream().anyMatch(s -> s.contains("Parameter 'deprecatedMap' is deprecated: deprecated map")) ); + assertTrue(warnLines.stream() + .anyMatch(s -> s.contains("Goal 'deprecated-config' is deprecated: This goal is deprecated"))); + assertTrue(warnLines.stream() + .anyMatch(s -> s.contains("Parameter 'deprecatedParam' is deprecated: I'm deprecated param"))); + assertTrue( + warnLines.stream() + .anyMatch( + s -> s.contains( + "Parameter 'deprecatedParam2' (user property 'config.deprecatedParam2') is deprecated: No reason given"))); + assertTrue( + warnLines.stream() + .anyMatch( + s -> s.contains( + "Parameter 'deprecatedParamWithDefaultConstant' is deprecated: deprecated with constant value"))); + assertTrue( + warnLines.stream() + .anyMatch( + s -> s.contains( + "Parameter 'deprecatedParamWithDefaultEvaluate' is deprecated: deprecated with evaluate value"))); + assertTrue( + warnLines.stream() + .anyMatch( + s -> s.contains( + "Parameter 'deprecatedArray' (user property 'config.deprecatedArray') is deprecated: deprecated array"))); + assertTrue(warnLines.stream() + .anyMatch(s -> s.contains("Parameter 'deprecatedArrayWithDefaults' is deprecated: deprecated array"))); + assertTrue( + warnLines.stream() + .anyMatch( + s -> s.contains( + "Parameter 'deprecatedList' (user property 'config.deprecatedList') is deprecated: deprecated list"))); + assertTrue(warnLines.stream() + .anyMatch(s -> s.contains("Parameter 'deprecatedListWithDefaults' is deprecated: deprecated list"))); + assertTrue(warnLines.stream() + .anyMatch(s -> s.contains("Parameter 'deprecatedProperties' is deprecated: deprecated properties"))); + assertTrue(warnLines.stream() + .anyMatch(s -> s.contains("Parameter 'deprecatedMap' is deprecated: deprecated map"))); - Properties configProps = verifier.loadProperties( "target/config.properties" ); + Properties configProps = verifier.loadProperties("target/config.properties"); - assertEquals( "value1", configProps.remove( "deprecatedParam" ) ); - assertEquals( "value2", configProps.remove( "deprecatedParam2" ) ); - assertEquals( "value3", configProps.remove( "deprecatedParamWithDefaultConstant" ) ); - assertEquals( "value4", configProps.remove( "deprecatedParamWithDefaultEvaluate" ) ); + assertEquals("value1", configProps.remove("deprecatedParam")); + assertEquals("value2", configProps.remove("deprecatedParam2")); + assertEquals("value3", configProps.remove("deprecatedParamWithDefaultConstant")); + assertEquals("value4", configProps.remove("deprecatedParamWithDefaultEvaluate")); - assertEquals( "2", configProps.remove( "deprecatedArray" ) ); - assertEquals( "a1", configProps.remove( "deprecatedArray.0" ) ); - assertEquals( "a2", configProps.remove( "deprecatedArray.1" ) ); + assertEquals("2", configProps.remove("deprecatedArray")); + assertEquals("a1", configProps.remove("deprecatedArray.0")); + assertEquals("a2", configProps.remove("deprecatedArray.1")); - assertEquals( "2", configProps.remove( "deprecatedArrayWithDefaults" ) ); - assertEquals( "b1", configProps.remove( "deprecatedArrayWithDefaults.0" ) ); - assertEquals( "b2", configProps.remove( "deprecatedArrayWithDefaults.1" ) ); + assertEquals("2", configProps.remove("deprecatedArrayWithDefaults")); + assertEquals("b1", configProps.remove("deprecatedArrayWithDefaults.0")); + assertEquals("b2", configProps.remove("deprecatedArrayWithDefaults.1")); - assertEquals( "2", configProps.remove( "deprecatedList" ) ); - assertEquals( "c1", configProps.remove( "deprecatedList.0" ) ); - assertEquals( "c2", configProps.remove( "deprecatedList.1" ) ); + assertEquals("2", configProps.remove("deprecatedList")); + assertEquals("c1", configProps.remove("deprecatedList.0")); + assertEquals("c2", configProps.remove("deprecatedList.1")); - assertEquals( "2", configProps.remove( "deprecatedListWithDefaults" ) ); - assertEquals( "d1", configProps.remove( "deprecatedListWithDefaults.0" ) ); - assertEquals( "d2", configProps.remove( "deprecatedListWithDefaults.1" ) ); + assertEquals("2", configProps.remove("deprecatedListWithDefaults")); + assertEquals("d1", configProps.remove("deprecatedListWithDefaults.0")); + assertEquals("d2", configProps.remove("deprecatedListWithDefaults.1")); - assertEquals( "2", configProps.remove( "deprecatedProperties" ) ); - assertEquals( "propertyValue1", configProps.remove( "deprecatedProperties.propertyName1" ) ); - assertEquals( "propertyValue2", configProps.remove( "deprecatedProperties.propertyName2" ) ); + assertEquals("2", configProps.remove("deprecatedProperties")); + assertEquals("propertyValue1", configProps.remove("deprecatedProperties.propertyName1")); + assertEquals("propertyValue2", configProps.remove("deprecatedProperties.propertyName2")); - assertEquals( "2", configProps.remove( "deprecatedMap" ) ); - assertEquals( "value1", configProps.remove( "deprecatedMap.key1" ) ); - assertEquals( "value2", configProps.remove( "deprecatedMap.key2" ) ); + assertEquals("2", configProps.remove("deprecatedMap")); + assertEquals("value1", configProps.remove("deprecatedMap.key1")); + assertEquals("value2", configProps.remove("deprecatedMap.key2")); - assertTrue( "not checked config properties: " + configProps, configProps.isEmpty() ); + assertTrue("not checked config properties: " + configProps, configProps.isEmpty()); } - private List findDeprecationWarning( List logLines ) - { - Pattern pattern = Pattern.compile( ".* (Parameter|Goal) .* is deprecated:.*" ); + private List findDeprecationWarning(List logLines) { + Pattern pattern = Pattern.compile(".* (Parameter|Goal) .* is deprecated:.*"); List result = new ArrayList<>(); - for ( String line : logLines ) - { - if ( pattern.matcher( line ).matches() ) - { - result.add( line ); + for (String line : logLines) { + if (pattern.matcher(line).matches()) { + result.add(line); } } return result; diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5224InjectedSettings.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5224InjectedSettings.java index f39afa4669..26c1b171fe 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5224InjectedSettings.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5224InjectedSettings.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,15 +16,15 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.io.FileReader; import java.util.ArrayList; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.codehaus.plexus.util.xml.Xpp3Dom; import org.codehaus.plexus.util.xml.Xpp3DomBuilder; import org.junit.jupiter.api.Test; @@ -37,138 +35,120 @@ import org.junit.jupiter.api.Test; * * */ -public class MavenITmng5224InjectedSettings - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng5224InjectedSettings() - { +public class MavenITmng5224InjectedSettings extends AbstractMavenIntegrationTestCase { + public MavenITmng5224InjectedSettings() { // olamy probably doesn't work with 3.x before 3.0.4 - super( "[2.0.3,3.0-alpha-1),[3.0.4,)" ); + super("[2.0.3,3.0-alpha-1),[3.0.4,)"); } - /** * * @throws Exception in case of failure */ @Test - public void testmng5224_ReadSettings() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5224" ); + public void testmng5224_ReadSettings() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5224"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - //verifier. - verifier.addCliArgument( "validate" ); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + // verifier. + verifier.addCliArgument("validate"); verifier.execute(); - File settingsFile = new File( verifier.getBasedir(), "target/settings-dump.xml" ); + File settingsFile = new File(verifier.getBasedir(), "target/settings-dump.xml"); - FileReader fr = new FileReader( settingsFile ); + FileReader fr = new FileReader(settingsFile); - Xpp3Dom dom = Xpp3DomBuilder.build( fr ); + Xpp3Dom dom = Xpp3DomBuilder.build(fr); - Xpp3Dom profilesNode = dom.getChild( "profiles" ); + Xpp3Dom profilesNode = dom.getChild("profiles"); - Xpp3Dom[] profileNodes = profilesNode.getChildren( "profile" ); + Xpp3Dom[] profileNodes = profilesNode.getChildren("profile"); // 3 from the user settings + 1 for the global settings used for its - assertEquals( 4, profileNodes.length ); + assertEquals(4, profileNodes.length); /** - - - apache - - true - - - true - - - - release - - verycomplicatedpassphrase - - - - fast - - true - true - - - + * + * + * apache + * + * true + * + * + * true + * + * + * + * release + * + * verycomplicatedpassphrase + * + * + * + * fast + * + * true + * true + * + * + * **/ + List profileIds = new ArrayList<>(4); - List profileIds = new ArrayList<>( 4 ); - - for ( Xpp3Dom node : profileNodes ) - { - Xpp3Dom idNode = node.getChild( "id" ); - profileIds.add( idNode.getValue() ); - if ( "apache".equals( idNode.getName() ) ) - { - Xpp3Dom propsNode = node.getChild( "properties" ); - assertEquals( "true", propsNode.getChild( "run-its" ).getValue() ); + for (Xpp3Dom node : profileNodes) { + Xpp3Dom idNode = node.getChild("id"); + profileIds.add(idNode.getValue()); + if ("apache".equals(idNode.getName())) { + Xpp3Dom propsNode = node.getChild("properties"); + assertEquals("true", propsNode.getChild("run-its").getValue()); } - if ( "release".equals( idNode.getName() ) ) - { - Xpp3Dom propsNode = node.getChild( "properties" ); - assertEquals( "verycomplicatedpassphrase", propsNode.getChild( "gpg.passphrase" ).getValue() ); + if ("release".equals(idNode.getName())) { + Xpp3Dom propsNode = node.getChild("properties"); + assertEquals( + "verycomplicatedpassphrase", + propsNode.getChild("gpg.passphrase").getValue()); } - if ( "fast".equals( idNode.getName() ) ) - { - Xpp3Dom propsNode = node.getChild( "properties" ); - assertEquals( "true", propsNode.getChild( "maven.test.skip" ).getValue() ); - assertEquals( "true", propsNode.getChild( "skipTests" ).getValue() ); + if ("fast".equals(idNode.getName())) { + Xpp3Dom propsNode = node.getChild("properties"); + assertEquals("true", propsNode.getChild("maven.test.skip").getValue()); + assertEquals("true", propsNode.getChild("skipTests").getValue()); } } - assertTrue( profileIds.contains( "apache" ) ); - assertTrue( profileIds.contains( "release" ) ); - assertTrue( profileIds.contains( "fast" ) ); - assertTrue( profileIds.contains( "it-defaults" ) ); + assertTrue(profileIds.contains("apache")); + assertTrue(profileIds.contains("release")); + assertTrue(profileIds.contains("fast")); + assertTrue(profileIds.contains("it-defaults")); /** - - it-defaults - apache - + * + * it-defaults + * apache + * */ - - Xpp3Dom activeProfilesNode = dom.getChild( "activeProfiles" ); + Xpp3Dom activeProfilesNode = dom.getChild("activeProfiles"); // with maven3 profile activation (activeByDefault) is done later during project building phase // so we have only a "dump" of the settings - if ( matchesVersionRange( "[2.0.3,3.0-alpha-1)" ) ) - { - assertEquals( 2, activeProfilesNode.getChildCount() ); - } - else - { - assertEquals( 1, activeProfilesNode.getChildCount() ); + if (matchesVersionRange("[2.0.3,3.0-alpha-1)")) { + assertEquals(2, activeProfilesNode.getChildCount()); + } else { + assertEquals(1, activeProfilesNode.getChildCount()); } - List activeProfiles = new ArrayList<>( 2 ); + List activeProfiles = new ArrayList<>(2); - for ( Xpp3Dom node : activeProfilesNode.getChildren() ) - { - activeProfiles.add( node.getValue() ); + for (Xpp3Dom node : activeProfilesNode.getChildren()) { + activeProfiles.add(node.getValue()); } - if ( matchesVersionRange( "[2.0.3,3.0-alpha-1)" ) ) - { - assertTrue( activeProfiles.contains( "apache" ) ); + if (matchesVersionRange("[2.0.3,3.0-alpha-1)")) { + assertTrue(activeProfiles.contains("apache")); } - assertTrue( activeProfiles.contains( "it-defaults" ) ); - + assertTrue(activeProfiles.contains("it-defaults")); } - - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5230MakeReactorWithExcludesTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5230MakeReactorWithExcludesTest.java index b7fde733c6..6f1d987e10 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5230MakeReactorWithExcludesTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5230MakeReactorWithExcludesTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,35 +16,30 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** * Test case adapted from MNG-2576 * @author Luuk van den Broek */ -public class MavenITmng5230MakeReactorWithExcludesTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng5230MakeReactorWithExcludesTest extends AbstractMavenIntegrationTestCase { - public MavenITmng5230MakeReactorWithExcludesTest() - { - super( "[3.2,)" ); + public MavenITmng5230MakeReactorWithExcludesTest() { + super("[3.2,)"); } - private void clean( Verifier verifier ) - throws Exception - { - verifier.deleteDirectory( "target" ); - verifier.deleteDirectory( "mod-a/target" ); - verifier.deleteDirectory( "mod-b/target" ); - verifier.deleteDirectory( "mod-c/target" ); - verifier.deleteDirectory( "mod-d/target" ); + private void clean(Verifier verifier) throws Exception { + verifier.deleteDirectory("target"); + verifier.deleteDirectory("mod-a/target"); + verifier.deleteDirectory("mod-b/target"); + verifier.deleteDirectory("mod-c/target"); + verifier.deleteDirectory("mod-d/target"); } /** @@ -55,27 +48,25 @@ public class MavenITmng5230MakeReactorWithExcludesTest * @throws Exception in case of failure */ @Test - public void testitMakeWithExclude() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5230-make-reactor-with-excludes" ); + public void testitMakeWithExclude() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5230-make-reactor-with-excludes"); - Verifier verifier = newVerifier( testDir.getAbsolutePath(), true ); - verifier.addCliArgument( "-X" ); - verifier.setAutoclean( false ); - clean( verifier ); - verifier.addCliArgument( "-pl" ); - verifier.addCliArgument( "!mod-b" ); - verifier.setLogFileName( "log-only.txt" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath(), true); + verifier.addCliArgument("-X"); + verifier.setAutoclean(false); + clean(verifier); + verifier.addCliArgument("-pl"); + verifier.addCliArgument("!mod-b"); + verifier.setLogFileName("log-only.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/touch.txt" ); - verifier.verifyFilePresent( "mod-a/target/touch.txt" ); - verifier.verifyFileNotPresent( "mod-b/target/touch.txt" ); - verifier.verifyFilePresent( "mod-c/target/touch.txt" ); - verifier.verifyFilePresent( "mod-d/target/touch.txt" ); + verifier.verifyFilePresent("target/touch.txt"); + verifier.verifyFilePresent("mod-a/target/touch.txt"); + verifier.verifyFileNotPresent("mod-b/target/touch.txt"); + verifier.verifyFilePresent("mod-c/target/touch.txt"); + verifier.verifyFilePresent("mod-d/target/touch.txt"); } /** @@ -84,27 +75,25 @@ public class MavenITmng5230MakeReactorWithExcludesTest * @throws Exception in case of failure */ @Test - public void testitMakeUpstreamExclude() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5230-make-reactor-with-excludes" ); + public void testitMakeUpstreamExclude() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5230-make-reactor-with-excludes"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - clean( verifier ); - verifier.addCliArgument( "-pl" ); - verifier.addCliArgument( "mod-b,!mod-a" ); - verifier.addCliArgument( "-am" ); - verifier.setLogFileName( "log-upstream.txt" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + clean(verifier); + verifier.addCliArgument("-pl"); + verifier.addCliArgument("mod-b,!mod-a"); + verifier.addCliArgument("-am"); + verifier.setLogFileName("log-upstream.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/touch.txt" ); - verifier.verifyFileNotPresent( "mod-a/target/touch.txt" ); - verifier.verifyFilePresent( "mod-b/target/touch.txt" ); - verifier.verifyFileNotPresent( "mod-c/target/touch.txt" ); - verifier.verifyFileNotPresent( "mod-d/target/touch.txt" ); + verifier.verifyFilePresent("target/touch.txt"); + verifier.verifyFileNotPresent("mod-a/target/touch.txt"); + verifier.verifyFilePresent("mod-b/target/touch.txt"); + verifier.verifyFileNotPresent("mod-c/target/touch.txt"); + verifier.verifyFileNotPresent("mod-d/target/touch.txt"); } /** @@ -113,27 +102,25 @@ public class MavenITmng5230MakeReactorWithExcludesTest * @throws Exception in case of failure */ @Test - public void testitMakeDownstreamExclude() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5230-make-reactor-with-excludes" ); + public void testitMakeDownstreamExclude() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5230-make-reactor-with-excludes"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - clean( verifier ); - verifier.addCliArgument( "-pl" ); - verifier.addCliArgument( "mod-b,!mod-c" ); - verifier.addCliArgument( "-amd" ); - verifier.setLogFileName( "log-downstream.txt" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + clean(verifier); + verifier.addCliArgument("-pl"); + verifier.addCliArgument("mod-b,!mod-c"); + verifier.addCliArgument("-amd"); + verifier.setLogFileName("log-downstream.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFileNotPresent( "target/touch.txt" ); - verifier.verifyFileNotPresent( "mod-a/target/touch.txt" ); - verifier.verifyFilePresent( "mod-b/target/touch.txt" ); - verifier.verifyFileNotPresent( "mod-c/target/touch.txt" ); - verifier.verifyFileNotPresent( "mod-d/target/touch.txt" ); + verifier.verifyFileNotPresent("target/touch.txt"); + verifier.verifyFileNotPresent("mod-a/target/touch.txt"); + verifier.verifyFilePresent("mod-b/target/touch.txt"); + verifier.verifyFileNotPresent("mod-c/target/touch.txt"); + verifier.verifyFileNotPresent("mod-d/target/touch.txt"); } /** @@ -142,28 +129,26 @@ public class MavenITmng5230MakeReactorWithExcludesTest * @throws Exception in case of failure */ @Test - public void testitMakeBothExclude() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5230-make-reactor-with-excludes" ); + public void testitMakeBothExclude() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5230-make-reactor-with-excludes"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - clean( verifier ); - verifier.addCliArgument( "-pl" ); - verifier.addCliArgument( "mod-b,!mod-a" ); - verifier.addCliArgument( "-am" ); - verifier.addCliArgument( "-amd" ); - verifier.setLogFileName( "log-both.txt" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + clean(verifier); + verifier.addCliArgument("-pl"); + verifier.addCliArgument("mod-b,!mod-a"); + verifier.addCliArgument("-am"); + verifier.addCliArgument("-amd"); + verifier.setLogFileName("log-both.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/touch.txt" ); - verifier.verifyFileNotPresent( "mod-a/target/touch.txt" ); - verifier.verifyFilePresent( "mod-b/target/touch.txt" ); - verifier.verifyFilePresent( "mod-c/target/touch.txt" ); - verifier.verifyFileNotPresent( "mod-d/target/touch.txt" ); + verifier.verifyFilePresent("target/touch.txt"); + verifier.verifyFileNotPresent("mod-a/target/touch.txt"); + verifier.verifyFilePresent("mod-b/target/touch.txt"); + verifier.verifyFilePresent("mod-c/target/touch.txt"); + verifier.verifyFileNotPresent("mod-d/target/touch.txt"); } /** @@ -172,27 +157,25 @@ public class MavenITmng5230MakeReactorWithExcludesTest * @throws Exception in case of failure */ @Test - public void testitMatchesByBasedirExclamationExclude() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5230-make-reactor-with-excludes" ); + public void testitMatchesByBasedirExclamationExclude() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5230-make-reactor-with-excludes"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - clean( verifier ); - verifier.verifyFileNotPresent( "mod-d/pom.xml" ); - verifier.addCliArgument( "-pl" ); - verifier.addCliArgument( "!mod-d" ); - verifier.setLogFileName( "log-basedir-exclamation.txt" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + clean(verifier); + verifier.verifyFileNotPresent("mod-d/pom.xml"); + verifier.addCliArgument("-pl"); + verifier.addCliArgument("!mod-d"); + verifier.setLogFileName("log-basedir-exclamation.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/touch.txt" ); - verifier.verifyFilePresent( "mod-a/target/touch.txt" ); - verifier.verifyFilePresent( "mod-b/target/touch.txt" ); - verifier.verifyFilePresent( "mod-c/target/touch.txt" ); - verifier.verifyFileNotPresent( "mod-d/target/touch.txt" ); + verifier.verifyFilePresent("target/touch.txt"); + verifier.verifyFilePresent("mod-a/target/touch.txt"); + verifier.verifyFilePresent("mod-b/target/touch.txt"); + verifier.verifyFilePresent("mod-c/target/touch.txt"); + verifier.verifyFileNotPresent("mod-d/target/touch.txt"); } /** @@ -201,56 +184,51 @@ public class MavenITmng5230MakeReactorWithExcludesTest * @throws Exception in case of failure */ @Test - public void testitMatchesByBasedirMinusExclude() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5230-make-reactor-with-excludes" ); + public void testitMatchesByBasedirMinusExclude() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5230-make-reactor-with-excludes"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - clean( verifier ); - verifier.verifyFileNotPresent( "mod-d/pom.xml" ); - verifier.addCliArgument( "-pl" ); - verifier.addCliArgument( "-mod-d" ); - verifier.setLogFileName( "log-basedir-minus.txt" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + clean(verifier); + verifier.verifyFileNotPresent("mod-d/pom.xml"); + verifier.addCliArgument("-pl"); + verifier.addCliArgument("-mod-d"); + verifier.setLogFileName("log-basedir-minus.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/touch.txt" ); - verifier.verifyFilePresent( "mod-a/target/touch.txt" ); - verifier.verifyFilePresent( "mod-b/target/touch.txt" ); - verifier.verifyFilePresent( "mod-c/target/touch.txt" ); - verifier.verifyFileNotPresent( "mod-d/target/touch.txt" ); + verifier.verifyFilePresent("target/touch.txt"); + verifier.verifyFilePresent("mod-a/target/touch.txt"); + verifier.verifyFilePresent("mod-b/target/touch.txt"); + verifier.verifyFilePresent("mod-c/target/touch.txt"); + verifier.verifyFileNotPresent("mod-d/target/touch.txt"); } - /** * Verify that the project list can also specify project ids for exclusion * * @throws Exception in case of failure */ @Test - public void testitMatchesByIdExclude() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5230-make-reactor-with-excludes" ); + public void testitMatchesByIdExclude() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5230-make-reactor-with-excludes"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - clean( verifier ); - verifier.addCliArgument( "-pl" ); - verifier.addCliArgument( "!org.apache.maven.its.mng5230:mod-b" ); - verifier.setLogFileName( "log-id.txt" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + clean(verifier); + verifier.addCliArgument("-pl"); + verifier.addCliArgument("!org.apache.maven.its.mng5230:mod-b"); + verifier.setLogFileName("log-id.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/touch.txt" ); - verifier.verifyFilePresent( "mod-a/target/touch.txt" ); - verifier.verifyFileNotPresent( "mod-b/target/touch.txt" ); - verifier.verifyFilePresent( "mod-c/target/touch.txt" ); - verifier.verifyFilePresent( "mod-d/target/touch.txt" ); + verifier.verifyFilePresent("target/touch.txt"); + verifier.verifyFilePresent("mod-a/target/touch.txt"); + verifier.verifyFileNotPresent("mod-b/target/touch.txt"); + verifier.verifyFilePresent("mod-c/target/touch.txt"); + verifier.verifyFilePresent("mod-d/target/touch.txt"); } /** @@ -259,55 +237,51 @@ public class MavenITmng5230MakeReactorWithExcludesTest * @throws Exception in case of failure */ @Test - public void testitMatchesByArtifactIdExclude() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5230-make-reactor-with-excludes" ); + public void testitMatchesByArtifactIdExclude() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5230-make-reactor-with-excludes"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - clean( verifier ); - verifier.addCliArgument( "-pl" ); - verifier.addCliArgument( "!:mod-b" ); - verifier.setLogFileName( "log-artifact-id.txt" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + clean(verifier); + verifier.addCliArgument("-pl"); + verifier.addCliArgument("!:mod-b"); + verifier.setLogFileName("log-artifact-id.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/touch.txt" ); - verifier.verifyFilePresent( "mod-a/target/touch.txt" ); - verifier.verifyFileNotPresent( "mod-b/target/touch.txt" ); - verifier.verifyFilePresent( "mod-c/target/touch.txt" ); - verifier.verifyFilePresent( "mod-d/target/touch.txt" ); + verifier.verifyFilePresent("target/touch.txt"); + verifier.verifyFilePresent("mod-a/target/touch.txt"); + verifier.verifyFileNotPresent("mod-b/target/touch.txt"); + verifier.verifyFilePresent("mod-c/target/touch.txt"); + verifier.verifyFilePresent("mod-d/target/touch.txt"); } - /** + /** * Verify that reactor is resumed from specified project with exclude * * @throws Exception in case of failure */ @Test - public void testitResumeFromExclude() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5230-make-reactor-with-excludes" ); + public void testitResumeFromExclude() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5230-make-reactor-with-excludes"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - clean( verifier ); - verifier.addCliArgument( "-rf" ); - verifier.addCliArgument( "mod-b" ); - verifier.addCliArgument( "-pl" ); - verifier.addCliArgument( "!mod-c" ); - verifier.setLogFileName( "log-resume.txt" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + clean(verifier); + verifier.addCliArgument("-rf"); + verifier.addCliArgument("mod-b"); + verifier.addCliArgument("-pl"); + verifier.addCliArgument("!mod-c"); + verifier.setLogFileName("log-resume.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFileNotPresent( "target/touch.txt" ); - verifier.verifyFileNotPresent( "mod-a/target/touch.txt" ); - verifier.verifyFilePresent( "mod-b/target/touch.txt" ); - verifier.verifyFileNotPresent( "mod-c/target/touch.txt" ); - verifier.verifyFilePresent( "mod-d/target/touch.txt" ); + verifier.verifyFileNotPresent("target/touch.txt"); + verifier.verifyFileNotPresent("mod-a/target/touch.txt"); + verifier.verifyFilePresent("mod-b/target/touch.txt"); + verifier.verifyFileNotPresent("mod-c/target/touch.txt"); + verifier.verifyFilePresent("mod-d/target/touch.txt"); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5280SettingsProfilesRepositoriesOrderTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5280SettingsProfilesRepositoriesOrderTest.java index cc8a4cc3cc..bd4ab1cc37 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5280SettingsProfilesRepositoriesOrderTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5280SettingsProfilesRepositoriesOrderTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,9 +16,7 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -33,6 +29,8 @@ import java.io.OutputStream; import java.io.PrintWriter; import java.util.Map; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.eclipse.jetty.server.NetworkConnector; import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.Server; @@ -46,32 +44,24 @@ import org.junit.jupiter.api.Test; * * @author Anders Hammar */ -public class MavenITmng5280SettingsProfilesRepositoriesOrderTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng5280SettingsProfilesRepositoriesOrderTest extends AbstractMavenIntegrationTestCase { private File testDir; private Server server; - public MavenITmng5280SettingsProfilesRepositoriesOrderTest() - { - super( "[3.1-A,)" ); + public MavenITmng5280SettingsProfilesRepositoriesOrderTest() { + super("[3.1-A,)"); } @BeforeEach - protected void setUp() - throws Exception - { - testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5280" ); - server = new Server( 0 ); + protected void setUp() throws Exception { + testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5280"); + server = new Server(0); } @AfterEach - protected void tearDown() - throws Exception - { - if ( server != null ) - { + protected void tearDown() throws Exception { + if (server != null) { server.stop(); server.join(); } @@ -83,35 +73,33 @@ public class MavenITmng5280SettingsProfilesRepositoriesOrderTest * @throws Exception in case of failure */ @Test - public void testRepositoriesOrder() - throws Exception - { + public void testRepositoriesOrder() throws Exception { RepoHandler repoHandler = new RepoHandler(); - server.setHandler( repoHandler ); + server.setHandler(repoHandler); server.start(); - if ( server.isFailed() ) - { - fail( "Couldn't bind the server socket to a free port!" ); + if (server.isFailed()) { + fail("Couldn't bind the server socket to a free port!"); } - int httpPort = ( (NetworkConnector) server.getConnectors()[0] ).getLocalPort(); - System.out.println( "Bound server socket to the port " + httpPort ); + int httpPort = ((NetworkConnector) server.getConnectors()[0]).getLocalPort(); + System.out.println("Bound server socket to the port " + httpPort); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng5280" ); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng5280"); Map filterProps = verifier.newDefaultFilterMap(); - filterProps.put( "@httpserver.port@", Integer.toString( httpPort ) ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "org.apache.maven.its.plugins:maven-it-plugin-dependency-resolution:2.1-SNAPSHOT:compile" ); + filterProps.put("@httpserver.port@", Integer.toString(httpPort)); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8", filterProps); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument( + "org.apache.maven.its.plugins:maven-it-plugin-dependency-resolution:2.1-SNAPSHOT:compile"); verifier.execute(); verifier.verifyErrorFreeLog(); - assertTrue( repoHandler.artifactRequestedFromRepo2 ); - assertTrue( repoHandler.artifactRequestedFromRepo1Last ); + assertTrue(repoHandler.artifactRequestedFromRepo2); + assertTrue(repoHandler.artifactRequestedFromRepo1Last); } /** @@ -120,159 +108,123 @@ public class MavenITmng5280SettingsProfilesRepositoriesOrderTest * @throws Exception in case of failure */ @Test - public void testPluginRepositoriesOrder() - throws Exception - { + public void testPluginRepositoriesOrder() throws Exception { PluginRepoHandler pluginRepoHandler = new PluginRepoHandler(); - server.setHandler( pluginRepoHandler ); + server.setHandler(pluginRepoHandler); server.start(); - if ( server.isFailed() ) - { - fail( "Couldn't bind the server socket to a free port!" ); + if (server.isFailed()) { + fail("Couldn't bind the server socket to a free port!"); } - int httpPort = ( (NetworkConnector) server.getConnectors()[0] ).getLocalPort(); - System.out.println( "Bound server socket to the port " + httpPort ); + int httpPort = ((NetworkConnector) server.getConnectors()[0]).getLocalPort(); + System.out.println("Bound server socket to the port " + httpPort); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng5280" ); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng5280"); Map filterProps = verifier.newDefaultFilterMap(); - filterProps.put( "@httpserver.port@", Integer.toString( httpPort ) ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "org.apache.maven.its.mng5280:fake-maven-plugin:1.0:fake" ); + filterProps.put("@httpserver.port@", Integer.toString(httpPort)); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8", filterProps); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("org.apache.maven.its.mng5280:fake-maven-plugin:1.0:fake"); verifier.execute(); - assertTrue( pluginRepoHandler.pluginRequestedFromRepo2 ); - assertTrue( pluginRepoHandler.pluginRequestedFromRepo1Last ); + assertTrue(pluginRepoHandler.pluginRequestedFromRepo2); + assertTrue(pluginRepoHandler.pluginRequestedFromRepo1Last); } - private static final class RepoHandler - extends AbstractHandler - { + private static final class RepoHandler extends AbstractHandler { private volatile boolean artifactRequestedFromRepo1Last; private volatile boolean artifactRequestedFromRepo2; - public void handle( String target, Request baseRequest, HttpServletRequest request, - HttpServletResponse response ) - throws IOException - { + public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) + throws IOException { String uri = request.getRequestURI(); - if ( uri.startsWith( "/repo1/org/apache/maven/its/mng5280/fake-artifact/1.0/" ) ) - { + if (uri.startsWith("/repo1/org/apache/maven/its/mng5280/fake-artifact/1.0/")) { PrintWriter writer = response.getWriter(); - if ( uri.endsWith( ".pom" ) ) - { - writer.println( "" ); - writer.println( " 4.0.0" ); - writer.println( " org.apache.maven.its.mng5280" ); - writer.println( " fake-artifact" ); - writer.println( " 1.0" ); - writer.println( "" ); + if (uri.endsWith(".pom")) { + writer.println(""); + writer.println(" 4.0.0"); + writer.println(" org.apache.maven.its.mng5280"); + writer.println(" fake-artifact"); + writer.println(" 1.0"); + writer.println(""); - response.setStatus( HttpServletResponse.SC_OK ); - } - else if ( uri.endsWith( ".jar" ) ) - { - writer.println( "empty" ); + response.setStatus(HttpServletResponse.SC_OK); + } else if (uri.endsWith(".jar")) { + writer.println("empty"); - response.setStatus( HttpServletResponse.SC_OK ); + response.setStatus(HttpServletResponse.SC_OK); artifactRequestedFromRepo1Last = true; + } else { + response.setStatus(HttpServletResponse.SC_NOT_FOUND); } - else - { - response.setStatus( HttpServletResponse.SC_NOT_FOUND ); - } - } - else if ( uri.startsWith( "/repo2/org/apache/maven/its/mng5280/fake-artifact/1.0/" ) ) - { - if ( uri.endsWith( ".jar" ) ) - { + } else if (uri.startsWith("/repo2/org/apache/maven/its/mng5280/fake-artifact/1.0/")) { + if (uri.endsWith(".jar")) { artifactRequestedFromRepo1Last = false; artifactRequestedFromRepo2 = true; } - response.setStatus( HttpServletResponse.SC_NOT_FOUND ); - } - else - { - response.setStatus( HttpServletResponse.SC_NOT_FOUND ); + response.setStatus(HttpServletResponse.SC_NOT_FOUND); + } else { + response.setStatus(HttpServletResponse.SC_NOT_FOUND); } - ( (Request) request ).setHandled( true ); + ((Request) request).setHandled(true); } } - private class PluginRepoHandler - extends AbstractHandler - { + private class PluginRepoHandler extends AbstractHandler { private volatile boolean pluginRequestedFromRepo1Last; private volatile boolean pluginRequestedFromRepo2; - public void handle( String target, Request baseRequest, HttpServletRequest request, - HttpServletResponse response ) - throws IOException - { + public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) + throws IOException { String uri = request.getRequestURI(); - if ( uri.startsWith( "/pluginRepo1/org/apache/maven/its/mng5280/fake-maven-plugin/1.0/" ) ) - { + if (uri.startsWith("/pluginRepo1/org/apache/maven/its/mng5280/fake-maven-plugin/1.0/")) { OutputStream outStream = response.getOutputStream(); - if ( uri.endsWith( ".pom" ) ) - { - File pluginPom = new File( testDir, "fake-maven-plugin/fake-maven-plugin-1.0.pom" ); - InputStream inStream = new FileInputStream( pluginPom ); - copy( inStream, outStream ); + if (uri.endsWith(".pom")) { + File pluginPom = new File(testDir, "fake-maven-plugin/fake-maven-plugin-1.0.pom"); + InputStream inStream = new FileInputStream(pluginPom); + copy(inStream, outStream); - response.setStatus( HttpServletResponse.SC_OK ); - } - else if ( uri.endsWith( ".jar" ) ) - { - File pluginJar = new File( testDir, "fake-maven-plugin/fake-maven-plugin-1.0.jar" ); - InputStream inStream = new FileInputStream( pluginJar ); - copy( inStream, outStream ); + response.setStatus(HttpServletResponse.SC_OK); + } else if (uri.endsWith(".jar")) { + File pluginJar = new File(testDir, "fake-maven-plugin/fake-maven-plugin-1.0.jar"); + InputStream inStream = new FileInputStream(pluginJar); + copy(inStream, outStream); - response.setStatus( HttpServletResponse.SC_OK ); + response.setStatus(HttpServletResponse.SC_OK); pluginRequestedFromRepo1Last = true; + } else { + response.setStatus(HttpServletResponse.SC_NOT_FOUND); } - else - { - response.setStatus( HttpServletResponse.SC_NOT_FOUND ); - } - } - else if ( uri.startsWith( "/pluginRepo2/org/apache/maven/its/mng5280/fake-maven-plugin/1.0/" ) ) - { - if ( uri.endsWith( ".jar" ) ) - { + } else if (uri.startsWith("/pluginRepo2/org/apache/maven/its/mng5280/fake-maven-plugin/1.0/")) { + if (uri.endsWith(".jar")) { pluginRequestedFromRepo1Last = false; pluginRequestedFromRepo2 = true; } - response.setStatus( HttpServletResponse.SC_NOT_FOUND ); - } - else - { - response.setStatus( HttpServletResponse.SC_NOT_FOUND ); + response.setStatus(HttpServletResponse.SC_NOT_FOUND); + } else { + response.setStatus(HttpServletResponse.SC_NOT_FOUND); } - ( (Request) request ).setHandled( true ); + ((Request) request).setHandled(true); } - private long copy( InputStream input, OutputStream output ) - throws IOException - { + private long copy(InputStream input, OutputStream output) throws IOException { byte[] buffer = new byte[4 * 1024]; long count = 0; int n = 0; - while ( -1 != ( n = input.read( buffer ) ) ) - { - output.write( buffer, 0, n ); + while (-1 != (n = input.read(buffer))) { + output.write(buffer, 0, n); count += n; } return count; diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5338FileOptionToDirectory.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5338FileOptionToDirectory.java index 87346fb952..e9ce69d16a 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5338FileOptionToDirectory.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5338FileOptionToDirectory.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -32,41 +30,31 @@ import org.junit.jupiter.api.Test; * * @author Olivier Lamy */ -public class MavenITmng5338FileOptionToDirectory - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng5338FileOptionToDirectory extends AbstractMavenIntegrationTestCase { private File testDir; - public MavenITmng5338FileOptionToDirectory() - { - super( "[3.1-A,)" ); + public MavenITmng5338FileOptionToDirectory() { + super("[3.1-A,)"); } @BeforeEach - public void setUp() - throws Exception - { - testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5338" ); - + public void setUp() throws Exception { + testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5338"); } @Test - public void testFileOptionToADirectory() - throws Exception - { - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); + public void testFileOptionToADirectory() throws Exception { + Verifier verifier = newVerifier(testDir.getAbsolutePath()); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng5338" ); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng5338"); - verifier.addCliArgument( "-f" ); - verifier.addCliArgument( "project" ); - verifier.addCliArgument( "validate" ); + verifier.addCliArgument("-f"); + verifier.addCliArgument("project"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5382Jsr330Plugin.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5382Jsr330Plugin.java index aabb155cfd..86d96cf4cd 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5382Jsr330Plugin.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5382Jsr330Plugin.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -32,49 +30,41 @@ import org.junit.jupiter.api.Test; * * @author Jason van Zyl */ -public class MavenITmng5382Jsr330Plugin - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng5382Jsr330Plugin extends AbstractMavenIntegrationTestCase { private File testDir; - public MavenITmng5382Jsr330Plugin() - { - super( "[3.1-alpha,)" ); + public MavenITmng5382Jsr330Plugin() { + super("[3.1-alpha,)"); } @BeforeEach - public void setUp() - throws Exception - { - testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5382" ); + public void setUp() throws Exception { + testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5382"); } @Test - public void testJsr330PluginExecution() - throws Exception - { + public void testJsr330PluginExecution() throws Exception { // // Build a plugin that uses a JSR330 plugin // - Verifier v0 = newVerifier( testDir.getAbsolutePath(), "remote" ); - v0.setAutoclean( false ); - v0.deleteDirectory( "target" ); - v0.deleteArtifacts( "org.apache.maven.its.mng5382" ); - v0.addCliArgument( "install" ); + Verifier v0 = newVerifier(testDir.getAbsolutePath(), "remote"); + v0.setAutoclean(false); + v0.deleteDirectory("target"); + v0.deleteArtifacts("org.apache.maven.its.mng5382"); + v0.addCliArgument("install"); v0.execute(); v0.verifyErrorFreeLog(); // // Execute the JSR330 plugin // - Verifier v1 = newVerifier( testDir.getAbsolutePath(), "remote" ); - v1.setAutoclean( false ); - v1.addCliArgument( "org.apache.maven.its.mng5382:jsr330-maven-plugin:0.0.1-SNAPSHOT:hello" ); + Verifier v1 = newVerifier(testDir.getAbsolutePath(), "remote"); + v1.setAutoclean(false); + v1.addCliArgument("org.apache.maven.its.mng5382:jsr330-maven-plugin:0.0.1-SNAPSHOT:hello"); v1.execute(); v1.verifyErrorFreeLog(); - v1.verifyTextInLog( "Hello! I am a component that is being used via constructor injection! That's right, I'm a JSR330 badass." ); - + v1.verifyTextInLog( + "Hello! I am a component that is being used via constructor injection! That's right, I'm a JSR330 badass."); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5387ArtifactReplacementPlugin.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5387ArtifactReplacementPlugin.java index 814b8b44ae..91da281d65 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5387ArtifactReplacementPlugin.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5387ArtifactReplacementPlugin.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,48 +16,41 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import org.apache.maven.shared.utils.io.FileUtils; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -public class MavenITmng5387ArtifactReplacementPlugin - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng5387ArtifactReplacementPlugin extends AbstractMavenIntegrationTestCase { private File testDir; - public MavenITmng5387ArtifactReplacementPlugin() - { - super( "[3.1,)" ); + public MavenITmng5387ArtifactReplacementPlugin() { + super("[3.1,)"); } @BeforeEach - public void setUp() - throws Exception - { - testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5387" ); + public void setUp() throws Exception { + testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5387"); } @Test - public void testArtifactReplacementExecution() - throws Exception - { - Verifier v0 = newVerifier( testDir.getAbsolutePath(), "remote" ); - v0.setAutoclean( false ); - v0.deleteDirectory( "target" ); - v0.deleteArtifacts( "org.apache.maven.its.mng5387" ); - v0.addCliArgument( "install" ); + public void testArtifactReplacementExecution() throws Exception { + Verifier v0 = newVerifier(testDir.getAbsolutePath(), "remote"); + v0.setAutoclean(false); + v0.deleteDirectory("target"); + v0.deleteArtifacts("org.apache.maven.its.mng5387"); + v0.addCliArgument("install"); v0.execute(); v0.verifyErrorFreeLog(); - String path = v0.getArtifactPath( "org.apache.maven.its.mng5387", "mng5387-it", "0.0.1-SNAPSHOT", "txt", "c" ); - String contents = FileUtils.fileRead( new File( path ), "utf-8" ); - assertTrue( contents.contains( "This is the second file" ) ); + String path = v0.getArtifactPath("org.apache.maven.its.mng5387", "mng5387-it", "0.0.1-SNAPSHOT", "txt", "c"); + String contents = FileUtils.fileRead(new File(path), "utf-8"); + assertTrue(contents.contains("This is the second file")); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5389LifecycleParticipantAfterSessionEnd.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5389LifecycleParticipantAfterSessionEnd.java index 46b67a0355..627fab9d15 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5389LifecycleParticipantAfterSessionEnd.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5389LifecycleParticipantAfterSessionEnd.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,45 +16,40 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; -public class MavenITmng5389LifecycleParticipantAfterSessionEnd - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng5389LifecycleParticipantAfterSessionEnd() - { - super( "[3.2.1,)" ); +public class MavenITmng5389LifecycleParticipantAfterSessionEnd extends AbstractMavenIntegrationTestCase { + public MavenITmng5389LifecycleParticipantAfterSessionEnd() { + super("[3.2.1,)"); } @Test - public void testit() - throws Exception - { + public void testit() throws Exception { File testDir = - ResourceExtractor.simpleExtractResources( getClass(), "/mng-5389-lifecycleParticipant-afterSession" ); - File extensionDir = new File( testDir, "extension" ); - File projectDir = new File( testDir, "basic" ); + ResourceExtractor.simpleExtractResources(getClass(), "/mng-5389-lifecycleParticipant-afterSession"); + File extensionDir = new File(testDir, "extension"); + File projectDir = new File(testDir, "basic"); Verifier verifier; // install the test plugin - verifier = newVerifier( extensionDir.getAbsolutePath(), "remote" ); - verifier.addCliArgument( "install" ); + verifier = newVerifier(extensionDir.getAbsolutePath(), "remote"); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); // build the test project - verifier = newVerifier( projectDir.getAbsolutePath(), "remote" ); - verifier.addCliArgument( "package" ); + verifier = newVerifier(projectDir.getAbsolutePath(), "remote"); + verifier.addCliArgument("package"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/afterSessionEnd.txt" ); + verifier.verifyFilePresent("target/afterSessionEnd.txt"); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5418FileProjectPropertiesActivatorTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5418FileProjectPropertiesActivatorTest.java index 4e0e5fef2b..a3e0aeb4b4 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5418FileProjectPropertiesActivatorTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5418FileProjectPropertiesActivatorTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * @author Olivier Lamy */ @Tag("disabled") -public class MavenITmng5418FileProjectPropertiesActivatorTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng5418FileProjectPropertiesActivatorTest extends AbstractMavenIntegrationTestCase { - public MavenITmng5418FileProjectPropertiesActivatorTest() - { - super( "[3.1,)" ); + public MavenITmng5418FileProjectPropertiesActivatorTest() { + super("[3.1,)"); } /** @@ -48,23 +43,19 @@ public class MavenITmng5418FileProjectPropertiesActivatorTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5418" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5418"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/path1.txt" ); - verifier.verifyFilePresent( "target/file1.txt" ); - verifier.verifyFilePresent( "target/missing1.txt" ); - verifier.verifyFileNotPresent( "target/missing2.txt" ); - + verifier.verifyFilePresent("target/path1.txt"); + verifier.verifyFilePresent("target/file1.txt"); + verifier.verifyFilePresent("target/missing1.txt"); + verifier.verifyFileNotPresent("target/missing2.txt"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5445LegacyStringSearchModelInterpolatorTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5445LegacyStringSearchModelInterpolatorTest.java index f1aac906cc..e6fbc70ed7 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5445LegacyStringSearchModelInterpolatorTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5445LegacyStringSearchModelInterpolatorTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,24 +16,21 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** * This is a test set for MNG-5445. */ -public class MavenITmng5445LegacyStringSearchModelInterpolatorTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng5445LegacyStringSearchModelInterpolatorTest extends AbstractMavenIntegrationTestCase { - public MavenITmng5445LegacyStringSearchModelInterpolatorTest() - { - super( "[3.1,)" ); + public MavenITmng5445LegacyStringSearchModelInterpolatorTest() { + super("[3.1,)"); } /** @@ -44,17 +39,14 @@ public class MavenITmng5445LegacyStringSearchModelInterpolatorTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5445" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5445"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5452MavenBuildTimestampUTCTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5452MavenBuildTimestampUTCTest.java index 6d92c32ab6..b9140a9798 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5452MavenBuildTimestampUTCTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5452MavenBuildTimestampUTCTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,43 +16,38 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** * This is a test set for MNG-5452 * Make sure that the maven.build.timestamp is in UTC. */ -public class MavenITmng5452MavenBuildTimestampUTCTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng5452MavenBuildTimestampUTCTest extends AbstractMavenIntegrationTestCase { - public MavenITmng5452MavenBuildTimestampUTCTest() - { - super( "[3.2.2,)" ); + public MavenITmng5452MavenBuildTimestampUTCTest() { + super("[3.2.2,)"); } @Test - public void testMavenBuildTimestampIsUsingUTC() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5452-maven-build-timestamp-utc" ); + public void testMavenBuildTimestampIsUsingUTC() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5452-maven-build-timestamp-utc"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.addCliArgument( "process-resources" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.addCliArgument("process-resources"); verifier.execute(); // // We have a timestamp format = yyyyMMdd:HHmm:z, where the final element is the timezone which should be UTC // - Properties filteredProperties = verifier.loadProperties( "target/classes/filtered.properties" ); - String timestamp = filteredProperties.getProperty( "timestamp" ); - assertNotNull( timestamp ); - assertTrue( timestamp.endsWith( "UTC" ) ); + Properties filteredProperties = verifier.loadProperties("target/classes/filtered.properties"); + String timestamp = filteredProperties.getProperty("timestamp"); + assertNotNull(timestamp); + assertTrue(timestamp.endsWith("UTC")); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5482AetherNotFoundTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5482AetherNotFoundTest.java index c72cfe624a..1daa1ada6e 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5482AetherNotFoundTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5482AetherNotFoundTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,16 +16,16 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; import java.io.IOException; import java.util.List; import java.util.regex.Pattern; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -38,27 +36,20 @@ import org.junit.jupiter.api.Test; * * @author hboutemy */ -public class MavenITmng5482AetherNotFoundTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng5482AetherNotFoundTest extends AbstractMavenIntegrationTestCase { - public MavenITmng5482AetherNotFoundTest() - { - super( "[3.1-A,)" ); + public MavenITmng5482AetherNotFoundTest() { + super("[3.1-A,)"); } @Test - public void testPluginDependency() - throws IOException, VerificationException - { - check( "plugin-dependency" ); + public void testPluginDependency() throws IOException, VerificationException { + check("plugin-dependency"); } @Test - public void testPluginSite() - throws IOException, VerificationException - { - check( "plugin-site" ); + public void testPluginSite() throws IOException, VerificationException { + check("plugin-site"); } /*public void testReportMpir() @@ -67,50 +58,41 @@ public class MavenITmng5482AetherNotFoundTest check( "report-mpir" ); }*/ - public void check( String dir ) - throws IOException, VerificationException - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5482/" + dir ); + public void check(String dir) throws IOException, VerificationException { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5482/" + dir); - Verifier verifier = newVerifier( testDir.getAbsolutePath(), "remote" ); - verifier.setAutoclean( false ); + Verifier verifier = newVerifier(testDir.getAbsolutePath(), "remote"); + verifier.setAutoclean(false); - try - { - verifier.addCliArgument( "validate" ); + try { + verifier.addCliArgument("validate"); verifier.execute(); - fail( "should throw an error during execution." ); - } - catch ( VerificationException e ) - { + fail("should throw an error during execution."); + } catch (VerificationException e) { // expected...it'd be nice if we could get the specifics of the exception right here... } - List lines = verifier.loadFile( new File( testDir, "log.txt" ), false ); + List lines = verifier.loadFile(new File(testDir, "log.txt"), false); - int msg = indexOf( lines, "Caused by: java.lang.ClassNotFoundException: org.sonatype.aether.+" ); - assertTrue( "ClassNotFoundException message was not found in output.", msg >= 0 ); + int msg = indexOf(lines, "Caused by: java.lang.ClassNotFoundException: org.sonatype.aether.+"); + assertTrue("ClassNotFoundException message was not found in output.", msg >= 0); - int url = indexOf( lines, ".*http://cwiki.apache.org/confluence/display/MAVEN/AetherClassNotFound.*" ); - assertTrue( "Url to ClassNotFoundAether was not found in output.", url >= 0 ); + int url = indexOf(lines, ".*http://cwiki.apache.org/confluence/display/MAVEN/AetherClassNotFound.*"); + assertTrue("Url to ClassNotFoundAether was not found in output.", url >= 0); } - private int indexOf( List logLines, String regex ) - { - Pattern pattern = Pattern.compile( regex ); + private int indexOf(List logLines, String regex) { + Pattern pattern = Pattern.compile(regex); - for ( int i = 0; i < logLines.size(); i++ ) - { - String logLine = logLines.get( i ); + for (int i = 0; i < logLines.size(); i++) { + String logLine = logLines.get(i); - if ( pattern.matcher( logLine ).matches() ) - { + if (pattern.matcher(logLine).matches()) { return i; } } return -1; } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5503ZipInReactorTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5503ZipInReactorTest.java index 50994049f6..ade247ee6b 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5503ZipInReactorTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5503ZipInReactorTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -33,15 +31,12 @@ import org.junit.jupiter.api.Test; * * @author jvz */ -@Tag( "disabled" ) +@Tag("disabled") @Disabled -public class MavenITmng5503ZipInReactorTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng5503ZipInReactorTest extends AbstractMavenIntegrationTestCase { - public MavenITmng5503ZipInReactorTest() - { - super( "[3.1,)" ); + public MavenITmng5503ZipInReactorTest() { + super("[3.1,)"); } /** @@ -51,17 +46,14 @@ public class MavenITmng5503ZipInReactorTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5503" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5503"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "verify" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("verify"); verifier.execute(); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5530MojoExecutionScopeTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5530MojoExecutionScopeTest.java index 4cc2d9575f..a800fbea95 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5530MojoExecutionScopeTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5530MojoExecutionScopeTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,110 +16,100 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; -public class MavenITmng5530MojoExecutionScopeTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng5530MojoExecutionScopeTest() - { - super( "[3.2.1,)" ); +public class MavenITmng5530MojoExecutionScopeTest extends AbstractMavenIntegrationTestCase { + public MavenITmng5530MojoExecutionScopeTest() { + super("[3.2.1,)"); } @Test - public void test_copyfiles() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5530-mojo-execution-scope" ); - File pluginDir = new File( testDir, "plugin" ); - File projectDir = new File( testDir, "basic" ); + public void test_copyfiles() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5530-mojo-execution-scope"); + File pluginDir = new File(testDir, "plugin"); + File projectDir = new File(testDir, "basic"); Verifier verifier; // install the test plugin - verifier = newVerifier( pluginDir.getAbsolutePath(), "remote" ); - verifier.addCliArgument( "install" ); + verifier = newVerifier(pluginDir.getAbsolutePath(), "remote"); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); // build the test project - verifier = newVerifier( projectDir.getAbsolutePath(), "remote" ); - verifier.addCliArgument( "package" ); + verifier = newVerifier(projectDir.getAbsolutePath(), "remote"); + verifier.addCliArgument("package"); verifier.execute(); verifier.verifyErrorFreeLog(); // verifier.verifyFilePresent( "target/execution-failure.txt" ); - verifier.verifyFilePresent( "target/execution-success.txt" ); - verifier.verifyFilePresent( "target/execution-before.txt" ); + verifier.verifyFilePresent("target/execution-success.txt"); + verifier.verifyFilePresent("target/execution-before.txt"); } @Test - public void test_copyfiles_multithreaded() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5530-mojo-execution-scope" ); - File pluginDir = new File( testDir, "plugin" ); - File projectDir = new File( testDir, "basic" ); + public void test_copyfiles_multithreaded() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5530-mojo-execution-scope"); + File pluginDir = new File(testDir, "plugin"); + File projectDir = new File(testDir, "basic"); Verifier verifier; // install the test plugin - verifier = newVerifier( pluginDir.getAbsolutePath(), "remote" ); - verifier.addCliArgument( "install" ); + verifier = newVerifier(pluginDir.getAbsolutePath(), "remote"); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); // build the test project - verifier = newVerifier( projectDir.getAbsolutePath(), "remote" ); - verifier.addCliArgument( "--builder" ); - verifier.addCliArgument( "multithreaded" ); - verifier.addCliArgument( "-T" ); - verifier.addCliArgument( "1" ); - verifier.addCliArgument( "package" ); + verifier = newVerifier(projectDir.getAbsolutePath(), "remote"); + verifier.addCliArgument("--builder"); + verifier.addCliArgument("multithreaded"); + verifier.addCliArgument("-T"); + verifier.addCliArgument("1"); + verifier.addCliArgument("package"); verifier.execute(); verifier.verifyErrorFreeLog(); // verifier.verifyFilePresent( "target/execution-failure.txt" ); - verifier.verifyFilePresent( "target/execution-success.txt" ); - verifier.verifyFilePresent( "target/execution-before.txt" ); + verifier.verifyFilePresent("target/execution-success.txt"); + verifier.verifyFilePresent("target/execution-before.txt"); } @Test - public void testExtension() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5530-mojo-execution-scope" ); - File extensionDir = new File( testDir, "extension" ); - File pluginDir = new File( testDir, "extension-plugin" ); - File projectDir = new File( testDir, "extension-project" ); + public void testExtension() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5530-mojo-execution-scope"); + File extensionDir = new File(testDir, "extension"); + File pluginDir = new File(testDir, "extension-plugin"); + File projectDir = new File(testDir, "extension-project"); Verifier verifier; // install the test extension - verifier = newVerifier( extensionDir.getAbsolutePath(), "remote" ); - verifier.addCliArgument( "install" ); + verifier = newVerifier(extensionDir.getAbsolutePath(), "remote"); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); // install the test plugin - verifier = newVerifier( pluginDir.getAbsolutePath(), "remote" ); - verifier.addCliArgument( "install" ); + verifier = newVerifier(pluginDir.getAbsolutePath(), "remote"); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); // build the test project - verifier = newVerifier( projectDir.getAbsolutePath(), "remote" ); - verifier.addCliArgument( "-Dmaven.ext.class.path=" + new File( extensionDir, "target/classes" ).getAbsolutePath() ); - verifier.setForkJvm( true ); // verifier does not support custom realms in embedded mode - verifier.addCliArgument( "package" ); + verifier = newVerifier(projectDir.getAbsolutePath(), "remote"); + verifier.addCliArgument("-Dmaven.ext.class.path=" + new File(extensionDir, "target/classes").getAbsolutePath()); + verifier.setForkJvm(true); // verifier does not support custom realms in embedded mode + verifier.addCliArgument("package"); verifier.execute(); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5557ProperlyRestrictedReactor.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5557ProperlyRestrictedReactor.java index b8a6644c42..b04bdf4790 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5557ProperlyRestrictedReactor.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5557ProperlyRestrictedReactor.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -38,36 +36,29 @@ import org.junit.jupiter.api.Test; * @author jvanzyl */ @Tag("disabled") -public class MavenITmng5557ProperlyRestrictedReactor - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng5557ProperlyRestrictedReactor() - { - super( "[3.1.2,)" ); +public class MavenITmng5557ProperlyRestrictedReactor extends AbstractMavenIntegrationTestCase { + public MavenITmng5557ProperlyRestrictedReactor() { + super("[3.1.2,)"); } @Test - public void testRunningRestrictedReactor() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5557-properly-restricted-reactor" ); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); + public void testRunningRestrictedReactor() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5557-properly-restricted-reactor"); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); // // Remove everything related to this project from the local repository as we want this to be resolution purely // from the reactor. // - verifier.deleteArtifacts( "org.apache.maven.its.mng5557" ); - verifier.addCliArgument( "--projects" ); - verifier.addCliArgument( "project-0,project-1" ); - try - { - verifier.addCliArgument( "package" ); + verifier.deleteArtifacts("org.apache.maven.its.mng5557"); + verifier.addCliArgument("--projects"); + verifier.addCliArgument("project-0,project-1"); + try { + verifier.addCliArgument("package"); verifier.execute(); - } - catch ( VerificationException e ) - { + } catch (VerificationException e) { // the execution should fail due to a resolution error. } - verifier.verifyTextInLog( "Could not resolve dependencies for project org.apache.maven.its.mng5557:project-0:jar:1.0: Could not find artifact org.apache.maven.its.mng5557:project-4:jar:1.0" ); + verifier.verifyTextInLog( + "Could not resolve dependencies for project org.apache.maven.its.mng5557:project-0:jar:1.0: Could not find artifact org.apache.maven.its.mng5557:project-4:jar:1.0"); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5561PluginRelocationLosesConfigurationTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5561PluginRelocationLosesConfigurationTest.java index e00416c946..92df7b693f 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5561PluginRelocationLosesConfigurationTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5561PluginRelocationLosesConfigurationTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,50 +16,44 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; -public class MavenITmng5561PluginRelocationLosesConfigurationTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng5561PluginRelocationLosesConfigurationTest extends AbstractMavenIntegrationTestCase { - public MavenITmng5561PluginRelocationLosesConfigurationTest() - { - super( "[3.8.5,)" ); + public MavenITmng5561PluginRelocationLosesConfigurationTest() { + super("[3.8.5,)"); } @Test - public void testit() - throws Exception - { + public void testit() throws Exception { File testDir = - ResourceExtractor.simpleExtractResources( getClass(), - "/mng-5561-plugin-relocation-loses-configuration" ); - File oldPluginWithRelocationDir = new File( testDir, "old-plugin-with-relocation" ); - File newPluginDir = new File( testDir, "new-plugin" ); - File projectDir = new File( testDir, "project" ); + ResourceExtractor.simpleExtractResources(getClass(), "/mng-5561-plugin-relocation-loses-configuration"); + File oldPluginWithRelocationDir = new File(testDir, "old-plugin-with-relocation"); + File newPluginDir = new File(testDir, "new-plugin"); + File projectDir = new File(testDir, "project"); Verifier verifier; - verifier = newVerifier( oldPluginWithRelocationDir.getAbsolutePath() ); - verifier.addCliArgument( "install" ); + verifier = newVerifier(oldPluginWithRelocationDir.getAbsolutePath()); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier = newVerifier( newPluginDir.getAbsolutePath() ); - verifier.addCliArgument( "install" ); + verifier = newVerifier(newPluginDir.getAbsolutePath()); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier = newVerifier( projectDir.getAbsolutePath() ); - verifier.addCliArgument( "verify" ); + verifier = newVerifier(projectDir.getAbsolutePath()); + verifier.addCliArgument("verify"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyTextInLog( "[WARNING] Hello from Maven!" ); + verifier.verifyTextInLog("[WARNING] Hello from Maven!"); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5572ReactorPluginExtensionsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5572ReactorPluginExtensionsTest.java index 7f8f004c0c..30068d69b0 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5572ReactorPluginExtensionsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5572ReactorPluginExtensionsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,13 +31,10 @@ import org.junit.jupiter.api.Test; * * @author rfscholte */ -public class MavenITmng5572ReactorPluginExtensionsTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng5572ReactorPluginExtensionsTest extends AbstractMavenIntegrationTestCase { - public MavenITmng5572ReactorPluginExtensionsTest() - { - super( "[3.2,)" ); + public MavenITmng5572ReactorPluginExtensionsTest() { + super("[3.2,)"); } /** @@ -48,34 +43,30 @@ public class MavenITmng5572ReactorPluginExtensionsTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5572-reactor-plugin-extensions" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5572-reactor-plugin-extensions"); // plugin must be available in local repo, otherwise the project couldn't be built - Verifier setup = newVerifier( testDir.getAbsolutePath() ); - setup.setAutoclean( true ); - setup.addCliArgument( "-f" ); - setup.addCliArgument( "plugin/pom.xml" ); - setup.addCliArgument( "install" ); + Verifier setup = newVerifier(testDir.getAbsolutePath()); + setup.setAutoclean(true); + setup.addCliArgument("-f"); + setup.addCliArgument("plugin/pom.xml"); + setup.addCliArgument("install"); setup.execute(); setup.verifyErrorFreeLog(); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setLogFileName( "log2.txt" ); - verifier.setAutoclean( false ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setLogFileName("log2.txt"); + verifier.setAutoclean(false); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - if ( getMavenVersion().getMajorVersion() <= 3 ) - { - verifier.verifyTextInLog( "[WARNING] project uses org.apache.maven.its.mng5572:plugin as extensions, which is not possible within the same reactor build. This plugin was pulled from the local repository!" ); - } - else - { - verifier.verifyTextInLog( "[WARNING] 'project' uses 'org.apache.maven.its.mng5572:plugin' as extension which is not possible within the same reactor build. This plugin was pulled from the local repository!" ); + if (getMavenVersion().getMajorVersion() <= 3) { + verifier.verifyTextInLog( + "[WARNING] project uses org.apache.maven.its.mng5572:plugin as extensions, which is not possible within the same reactor build. This plugin was pulled from the local repository!"); + } else { + verifier.verifyTextInLog( + "[WARNING] 'project' uses 'org.apache.maven.its.mng5572:plugin' as extension which is not possible within the same reactor build. This plugin was pulled from the local repository!"); } } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5576CdFriendlyVersions.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5576CdFriendlyVersions.java index 862114a581..c456842402 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5576CdFriendlyVersions.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5576CdFriendlyVersions.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,12 +31,9 @@ import org.junit.jupiter.api.Test; * * @author Jason van Zyl */ -public class MavenITmng5576CdFriendlyVersions - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng5576CdFriendlyVersions() - { - super( "[3.2,)" ); +public class MavenITmng5576CdFriendlyVersions extends AbstractMavenIntegrationTestCase { + public MavenITmng5576CdFriendlyVersions() { + super("[3.2,)"); } /** @@ -48,27 +43,24 @@ public class MavenITmng5576CdFriendlyVersions * @throws Exception in case of failure */ @Test - public void testContinuousDeliveryFriendlyVersionsAreWarningFreeWithoutBuildConsumer() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5576-cd-friendly-versions" ); + public void testContinuousDeliveryFriendlyVersionsAreWarningFreeWithoutBuildConsumer() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5576-cd-friendly-versions"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "-Dchangelist=changelist" ); - verifier.addCliArgument( "-Dmaven.experimental.buildconsumer=false" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("-Dchangelist=changelist"); + verifier.addCliArgument("-Dmaven.experimental.buildconsumer=false"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/pom.properties" ); - assertEquals( "1.0.0.changelist", props.getProperty( "project.version" ) ); + Properties props = verifier.loadProperties("target/pom.properties"); + assertEquals("1.0.0.changelist", props.getProperty("project.version")); - List lines = verifier.loadFile( new File( testDir, "log.txt" ), false ); - for( String line : lines ) - { - assertFalse( line, line.contains( "WARNING" ) ); + List lines = verifier.loadFile(new File(testDir, "log.txt"), false); + for (String line : lines) { + assertFalse(line, line.contains("WARNING")); } } @@ -79,29 +71,25 @@ public class MavenITmng5576CdFriendlyVersions * @throws Exception in case of failure */ @Test - public void testContinuousDeliveryFriendlyVersionsAreWarningFreeWithBuildConsumer() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5576-cd-friendly-versions" ); + public void testContinuousDeliveryFriendlyVersionsAreWarningFreeWithBuildConsumer() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5576-cd-friendly-versions"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setLogFileName( "log-bc.txt" ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "-Dchangelist=changelist" ); - verifier.addCliArgument( "-Dmaven.experimental.buildconsumer=true" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setLogFileName("log-bc.txt"); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("-Dchangelist=changelist"); + verifier.addCliArgument("-Dmaven.experimental.buildconsumer=true"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/pom.properties" ); - assertEquals( "1.0.0.changelist", props.getProperty( "project.version" ) ); + Properties props = verifier.loadProperties("target/pom.properties"); + assertEquals("1.0.0.changelist", props.getProperty("project.version")); - List lines = verifier.loadFile( new File( testDir, "log-bc.txt" ), false ); - for( String line : lines ) - { - assertFalse( line, line.contains( "WARNING" ) ); + List lines = verifier.loadFile(new File(testDir, "log-bc.txt"), false); + for (String line : lines) { + assertFalse(line, line.contains("WARNING")); } } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5578SessionScopeTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5578SessionScopeTest.java index 30a23caf45..eaa2521c8f 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5578SessionScopeTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5578SessionScopeTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,128 +16,116 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; -public class MavenITmng5578SessionScopeTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng5578SessionScopeTest() - { - super( "[3.2.4,)" ); +public class MavenITmng5578SessionScopeTest extends AbstractMavenIntegrationTestCase { + public MavenITmng5578SessionScopeTest() { + super("[3.2.4,)"); } @Test - public void testBasic() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5578-session-scope" ); - File pluginDir = new File( testDir, "plugin" ); - File projectDir = new File( testDir, "basic" ); + public void testBasic() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5578-session-scope"); + File pluginDir = new File(testDir, "plugin"); + File projectDir = new File(testDir, "basic"); Verifier verifier; // install the test plugin - verifier = newVerifier( pluginDir.getAbsolutePath(), "remote" ); - verifier.addCliArgument( "install" ); + verifier = newVerifier(pluginDir.getAbsolutePath(), "remote"); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); // build the test project - verifier = newVerifier( projectDir.getAbsolutePath(), "remote" ); - verifier.addCliArgument( "-Dit-build-extensions=false" ); - verifier.addCliArgument( "package" ); + verifier = newVerifier(projectDir.getAbsolutePath(), "remote"); + verifier.addCliArgument("-Dit-build-extensions=false"); + verifier.addCliArgument("package"); verifier.execute(); verifier.verifyErrorFreeLog(); } @Test - public void testBasic_multithreaded() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5578-session-scope" ); - File pluginDir = new File( testDir, "plugin" ); - File projectDir = new File( testDir, "basic" ); + public void testBasic_multithreaded() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5578-session-scope"); + File pluginDir = new File(testDir, "plugin"); + File projectDir = new File(testDir, "basic"); Verifier verifier; // install the test plugin - verifier = newVerifier( pluginDir.getAbsolutePath(), "remote" ); - verifier.addCliArgument( "install" ); + verifier = newVerifier(pluginDir.getAbsolutePath(), "remote"); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); // build the test project - verifier = newVerifier( projectDir.getAbsolutePath(), "remote" ); - verifier.addCliArgument( "-Dit-build-extensions=false" ); - verifier.addCliArgument( "--builder" ); - verifier.addCliArgument( "multithreaded" ); - verifier.addCliArgument( "-T" ); - verifier.addCliArgument( "1" ); - verifier.addCliArgument( "package" ); + verifier = newVerifier(projectDir.getAbsolutePath(), "remote"); + verifier.addCliArgument("-Dit-build-extensions=false"); + verifier.addCliArgument("--builder"); + verifier.addCliArgument("multithreaded"); + verifier.addCliArgument("-T"); + verifier.addCliArgument("1"); + verifier.addCliArgument("package"); verifier.execute(); verifier.verifyErrorFreeLog(); } @Test - public void testBasic_buildExtension() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5578-session-scope" ); - File pluginDir = new File( testDir, "plugin" ); - File projectDir = new File( testDir, "basic" ); + public void testBasic_buildExtension() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5578-session-scope"); + File pluginDir = new File(testDir, "plugin"); + File projectDir = new File(testDir, "basic"); Verifier verifier; // install the test plugin - verifier = newVerifier( pluginDir.getAbsolutePath(), "remote" ); - verifier.addCliArgument( "install" ); + verifier = newVerifier(pluginDir.getAbsolutePath(), "remote"); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); // build the test project - verifier = newVerifier( projectDir.getAbsolutePath(), "remote" ); - verifier.addCliArgument( "-Dit-build-extensions=true" ); - verifier.addCliArgument( "package" ); + verifier = newVerifier(projectDir.getAbsolutePath(), "remote"); + verifier.addCliArgument("-Dit-build-extensions=true"); + verifier.addCliArgument("package"); verifier.execute(); verifier.verifyErrorFreeLog(); } @Test - public void testExtension() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5578-session-scope" ); - File extensionDir = new File( testDir, "extension" ); - File pluginDir = new File( testDir, "extension-plugin" ); - File projectDir = new File( testDir, "extension-project" ); + public void testExtension() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5578-session-scope"); + File extensionDir = new File(testDir, "extension"); + File pluginDir = new File(testDir, "extension-plugin"); + File projectDir = new File(testDir, "extension-project"); Verifier verifier; // install the test extension - verifier = newVerifier( extensionDir.getAbsolutePath(), "remote" ); - verifier.addCliArgument( "install" ); + verifier = newVerifier(extensionDir.getAbsolutePath(), "remote"); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); // install the test plugin - verifier = newVerifier( pluginDir.getAbsolutePath(), "remote" ); - verifier.addCliArgument( "install" ); + verifier = newVerifier(pluginDir.getAbsolutePath(), "remote"); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); // build the test project - verifier = newVerifier( projectDir.getAbsolutePath(), "remote" ); - verifier.addCliArgument( "-Dmaven.ext.class.path=" + new File( extensionDir, "target/classes" ).getAbsolutePath() ); - verifier.setForkJvm( true ); // verifier does not support custom realms in embedded mode - verifier.addCliArgument( "package" ); + verifier = newVerifier(projectDir.getAbsolutePath(), "remote"); + verifier.addCliArgument("-Dmaven.ext.class.path=" + new File(extensionDir, "target/classes").getAbsolutePath()); + verifier.setForkJvm(true); // verifier does not support custom realms in embedded mode + verifier.addCliArgument("package"); verifier.execute(); verifier.verifyErrorFreeLog(); - } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5581LifecycleMappingDelegate.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5581LifecycleMappingDelegate.java index 8e9557a055..fab800017a 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5581LifecycleMappingDelegate.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5581LifecycleMappingDelegate.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,28 +16,23 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; -public class MavenITmng5581LifecycleMappingDelegate - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng5581LifecycleMappingDelegate() - { - super( "[3.2.1,)" ); +public class MavenITmng5581LifecycleMappingDelegate extends AbstractMavenIntegrationTestCase { + public MavenITmng5581LifecycleMappingDelegate() { + super("[3.2.1,)"); } @Test - public void testCustomLifecycle() - throws Exception - { + public void testCustomLifecycle() throws Exception { /* * This test comes in two parts, a build extension project that defines custom lifecycle with corresponding * lifecycle mapping delegate, and a test project used to validate the custom lifecycle. The custom lifecycle id @@ -48,56 +41,50 @@ public class MavenITmng5581LifecycleMappingDelegate * run "test-only" build phase and that it does not run maven-compiler-plugin. */ - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5581-lifecycle-mapping-delegate" ); - File extensionDir = new File( testDir, "extension" ); - File projectDir = new File( testDir, "basic" ); + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5581-lifecycle-mapping-delegate"); + File extensionDir = new File(testDir, "extension"); + File projectDir = new File(testDir, "basic"); Verifier verifier; // install the test extension - verifier = newVerifier( extensionDir.getAbsolutePath() ); - verifier.addCliArgument( "install" ); + verifier = newVerifier(extensionDir.getAbsolutePath()); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); // compile the test project - verifier = newVerifier( projectDir.getAbsolutePath() ); - verifier.setLogFileName( "compile-log.txt" ); - verifier.addCliArgument( "compile" ); + verifier = newVerifier(projectDir.getAbsolutePath()); + verifier.setLogFileName("compile-log.txt"); + verifier.addCliArgument("compile"); verifier.execute(); verifier.verifyErrorFreeLog(); // run custom "test-only" build phase - verifier = newVerifier( projectDir.getAbsolutePath(), "remote" ); - verifier = newVerifier( projectDir.getAbsolutePath() ); - verifier.setLogFileName( "test-only-log.txt" ); - verifier.setForkJvm( true ); - verifier.addCliArgument( "-X" ); - verifier.addCliArgument( "test-only" ); + verifier = newVerifier(projectDir.getAbsolutePath(), "remote"); + verifier = newVerifier(projectDir.getAbsolutePath()); + verifier.setLogFileName("test-only-log.txt"); + verifier.setForkJvm(true); + verifier.addCliArgument("-X"); + verifier.addCliArgument("test-only"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyTextInLog( "maven-surefire-plugin" ); - verifyTextNotInLog( verifier, "maven-compiler-plugin" ); + verifier.verifyTextInLog("maven-surefire-plugin"); + verifyTextNotInLog(verifier, "maven-compiler-plugin"); } - private void verifyTextNotInLog( Verifier verifier, String text ) - throws VerificationException - { - List lines = verifier.loadFile( verifier.getBasedir(), verifier.getLogFileName(), false ); + private void verifyTextNotInLog(Verifier verifier, String text) throws VerificationException { + List lines = verifier.loadFile(verifier.getBasedir(), verifier.getLogFileName(), false); boolean textFound = false; - for ( String line : lines ) - { - if ( line.contains( text ) ) - { + for (String line : lines) { + if (line.contains(text)) { textFound = true; break; } } - if ( textFound ) - { - throw new VerificationException( "Text found in log: " + text ); + if (textFound) { + throw new VerificationException("Text found in log: " + text); } } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5591WorkspaceReader.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5591WorkspaceReader.java index e32e43c361..dc6331323e 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5591WorkspaceReader.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5591WorkspaceReader.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,26 +16,21 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; -public class MavenITmng5591WorkspaceReader - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng5591WorkspaceReader() - { - super( "[3.1.0,)" ); +public class MavenITmng5591WorkspaceReader extends AbstractMavenIntegrationTestCase { + public MavenITmng5591WorkspaceReader() { + super("[3.1.0,)"); } @Test - public void testWorkspaceReader() - throws Exception - { + public void testWorkspaceReader() throws Exception { /* * The point of this test is to validate that ide WorkspaceReader, like one used by m2e, does not interfere with * reactor dependency resolution. The test comes in two parts. mng-5591-workspace-reader/extension is noop @@ -46,25 +39,24 @@ public class MavenITmng5591WorkspaceReader * line argument. The multi-module build fails unless reactor resolution works properly. */ - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5591-workspace-reader" ); - File extensionDir = new File( testDir, "extension" ); - File projectDir = new File( testDir, "basic" ); + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5591-workspace-reader"); + File extensionDir = new File(testDir, "extension"); + File projectDir = new File(testDir, "basic"); Verifier verifier; // install the test extension - verifier = newVerifier( extensionDir.getAbsolutePath(), "remote" ); - verifier.addCliArgument( "install" ); + verifier = newVerifier(extensionDir.getAbsolutePath(), "remote"); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); // compile the test project - verifier = newVerifier( projectDir.getAbsolutePath(), "remote" ); - verifier.addCliArgument( "-Dmaven.ext.class.path=" - + new File( extensionDir, "target/mng-5591-workspace-reader-extension-0.1.jar" ).getCanonicalPath() ); - verifier.addCliArgument( "compile" ); + verifier = newVerifier(projectDir.getAbsolutePath(), "remote"); + verifier.addCliArgument("-Dmaven.ext.class.path=" + + new File(extensionDir, "target/mng-5591-workspace-reader-extension-0.1.jar").getCanonicalPath()); + verifier.addCliArgument("compile"); verifier.execute(); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5608ProfileActivationWarningTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5608ProfileActivationWarningTest.java index 3916e157dd..0e5ceeead1 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5608ProfileActivationWarningTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5608ProfileActivationWarningTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; import java.util.regex.Pattern; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,56 +31,47 @@ import org.junit.jupiter.api.Test; * Profile activation warning test when file specification contains ${project.basedir} * instead of ${basedir} */ -public class MavenITmng5608ProfileActivationWarningTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng5608ProfileActivationWarningTest extends AbstractMavenIntegrationTestCase { - public MavenITmng5608ProfileActivationWarningTest() - { - super( "(3.2.1,)" ); + public MavenITmng5608ProfileActivationWarningTest() { + super("(3.2.1,)"); } @Test - public void testitMNG5608() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5608-profile-activation-warning" ); + public void testitMNG5608() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5608-profile-activation-warning"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); // check expected profiles activated, just for sanity (or build should have failed, given other profiles) - assertFileExists( testDir, "target/exists-basedir" ); - assertFileExists( testDir, "target/mng-5608-missing-project.basedir" ); + assertFileExists(testDir, "target/exists-basedir"); + assertFileExists(testDir, "target/mng-5608-missing-project.basedir"); // check that the 2 profiles using ${project.basedir} caused warnings - List logFile = verifier.loadFile( verifier.getBasedir(), verifier.getLogFileName(), false ); - assertNotNull( findWarning( logFile, "mng-5608-exists-project.basedir" ) ); - assertNotNull( findWarning( logFile, "mng-5608-missing-project.basedir" ) ); + List logFile = verifier.loadFile(verifier.getBasedir(), verifier.getLogFileName(), false); + assertNotNull(findWarning(logFile, "mng-5608-exists-project.basedir")); + assertNotNull(findWarning(logFile, "mng-5608-missing-project.basedir")); } - private void assertFileExists( File dir, String filename ) - { - File file = new File( dir, filename ); - assertTrue( "expected file: " + file, file.exists() ); + private void assertFileExists(File dir, String filename) { + File file = new File(dir, filename); + assertTrue("expected file: " + file, file.exists()); } - private String findWarning( List logLines, String profileId ) - { - Pattern pattern = Pattern.compile( - "(?i).*Failed to interpolate file location ..project.basedir./pom.xml for profile " + profileId + ": .*" ); + private String findWarning(List logLines, String profileId) { + Pattern pattern = + Pattern.compile("(?i).*Failed to interpolate file location ..project.basedir./pom.xml for profile " + + profileId + ": .*"); - for ( String logLine : logLines ) - { - if ( pattern.matcher( logLine ).matches() ) - { + for (String logLine : logLines) { + if (pattern.matcher(logLine).matches()) { return logLine; } } return null; } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5639ImportScopePomResolutionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5639ImportScopePomResolutionTest.java index da7315c380..48c0713a1c 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5639ImportScopePomResolutionTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5639ImportScopePomResolutionTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,47 +16,39 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** * This is a test set for MNG-5639: * Check that import POM defined in DependencyManagement can be resolved from a parameterised repository */ -public class MavenITmng5639ImportScopePomResolutionTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng5639ImportScopePomResolutionTest extends AbstractMavenIntegrationTestCase { - public MavenITmng5639ImportScopePomResolutionTest() - { - super( "[3.2.2,)" ); + public MavenITmng5639ImportScopePomResolutionTest() { + super("[3.2.2,)"); } @Test - public void testitMNG5639() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5639-import-scope-pom-resolution" ); + public void testitMNG5639() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5639-import-scope-pom-resolution"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.deleteArtifacts( "org.apache.maven.its.mng5639" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.deleteArtifacts("org.apache.maven.its.mng5639"); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); - verifier.addCliArgument( "install" ); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng5639", "b", "0.1", "jar" ); - + verifier.verifyArtifactPresent("org.apache.maven.its.mng5639", "b", "0.1", "jar"); } - - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5640LifecycleParticipantAfterSessionEnd.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5640LifecycleParticipantAfterSessionEnd.java index fb1cf71a85..ee7d044977 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5640LifecycleParticipantAfterSessionEnd.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5640LifecycleParticipantAfterSessionEnd.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,25 +16,22 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** * IT that verifies that lifecycle participant * methods are invoked even with various build failures/errors. */ -public class MavenITmng5640LifecycleParticipantAfterSessionEnd - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng5640LifecycleParticipantAfterSessionEnd() - { - super( "[3.2.2,)" ); +public class MavenITmng5640LifecycleParticipantAfterSessionEnd extends AbstractMavenIntegrationTestCase { + public MavenITmng5640LifecycleParticipantAfterSessionEnd() { + super("[3.2.2,)"); } /** @@ -45,40 +40,35 @@ public class MavenITmng5640LifecycleParticipantAfterSessionEnd * @throws Exception in case of failure */ @Test - public void testBuildFailureUTFail() - throws Exception - { + public void testBuildFailureUTFail() throws Exception { File testDir = - ResourceExtractor.simpleExtractResources( getClass(), "/mng-5640-lifecycleParticipant-afterSession" ); - File extensionDir = new File( testDir, "extension" ); - File projectDir = new File( testDir, "buildfailure-utfail" ); + ResourceExtractor.simpleExtractResources(getClass(), "/mng-5640-lifecycleParticipant-afterSession"); + File extensionDir = new File(testDir, "extension"); + File projectDir = new File(testDir, "buildfailure-utfail"); Verifier verifier; // install the test plugin - verifier = newVerifier( extensionDir.getAbsolutePath(), "remote" ); - verifier.addCliArgument( "install" ); + verifier = newVerifier(extensionDir.getAbsolutePath(), "remote"); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); // build the test project - verifier = newVerifier( projectDir.getAbsolutePath(), "remote" ); - try - { - verifier.addCliArgument( "package" ); + verifier = newVerifier(projectDir.getAbsolutePath(), "remote"); + try { + verifier.addCliArgument("package"); verifier.execute(); - fail( "The build should fail" ); - } - catch ( VerificationException e) - { + fail("The build should fail"); + } catch (VerificationException e) { // expected, as the build will fail due to always failing UT } verifier.verifyTextInLog("testApp(org.apache.maven.its.mng5640.FailingTest)"); - verifier.verifyFilePresent( "target/afterProjectsRead.txt" ); + verifier.verifyFilePresent("target/afterProjectsRead.txt"); // See https://issues.apache.org/jira/browse/MNG-5641 // verifier.verifyFilePresent( "target/afterSessionStart.txt" ); - verifier.verifyFilePresent( "target/afterSessionEnd.txt" ); + verifier.verifyFilePresent("target/afterSessionEnd.txt"); } /** @@ -87,39 +77,34 @@ public class MavenITmng5640LifecycleParticipantAfterSessionEnd * @throws Exception in case of failure */ @Test - public void testBuildFailureMissingDependency() - throws Exception - { + public void testBuildFailureMissingDependency() throws Exception { File testDir = - ResourceExtractor.simpleExtractResources( getClass(), "/mng-5640-lifecycleParticipant-afterSession" ); - File extensionDir = new File( testDir, "extension" ); - File projectDir = new File( testDir, "buildfailure-depmissing" ); + ResourceExtractor.simpleExtractResources(getClass(), "/mng-5640-lifecycleParticipant-afterSession"); + File extensionDir = new File(testDir, "extension"); + File projectDir = new File(testDir, "buildfailure-depmissing"); Verifier verifier; // install the test plugin - verifier = newVerifier( extensionDir.getAbsolutePath(), "remote" ); - verifier.addCliArgument( "install" ); + verifier = newVerifier(extensionDir.getAbsolutePath(), "remote"); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); // build the test project - verifier = newVerifier( projectDir.getAbsolutePath(), "remote" ); - try - { - verifier.addCliArgument( "package" ); + verifier = newVerifier(projectDir.getAbsolutePath(), "remote"); + try { + verifier.addCliArgument("package"); verifier.execute(); - fail( "The build should fail" ); - } - catch ( VerificationException e ) - { + fail("The build should fail"); + } catch (VerificationException e) { // expected, as the build will fail due to always failing UT } - verifier.verifyFilePresent( "target/afterProjectsRead.txt" ); + verifier.verifyFilePresent("target/afterProjectsRead.txt"); // See https://issues.apache.org/jira/browse/MNG-5641 // verifier.verifyFilePresent( "target/afterSessionStart.txt" ); - verifier.verifyFilePresent( "target/afterSessionEnd.txt" ); + verifier.verifyFilePresent("target/afterSessionEnd.txt"); } /** @@ -128,46 +113,41 @@ public class MavenITmng5640LifecycleParticipantAfterSessionEnd * @throws Exception in case of failure */ @Test - public void testBuildError() - throws Exception - { + public void testBuildError() throws Exception { File testDir = - ResourceExtractor.simpleExtractResources( getClass(), "/mng-5640-lifecycleParticipant-afterSession" ); - File extensionDir = new File( testDir, "extension" ); - File pluginDir = new File( testDir, "badplugin" ); - File projectDir = new File( testDir, "builderror-mojoex" ); + ResourceExtractor.simpleExtractResources(getClass(), "/mng-5640-lifecycleParticipant-afterSession"); + File extensionDir = new File(testDir, "extension"); + File pluginDir = new File(testDir, "badplugin"); + File projectDir = new File(testDir, "builderror-mojoex"); Verifier verifier; // install the test plugin - verifier = newVerifier( extensionDir.getAbsolutePath(), "remote" ); - verifier.addCliArgument( "install" ); + verifier = newVerifier(extensionDir.getAbsolutePath(), "remote"); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); // install the bad plugin - verifier = newVerifier( pluginDir.getAbsolutePath(), "remote" ); - verifier.addCliArgument( "install" ); + verifier = newVerifier(pluginDir.getAbsolutePath(), "remote"); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); // build the test project - verifier = newVerifier( projectDir.getAbsolutePath(), "remote" ); - try - { - verifier.addCliArgument( "package" ); + verifier = newVerifier(projectDir.getAbsolutePath(), "remote"); + try { + verifier.addCliArgument("package"); verifier.execute(); - fail( "The build should fail" ); - } - catch ( VerificationException e ) - { + fail("The build should fail"); + } catch (VerificationException e) { // expected, as the build will fail due to always failing UT } - verifier.verifyFilePresent( "target/afterProjectsRead.txt" ); + verifier.verifyFilePresent("target/afterProjectsRead.txt"); // See https://issues.apache.org/jira/browse/MNG-5641 // verifier.verifyFilePresent( "target/afterSessionStart.txt" ); - verifier.verifyFilePresent( "target/afterSessionEnd.txt" ); + verifier.verifyFilePresent("target/afterSessionEnd.txt"); } /** @@ -176,45 +156,40 @@ public class MavenITmng5640LifecycleParticipantAfterSessionEnd * @throws Exception in case of failure */ @Test - public void testBuildErrorRt() - throws Exception - { + public void testBuildErrorRt() throws Exception { File testDir = - ResourceExtractor.simpleExtractResources( getClass(), "/mng-5640-lifecycleParticipant-afterSession" ); - File extensionDir = new File( testDir, "extension" ); - File pluginDir = new File( testDir, "badplugin" ); - File projectDir = new File( testDir, "builderror-runtimeex" ); + ResourceExtractor.simpleExtractResources(getClass(), "/mng-5640-lifecycleParticipant-afterSession"); + File extensionDir = new File(testDir, "extension"); + File pluginDir = new File(testDir, "badplugin"); + File projectDir = new File(testDir, "builderror-runtimeex"); Verifier verifier; // install the test plugin - verifier = newVerifier( extensionDir.getAbsolutePath(), "remote" ); - verifier.addCliArgument( "install" ); + verifier = newVerifier(extensionDir.getAbsolutePath(), "remote"); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); // install the bad plugin - verifier = newVerifier( pluginDir.getAbsolutePath(), "remote" ); - verifier.addCliArgument( "install" ); + verifier = newVerifier(pluginDir.getAbsolutePath(), "remote"); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); // build the test project - verifier = newVerifier( projectDir.getAbsolutePath(), "remote" ); - try - { - verifier.addCliArgument( "package" ); + verifier = newVerifier(projectDir.getAbsolutePath(), "remote"); + try { + verifier.addCliArgument("package"); verifier.execute(); - fail( "The build should fail" ); - } - catch ( VerificationException e ) - { + fail("The build should fail"); + } catch (VerificationException e) { // expected, as the build will fail due to always failing UT } - verifier.verifyFilePresent( "target/afterProjectsRead.txt" ); + verifier.verifyFilePresent("target/afterProjectsRead.txt"); // See https://issues.apache.org/jira/browse/MNG-5641 // verifier.verifyFilePresent( "target/afterSessionStart.txt" ); - verifier.verifyFilePresent( "target/afterSessionEnd.txt" ); + verifier.verifyFilePresent("target/afterSessionEnd.txt"); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5663NestedImportScopePomResolutionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5663NestedImportScopePomResolutionTest.java index 061ef7a4dc..533813a5ec 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5663NestedImportScopePomResolutionTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5663NestedImportScopePomResolutionTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -35,37 +33,29 @@ import org.junit.jupiter.api.Test; * that dependencies are successfully resolved for this setup. * */ -public class MavenITmng5663NestedImportScopePomResolutionTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng5663NestedImportScopePomResolutionTest extends AbstractMavenIntegrationTestCase { - public MavenITmng5663NestedImportScopePomResolutionTest() - { - super( "[3.0.4,3.2.2),(3.2.2,)" ); + public MavenITmng5663NestedImportScopePomResolutionTest() { + super("[3.0.4,3.2.2),(3.2.2,)"); } @Test - public void testitMNG5639() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5663-nested-import-scope-pom-resolution"); + public void testitMNG5639() throws Exception { + File testDir = + ResourceExtractor.simpleExtractResources(getClass(), "/mng-5663-nested-import-scope-pom-resolution"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.deleteArtifacts( "org.apache.maven.its.mng5663" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.deleteArtifacts("org.apache.maven.its.mng5663"); - verifier.filterFile( "pom-template.xml", "pom.xml", "UTF-8" ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "--settings" ); - verifier.addCliArgument( "settings.xml" ); + verifier.filterFile("pom-template.xml", "pom.xml", "UTF-8"); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); - verifier.addCliArgument( "install" ); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyArtifactPresent( "org.apache.maven.its.mng5663", "c", "0.1", "jar" ); - + verifier.verifyArtifactPresent("org.apache.maven.its.mng5663", "c", "0.1", "jar"); } - - - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5669ReadPomsOnce.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5669ReadPomsOnce.java index c07f1b0c16..5169e06e9a 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5669ReadPomsOnce.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5669ReadPomsOnce.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,7 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.it; import java.io.File; import java.util.Collections; @@ -38,36 +37,31 @@ import org.junit.jupiter.api.Test; * MNG-5669. * */ -public class MavenITmng5669ReadPomsOnce - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng5669ReadPomsOnce extends AbstractMavenIntegrationTestCase { - public MavenITmng5669ReadPomsOnce() - { - super( "[4.0.0-alpha-1,)" ); + public MavenITmng5669ReadPomsOnce() { + super("[4.0.0-alpha-1,)"); } @Test - public void testWithoutBuildConsumer() - throws Exception - { + public void testWithoutBuildConsumer() throws Exception { // prepare JavaAgent - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5669-read-poms-once" ); - Verifier verifier = newVerifier( testDir.getAbsolutePath(), false ); - Map filterProperties = - Collections.singletonMap( "${javaAgentJar}", - verifier.getArtifactPath( "org.apache.maven.its", "core-it-javaagent", "2.1-SNAPSHOT", "jar" ) ); - verifier.filterFile( ".mvn/jvm.config", ".mvn/jvm.config", null, filterProperties ); + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5669-read-poms-once"); + Verifier verifier = newVerifier(testDir.getAbsolutePath(), false); + Map filterProperties = Collections.singletonMap( + "${javaAgentJar}", + verifier.getArtifactPath("org.apache.maven.its", "core-it-javaagent", "2.1-SNAPSHOT", "jar")); + verifier.filterFile(".mvn/jvm.config", ".mvn/jvm.config", null, filterProperties); - verifier.setForkJvm( true ); // pick up agent - verifier.setAutoclean( false ); - verifier.addCliArgument( "-q" ); - verifier.addCliArgument( "-U" ); - verifier.addCliArgument( "-Dmaven.experimental.buildconsumer=false" ); - verifier.addCliArgument( "verify"); + verifier.setForkJvm(true); // pick up agent + verifier.setAutoclean(false); + verifier.addCliArgument("-q"); + verifier.addCliArgument("-U"); + verifier.addCliArgument("-Dmaven.experimental.buildconsumer=false"); + verifier.addCliArgument("verify"); verifier.execute(); - List logTxt = verifier.loadLines( "log.txt", "utf-8" ); + List logTxt = verifier.loadLines("log.txt", "utf-8"); // count source items Map sourceMap = logTxt.stream() @@ -85,27 +79,25 @@ public class MavenITmng5669ReadPomsOnce } @Test - public void testWithBuildConsumer() - throws Exception - { + public void testWithBuildConsumer() throws Exception { // prepare JavaAgent - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5669-read-poms-once" ); - Verifier verifier = newVerifier( testDir.getAbsolutePath(), false ); - Map filterProperties = - Collections.singletonMap( "${javaAgentJar}", - verifier.getArtifactPath( "org.apache.maven.its", "core-it-javaagent", "2.1-SNAPSHOT", "jar" ) ); - verifier.filterFile( ".mvn/jvm.config", ".mvn/jvm.config", null, filterProperties ); + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5669-read-poms-once"); + Verifier verifier = newVerifier(testDir.getAbsolutePath(), false); + Map filterProperties = Collections.singletonMap( + "${javaAgentJar}", + verifier.getArtifactPath("org.apache.maven.its", "core-it-javaagent", "2.1-SNAPSHOT", "jar")); + verifier.filterFile(".mvn/jvm.config", ".mvn/jvm.config", null, filterProperties); - verifier.setLogFileName( "log-bc.txt" ); - verifier.setForkJvm( true ); // pick up agent - verifier.setAutoclean( false ); - verifier.addCliArgument( "-q" ); - verifier.addCliArgument( "-U" ); - verifier.addCliArgument( "-Dmaven.experimental.buildconsumer=true" ); - verifier.addCliArgument( "verify" ); + verifier.setLogFileName("log-bc.txt"); + verifier.setForkJvm(true); // pick up agent + verifier.setAutoclean(false); + verifier.addCliArgument("-q"); + verifier.addCliArgument("-U"); + verifier.addCliArgument("-Dmaven.experimental.buildconsumer=true"); + verifier.addCliArgument("verify"); verifier.execute(); - List logTxt = verifier.loadLines( "log-bc.txt", "utf-8" ); + List logTxt = verifier.loadLines("log-bc.txt", "utf-8"); // count source items Map sourceMap = logTxt.stream() @@ -126,18 +118,16 @@ public class MavenITmng5669ReadPomsOnce final String buildSourceKey = "org.apache.maven.model.building.source="; final int keyLength = buildSourceKey.length(); - int start = line.indexOf( buildSourceKey ); - if ( start < 0 ) - { + int start = line.indexOf(buildSourceKey); + if (start < 0) { return null; } - int end = line.indexOf( ", ", start ); - if ( end < 0 ) - { + int end = line.indexOf(", ", start); + if (end < 0) { end = line.length() - 1; // is the } } - return line.substring( start + keyLength, end ); + return line.substring(start + keyLength, end); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5716ToolchainsTypeTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5716ToolchainsTypeTest.java index 51d81999ed..6a327582ab 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5716ToolchainsTypeTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5716ToolchainsTypeTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Map; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -33,12 +31,9 @@ import org.junit.jupiter.api.Test; * * @author Hervé Boutemy */ -public class MavenITmng5716ToolchainsTypeTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng5716ToolchainsTypeTest() - { - super( "(3.2.3,)" ); +public class MavenITmng5716ToolchainsTypeTest extends AbstractMavenIntegrationTestCase { + public MavenITmng5716ToolchainsTypeTest() { + super("(3.2.3,)"); } /** @@ -46,34 +41,31 @@ public class MavenITmng5716ToolchainsTypeTest * @throws Exception in case of failure */ @Test - public void testitMNG5716() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5716-toolchains-type" ); + public void testitMNG5716() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5716-toolchains-type"); - File javaHome = new File( testDir, "javaHome" ); + File javaHome = new File(testDir, "javaHome"); javaHome.mkdirs(); - new File( javaHome, "bin" ).mkdirs(); - new File( javaHome, "bin/javac").createNewFile(); - new File( javaHome, "bin/javac.exe").createNewFile(); + new File(javaHome, "bin").mkdirs(); + new File(javaHome, "bin/javac").createNewFile(); + new File(javaHome, "bin/javac.exe").createNewFile(); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); Map properties = verifier.newDefaultFilterMap(); - properties.put( "@javaHome@", javaHome.getAbsolutePath() ); + properties.put("@javaHome@", javaHome.getAbsolutePath()); - verifier.filterFile( "toolchains.xml", "toolchains.xml", "UTF-8", properties ); + verifier.filterFile("toolchains.xml", "toolchains.xml", "UTF-8", properties); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "--toolchains" ); - verifier.addCliArgument( "toolchains.xml" ); - verifier.addCliArgument( "initialize" ); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("--toolchains"); + verifier.addCliArgument("toolchains.xml"); + verifier.addCliArgument("initialize"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/toolchains.properties" ); - Properties results = verifier.loadProperties( "target/toolchains.properties" ); - assertNull( "javac tool should not be found for requested 'fake' toolchain", results.getProperty( "tool.1" ) ); + verifier.verifyFilePresent("target/toolchains.properties"); + Properties results = verifier.loadProperties("target/toolchains.properties"); + assertNull("javac tool should not be found for requested 'fake' toolchain", results.getProperty("tool.1")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5742BuildExtensionClassloaderTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5742BuildExtensionClassloaderTest.java index d48ad7a1c2..76926908b6 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5742BuildExtensionClassloaderTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5742BuildExtensionClassloaderTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,48 +16,43 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import org.apache.maven.shared.utils.io.FileUtils; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; -public class MavenITmng5742BuildExtensionClassloaderTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng5742BuildExtensionClassloaderTest extends AbstractMavenIntegrationTestCase { - public MavenITmng5742BuildExtensionClassloaderTest() - { - super( "(3.2.5,)" ); + public MavenITmng5742BuildExtensionClassloaderTest() { + super("(3.2.5,)"); } @Test - public void testBuildExtensionClassloader() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5742-build-extension-classloader" ); - File pluginDir = new File( testDir, "plugin" ); - File projectDir = new File( testDir, "project" ); + public void testBuildExtensionClassloader() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5742-build-extension-classloader"); + File pluginDir = new File(testDir, "plugin"); + File projectDir = new File(testDir, "project"); Verifier verifier; // install the test plugin - verifier = newVerifier( pluginDir.getAbsolutePath(), "remote" ); - verifier.addCliArgument( "install" ); + verifier = newVerifier(pluginDir.getAbsolutePath(), "remote"); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); // build the test project - verifier = newVerifier( projectDir.getAbsolutePath(), "remote" ); - verifier.addCliArgument( "validate" ); + verifier = newVerifier(projectDir.getAbsolutePath(), "remote"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/execution-success.txt" ); + verifier.verifyFilePresent("target/execution-success.txt"); - String actual = FileUtils.fileRead( new File( projectDir, "target/execution-success.txt" ) ); - assertEquals( "executed", actual ); + String actual = FileUtils.fileRead(new File(projectDir, "target/execution-success.txt")); + assertEquals("executed", actual); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5753CustomMojoExecutionConfiguratorTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5753CustomMojoExecutionConfiguratorTest.java index 875015ed61..7a1505a060 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5753CustomMojoExecutionConfiguratorTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5753CustomMojoExecutionConfiguratorTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,37 +16,33 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import org.apache.maven.shared.utils.io.FileUtils; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; -public class MavenITmng5753CustomMojoExecutionConfiguratorTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng5753CustomMojoExecutionConfiguratorTest extends AbstractMavenIntegrationTestCase { - public MavenITmng5753CustomMojoExecutionConfiguratorTest() - { - super( "[3.3.0-alpha,)" ); + public MavenITmng5753CustomMojoExecutionConfiguratorTest() { + super("[3.3.0-alpha,)"); } @Test - public void testCustomMojoExecutionConfigurator() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5753-custom-mojo-execution-configurator" ); - File pluginDir = new File( testDir, "plugin" ); - File projectDir = new File( testDir, "project" ); + public void testCustomMojoExecutionConfigurator() throws Exception { + File testDir = + ResourceExtractor.simpleExtractResources(getClass(), "/mng-5753-custom-mojo-execution-configurator"); + File pluginDir = new File(testDir, "plugin"); + File projectDir = new File(testDir, "project"); Verifier verifier; // install the test plugin - verifier = newVerifier( pluginDir.getAbsolutePath(), "remote" ); - verifier.addCliArgument( "install" ); + verifier = newVerifier(pluginDir.getAbsolutePath(), "remote"); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); @@ -56,17 +50,17 @@ public class MavenITmng5753CustomMojoExecutionConfiguratorTest configurationFile.delete(); // build the test project - verifier = newVerifier( projectDir.getAbsolutePath(), "remote" ); - verifier.addCliArgument( "validate" ); + verifier = newVerifier(projectDir.getAbsolutePath(), "remote"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( configurationFile.getCanonicalPath() ); + verifier.verifyFilePresent(configurationFile.getCanonicalPath()); // // The element in the original configuration is "ORIGINAL". We want to assert that our // custom MojoExecutionConfigurator made the transformation of the element from "ORIGINAL" to "TRANSFORMED" // - String actual = FileUtils.fileRead( configurationFile ); - assertEquals( "TRANSFORMED", actual ); + String actual = FileUtils.fileRead(configurationFile); + assertEquals("TRANSFORMED", actual); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5760ResumeFeatureTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5760ResumeFeatureTest.java index 691d34e097..e986f69ab3 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5760ResumeFeatureTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5760ResumeFeatureTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,15 +16,15 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; import java.io.IOException; import java.util.List; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -50,15 +48,15 @@ public class MavenITmng5760ResumeFeatureTest extends AbstractMavenIntegrationTes private final File fourModulesTestDir; public MavenITmng5760ResumeFeatureTest() throws IOException { - super( "[4.0.0-alpha-1,)" ); - this.parentDependentTestDir = ResourceExtractor.simpleExtractResources( getClass(), - "/mng-5760-resume-feature/parent-dependent" ); - this.parentIndependentTestDir = ResourceExtractor.simpleExtractResources( getClass(), - "/mng-5760-resume-feature/parent-independent" ); - this.noProjectTestDir = ResourceExtractor.simpleExtractResources( getClass(), - "/mng-5760-resume-feature/no-project" ); - this.fourModulesTestDir = ResourceExtractor.simpleExtractResources( getClass(), - "/mng-5760-resume-feature/four-modules" ); + super("[4.0.0-alpha-1,)"); + this.parentDependentTestDir = + ResourceExtractor.simpleExtractResources(getClass(), "/mng-5760-resume-feature/parent-dependent"); + this.parentIndependentTestDir = + ResourceExtractor.simpleExtractResources(getClass(), "/mng-5760-resume-feature/parent-independent"); + this.noProjectTestDir = + ResourceExtractor.simpleExtractResources(getClass(), "/mng-5760-resume-feature/no-project"); + this.fourModulesTestDir = + ResourceExtractor.simpleExtractResources(getClass(), "/mng-5760-resume-feature/four-modules"); } /** @@ -67,112 +65,96 @@ public class MavenITmng5760ResumeFeatureTest extends AbstractMavenIntegrationTes * @throws Exception in case of failure */ @Test - public void testShouldSuggestToResumeWithoutArgs() throws Exception - { - Verifier verifier = newVerifier( parentDependentTestDir.getAbsolutePath() ); - verifier.addCliArgument( "-Dmodule-b.fail=true" ); + public void testShouldSuggestToResumeWithoutArgs() throws Exception { + Verifier verifier = newVerifier(parentDependentTestDir.getAbsolutePath()); + verifier.addCliArgument("-Dmodule-b.fail=true"); - try - { - verifier.addCliArgument( "test" ); + try { + verifier.addCliArgument("test"); verifier.execute(); - fail( "Expected this invocation to fail" ); - } - catch ( final VerificationException ve ) - { - verifier.verifyTextInLog( "mvn [args] -r" ); - verifyTextNotInLog( verifier, "mvn [args] -rf :module-b" ); + fail("Expected this invocation to fail"); + } catch (final VerificationException ve) { + verifier.verifyTextInLog("mvn [args] -r"); + verifyTextNotInLog(verifier, "mvn [args] -rf :module-b"); } // New build with -r should resume the build from module-b, skipping module-a since it has succeeded already. - verifier = newVerifier( parentDependentTestDir.getAbsolutePath() ); - verifier.addCliArgument( "-r" ); - verifier.addCliArgument( "test" ); + verifier = newVerifier(parentDependentTestDir.getAbsolutePath()); + verifier.addCliArgument("-r"); + verifier.addCliArgument("test"); verifier.execute(); - verifyTextNotInLog( verifier, "Building module-a 1.0" ); - verifier.verifyTextInLog( "Building module-b 1.0" ); - verifier.verifyTextInLog( "Building module-c 1.0" ); + verifyTextNotInLog(verifier, "Building module-a 1.0"); + verifier.verifyTextInLog("Building module-b 1.0"); + verifier.verifyTextInLog("Building module-c 1.0"); } @Test - public void testShouldSkipSuccessfulProjects() throws Exception - { - Verifier verifier = newVerifier( parentDependentTestDir.getAbsolutePath() ); - verifier.addCliArgument( "-Dmodule-a.fail=true" ); - verifier.addCliArgument( "--fail-at-end"); + public void testShouldSkipSuccessfulProjects() throws Exception { + Verifier verifier = newVerifier(parentDependentTestDir.getAbsolutePath()); + verifier.addCliArgument("-Dmodule-a.fail=true"); + verifier.addCliArgument("--fail-at-end"); - try - { - verifier.addCliArgument( "test" ); + try { + verifier.addCliArgument("test"); verifier.execute(); - fail( "Expected this invocation to fail" ); - } - catch ( final VerificationException ve ) - { + fail("Expected this invocation to fail"); + } catch (final VerificationException ve) { // Expected to fail. } // Let module-b and module-c fail, if they would have been built... - verifier = newVerifier( parentDependentTestDir.getAbsolutePath() ); - verifier.addCliArgument( "-Dmodule-b.fail=true" ); - verifier.addCliArgument( "-Dmodule-c.fail=true" ); + verifier = newVerifier(parentDependentTestDir.getAbsolutePath()); + verifier.addCliArgument("-Dmodule-b.fail=true"); + verifier.addCliArgument("-Dmodule-c.fail=true"); // ... but adding -r should exclude those two from the build because the previous Maven invocation // marked them as successfully built. - verifier.addCliArgument( "-r" ); - verifier.addCliArgument( "test" ); + verifier.addCliArgument("-r"); + verifier.addCliArgument("test"); verifier.execute(); } @Test - public void testShouldSkipSuccessfulModulesWhenTheFirstModuleFailed() throws Exception - { + public void testShouldSkipSuccessfulModulesWhenTheFirstModuleFailed() throws Exception { // In this multi-module project, the submodules are not dependent on the parent. // This results in the parent to be built last, and module-a to be built first. // This enables us to let the first module in the reactor (module-a) fail. - Verifier verifier = newVerifier( parentIndependentTestDir.getAbsolutePath() ); - verifier.addCliArgument( "-Dmodule-a.fail=true" ); - verifier.addCliArgument( "--fail-at-end"); + Verifier verifier = newVerifier(parentIndependentTestDir.getAbsolutePath()); + verifier.addCliArgument("-Dmodule-a.fail=true"); + verifier.addCliArgument("--fail-at-end"); - try - { - verifier.addCliArgument( "test" ); + try { + verifier.addCliArgument("test"); verifier.execute(); - fail( "Expected this invocation to fail" ); - } - catch ( final VerificationException ve ) - { - verifier.verifyTextInLog( "mvn [args] -r" ); + fail("Expected this invocation to fail"); + } catch (final VerificationException ve) { + verifier.verifyTextInLog("mvn [args] -r"); } - verifier = newVerifier( parentIndependentTestDir.getAbsolutePath() ); - verifier.addCliArgument( "-r" ); - verifier.addCliArgument( "test" ); + verifier = newVerifier(parentIndependentTestDir.getAbsolutePath()); + verifier.addCliArgument("-r"); + verifier.addCliArgument("test"); verifier.execute(); - verifier.verifyTextInLog( "Building module-a 1.0" ); - verifyTextNotInLog( verifier, "Building module-b 1.0" ); + verifier.verifyTextInLog("Building module-a 1.0"); + verifyTextNotInLog(verifier, "Building module-b 1.0"); } @Test - public void testShouldNotCrashWithoutProject() throws Exception - { + public void testShouldNotCrashWithoutProject() throws Exception { // There is no Maven project available in the test directory. // As reported in JIRA this would previously break with a NullPointerException. - // (see https://issues.apache.org/jira/browse/MNG-5760?focusedCommentId=17143795&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-17143795) - final Verifier verifier = newVerifier( noProjectTestDir.getAbsolutePath() ); - try - { - verifier.addCliArgument( "resources:resources" ); + // (see + // https://issues.apache.org/jira/browse/MNG-5760?focusedCommentId=17143795&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-17143795) + final Verifier verifier = newVerifier(noProjectTestDir.getAbsolutePath()); + try { + verifier.addCliArgument("resources:resources"); verifier.execute(); - } - catch ( final VerificationException ve ) - { - verifier.verifyTextInLog( "Goal requires a project to execute but there is no POM in this directory" ); + } catch (final VerificationException ve) { + verifier.verifyTextInLog("Goal requires a project to execute but there is no POM in this directory"); } } @Test - public void testFailureWithParallelBuild() throws Exception - { + public void testFailureWithParallelBuild() throws Exception { // four modules: a, b, c, d // c depends on b, d depends on a @@ -183,41 +165,37 @@ public class MavenITmng5760ResumeFeatureTest extends AbstractMavenIntegrationTes // b : success // c : failure // d : skipped - Verifier verifier = newVerifier( fourModulesTestDir.getAbsolutePath() ); - verifier.addCliArgument( "-T2" ); - verifier.addCliArgument( "-Dmodule-a.delay=1000" ); - verifier.addCliArgument( "-Dmodule-a.fail=true" ); - verifier.addCliArgument( "-Dmodule-c.fail=true" ); - try - { - verifier.addCliArgument( "verify" ); + Verifier verifier = newVerifier(fourModulesTestDir.getAbsolutePath()); + verifier.addCliArgument("-T2"); + verifier.addCliArgument("-Dmodule-a.delay=1000"); + verifier.addCliArgument("-Dmodule-a.fail=true"); + verifier.addCliArgument("-Dmodule-c.fail=true"); + try { + verifier.addCliArgument("verify"); verifier.execute(); - fail( "Expected this invocation to fail" ); - } - catch ( final VerificationException ve ) - { + fail("Expected this invocation to fail"); + } catch (final VerificationException ve) { // Expected to fail. } // Let module-b fail, if it would have been built... - verifier = newVerifier( fourModulesTestDir.getAbsolutePath() ); - verifier.addCliArgument( "-T2" ); - verifier.addCliArgument( "-Dmodule-b.fail=true" ); + verifier = newVerifier(fourModulesTestDir.getAbsolutePath()); + verifier.addCliArgument("-T2"); + verifier.addCliArgument("-Dmodule-b.fail=true"); // ... but adding -r should exclude it from the build because the previous Maven invocation // marked it as successfully built. - verifier.addCliArgument( "-r" ); + verifier.addCliArgument("-r"); // The result should be: // a : success // c : success // d : success - verifier.addCliArgument( "verify" ); + verifier.addCliArgument("verify"); verifier.execute(); } @Test - public void testFailureAfterSkipWithParallelBuild() throws Exception - { + public void testFailureAfterSkipWithParallelBuild() throws Exception { // four modules: a, b, c, d // c depends on b, d depends on a @@ -228,34 +206,31 @@ public class MavenITmng5760ResumeFeatureTest extends AbstractMavenIntegrationTes // b : success, slow // c : skipped // d : failure - Verifier verifier = newVerifier( fourModulesTestDir.getAbsolutePath() ); - verifier.addCliArgument( "-T2" ); - verifier.addCliArgument( "-Dmodule-b.delay=2000" ); - verifier.addCliArgument( "-Dmodule-d.fail=true" ); - try - { - verifier.addCliArgument( "verify" ); + Verifier verifier = newVerifier(fourModulesTestDir.getAbsolutePath()); + verifier.addCliArgument("-T2"); + verifier.addCliArgument("-Dmodule-b.delay=2000"); + verifier.addCliArgument("-Dmodule-d.fail=true"); + try { + verifier.addCliArgument("verify"); verifier.execute(); - fail( "Expected this invocation to fail" ); - } - catch ( final VerificationException ve ) - { + fail("Expected this invocation to fail"); + } catch (final VerificationException ve) { // Expected to fail. } // Let module-a and module-b fail, if they would have been built... - verifier = newVerifier( fourModulesTestDir.getAbsolutePath() ); - verifier.addCliArgument( "-T2" ); - verifier.addCliArgument( "-Dmodule-a.fail=true" ); - verifier.addCliArgument( "-Dmodule-b.fail=true" ); + verifier = newVerifier(fourModulesTestDir.getAbsolutePath()); + verifier.addCliArgument("-T2"); + verifier.addCliArgument("-Dmodule-a.fail=true"); + verifier.addCliArgument("-Dmodule-b.fail=true"); // ... but adding -r should exclude those two from the build because the previous Maven invocation // marked them as successfully built. - verifier.addCliArgument( "-r" ); + verifier.addCliArgument("-r"); // The result should be: // c : success // d : success - verifier.addCliArgument( "verify" ); + verifier.addCliArgument("verify"); verifier.execute(); } @@ -266,16 +241,12 @@ public class MavenITmng5760ResumeFeatureTest extends AbstractMavenIntegrationTes * @param text the text to assert present * @throws VerificationException if text is not found in log */ - private void verifyTextNotInLog( Verifier verifier, String text ) - throws VerificationException - { - List lines = verifier.loadFile( verifier.getBasedir(), verifier.getLogFileName(), false ); + private void verifyTextNotInLog(Verifier verifier, String text) throws VerificationException { + List lines = verifier.loadFile(verifier.getBasedir(), verifier.getLogFileName(), false); - for ( String line : lines ) - { - if ( Verifier.stripAnsi( line ).contains( text ) ) - { - throw new VerificationException( "Text found in log: " + text ); + for (String line : lines) { + if (Verifier.stripAnsi(line).contains(text)) { + throw new VerificationException("Text found in log: " + text); } } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5768CliExecutionIdTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5768CliExecutionIdTest.java index 51e6a65967..1110c5f412 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5768CliExecutionIdTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5768CliExecutionIdTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,36 +16,31 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; -public class MavenITmng5768CliExecutionIdTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng5768CliExecutionIdTest() - { - super( "(3.2.5,)" ); +public class MavenITmng5768CliExecutionIdTest extends AbstractMavenIntegrationTestCase { + public MavenITmng5768CliExecutionIdTest() { + super("(3.2.5,)"); } @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5768-cli-execution-id" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5768-cli-execution-id"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "org.apache.maven.its.plugins:maven-it-plugin-configuration:config@test-execution-id" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.deleteDirectory("target"); + verifier.addCliArgument("org.apache.maven.its.plugins:maven-it-plugin-configuration:config@test-execution-id"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/config.properties" ); - assertEquals( "CONFIGURED", props.getProperty( "beanParam.fieldParam" ) ); + Properties props = verifier.loadProperties("target/config.properties"); + assertEquals("CONFIGURED", props.getProperty("beanParam.fieldParam")); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5771CoreExtensionsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5771CoreExtensionsTest.java index b38260b626..c9f72eeb9b 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5771CoreExtensionsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5771CoreExtensionsTest.java @@ -1,11 +1,28 @@ +/* + * 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.it; -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; - import java.io.File; import java.util.Map; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -13,92 +30,81 @@ import org.junit.jupiter.api.Test; * check that Maven loads core extensions and components contributed by .mvn/extensions.xml * are available to regular plugins. */ -public class MavenITmng5771CoreExtensionsTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng5771CoreExtensionsTest() - { - super( "(3.2.5,)" ); +public class MavenITmng5771CoreExtensionsTest extends AbstractMavenIntegrationTestCase { + public MavenITmng5771CoreExtensionsTest() { + super("(3.2.5,)"); } @Test - public void testCoreExtension() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5771-core-extensions" ); + public void testCoreExtension() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5771-core-extensions"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); - verifier = newVerifier( new File( testDir, "client" ).getAbsolutePath() ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.it-core-extensions" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( new File( testDir, "settings.xml" ).getAbsolutePath() ); - verifier.addCliArgument( "validate" ); + verifier = newVerifier(new File(testDir, "client").getAbsolutePath()); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.it-core-extensions"); + verifier.addCliArgument("-s"); + verifier.addCliArgument(new File(testDir, "settings.xml").getAbsolutePath()); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); } @Test - public void testCoreExtensionNoDescriptor() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5771-core-extensions" ); + public void testCoreExtensionNoDescriptor() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5771-core-extensions"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); - verifier = newVerifier( new File( testDir, "client-no-descriptor" ).getAbsolutePath() ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.it-core-extensions" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( new File( testDir, "settings.xml" ).getAbsolutePath() ); - verifier.addCliArgument( "validate" ); + verifier = newVerifier(new File(testDir, "client-no-descriptor").getAbsolutePath()); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.it-core-extensions"); + verifier.addCliArgument("-s"); + verifier.addCliArgument(new File(testDir, "settings.xml").getAbsolutePath()); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); } // - // https://issues.apache.org/jira/browse/MNG-5795: Maven extensions can not be retrieved from authenticated repositories + // https://issues.apache.org/jira/browse/MNG-5795: Maven extensions can not be retrieved from authenticated + // repositories // @Test - public void testCoreExtensionRetrievedFromAMirrorWithBasicAuthentication() - throws Exception - { - requiresMavenVersion( "[3.3.2,)" ); + public void testCoreExtensionRetrievedFromAMirrorWithBasicAuthentication() throws Exception { + requiresMavenVersion("[3.3.2,)"); - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5771-core-extensions" ); + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5771-core-extensions"); HttpServer server = HttpServer.builder() // - .port(0) // - .username("maven") // - .password("secret") // - .source(new File(testDir, "repo")) // - .build(); + .port(0) // + .username("maven") // + .password("secret") // + .source(new File(testDir, "repo")) // + .build(); server.start(); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); Map properties = verifier.newDefaultFilterMap(); - properties.put("@port@", Integer.toString( server.port() ) ); + properties.put("@port@", Integer.toString(server.port())); String mirrorOf; - if ( matchesVersionRange( "[4.0.0-alpha-1,)" ) ) - { + if (matchesVersionRange("[4.0.0-alpha-1,)")) { mirrorOf = "*"; - } - else - { + } else { mirrorOf = "external:*"; } - properties.put("@mirrorOf@", mirrorOf ); - verifier.filterFile( "settings-template-mirror-auth.xml", "settings.xml", "UTF-8", properties ); + properties.put("@mirrorOf@", mirrorOf); + verifier.filterFile("settings-template-mirror-auth.xml", "settings.xml", "UTF-8", properties); - verifier = newVerifier( new File( testDir, "client" ).getAbsolutePath() ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.it-core-extensions" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( new File( testDir, "settings.xml" ).getAbsolutePath() ); - verifier.addCliArgument( "validate" ); + verifier = newVerifier(new File(testDir, "client").getAbsolutePath()); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.it-core-extensions"); + verifier.addCliArgument("-s"); + verifier.addCliArgument(new File(testDir, "settings.xml").getAbsolutePath()); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); @@ -109,23 +115,21 @@ public class MavenITmng5771CoreExtensionsTest // https://issues.apache.org/jira/browse/MNG-7395: Support properties in extensions.xml // @Test - public void testCoreExtensionWithProperties() - throws Exception - { - requiresMavenVersion( "[3.8.5,)" ); + public void testCoreExtensionWithProperties() throws Exception { + requiresMavenVersion("[3.8.5,)"); - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5771-core-extensions" ); + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5771-core-extensions"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); - verifier = newVerifier( new File( testDir, "client-properties" ).getAbsolutePath() ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.it-core-extensions" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( new File( testDir, "settings.xml" ).getAbsolutePath() ); - verifier.addCliArgument( "-Dtest-extension-version=0.1" ); - verifier.addCliArgument( "validate" ); + verifier = newVerifier(new File(testDir, "client-properties").getAbsolutePath()); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.it-core-extensions"); + verifier.addCliArgument("-s"); + verifier.addCliArgument(new File(testDir, "settings.xml").getAbsolutePath()); + verifier.addCliArgument("-Dtest-extension-version=0.1"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); } @@ -134,23 +138,21 @@ public class MavenITmng5771CoreExtensionsTest // https://issues.apache.org/jira/browse/MNG-7395: Support properties in extensions.xml // @Test - public void testCoreExtensionWithConfig() - throws Exception - { - requiresMavenVersion( "[3.8.5,)" ); + public void testCoreExtensionWithConfig() throws Exception { + requiresMavenVersion("[3.8.5,)"); - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5771-core-extensions" ); + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5771-core-extensions"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); - verifier = newVerifier( new File( testDir, "client-config" ).getAbsolutePath() ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.it-core-extensions" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( new File( testDir, "settings.xml" ).getAbsolutePath() ); - verifier.setForkJvm( true ); // force forked JVM since we need the shell script to detect .mvn/ - verifier.addCliArgument( "validate" ); + verifier = newVerifier(new File(testDir, "client-config").getAbsolutePath()); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.it-core-extensions"); + verifier.addCliArgument("-s"); + verifier.addCliArgument(new File(testDir, "settings.xml").getAbsolutePath()); + verifier.setForkJvm(true); // force forked JVM since we need the shell script to detect .mvn/ + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5774ConfigurationProcessorsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5774ConfigurationProcessorsTest.java index 7f8e6361ff..61c683d717 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5774ConfigurationProcessorsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5774ConfigurationProcessorsTest.java @@ -1,70 +1,78 @@ +/* + * 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.it; -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; - import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; -public class MavenITmng5774ConfigurationProcessorsTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng5774ConfigurationProcessorsTest() - { - super( "(3.2.5,)" ); +public class MavenITmng5774ConfigurationProcessorsTest extends AbstractMavenIntegrationTestCase { + public MavenITmng5774ConfigurationProcessorsTest() { + super("(3.2.5,)"); } @Test - public void testBehaviourWhereThereIsOneUserSuppliedConfigurationProcessor() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5774-configuration-processors" ); + public void testBehaviourWhereThereIsOneUserSuppliedConfigurationProcessor() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5774-configuration-processors"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); - verifier = newVerifier( new File( testDir, "build-with-one-processor-valid" ).getAbsolutePath() ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.it-configuration-processors" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( new File( testDir, "settings.xml" ).getAbsolutePath() ); - verifier.addCliArgument( "process-resources" ); + verifier = newVerifier(new File(testDir, "build-with-one-processor-valid").getAbsolutePath()); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.it-configuration-processors"); + verifier.addCliArgument("-s"); + verifier.addCliArgument(new File(testDir, "settings.xml").getAbsolutePath()); + verifier.addCliArgument("process-resources"); verifier.execute(); verifier.verifyErrorFreeLog(); // Making sure our configuration processor executes - verifier.verifyTextInLog( "[INFO] ConfigurationProcessorOne.process()" ); + verifier.verifyTextInLog("[INFO] ConfigurationProcessorOne.process()"); // We have a property value injected by our configuration processor. Make sure it's correct - verifier.verifyFilePresent( "target/classes/result.properties" ); - Properties result = verifier.loadProperties( "target/classes/result.properties" ); - assertEquals( "yes", result.getProperty( "configurationProcessorContributedValue" ) ); + verifier.verifyFilePresent("target/classes/result.properties"); + Properties result = verifier.loadProperties("target/classes/result.properties"); + assertEquals("yes", result.getProperty("configurationProcessorContributedValue")); } @Test - public void testBehaviourWhereThereAreTwoUserSuppliedConfigurationProcessor() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5774-configuration-processors" ); + public void testBehaviourWhereThereAreTwoUserSuppliedConfigurationProcessor() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5774-configuration-processors"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); - verifier = newVerifier( new File( testDir, "build-with-two-processors-invalid" ).getAbsolutePath() ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.it-configuration-processors" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( new File( testDir, "settings.xml" ).getAbsolutePath() ); - try - { - verifier.addCliArgument( "process-resources" ); + verifier = newVerifier(new File(testDir, "build-with-two-processors-invalid").getAbsolutePath()); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.it-configuration-processors"); + verifier.addCliArgument("-s"); + verifier.addCliArgument(new File(testDir, "settings.xml").getAbsolutePath()); + try { + verifier.addCliArgument("process-resources"); verifier.execute(); - fail( "We expected this invocation to fail because of too many user supplied configuration processors being present" ); - } - catch ( VerificationException e ) - { - verifier.verifyTextInLog( "There can only be one user supplied ConfigurationProcessor" ); + fail( + "We expected this invocation to fail because of too many user supplied configuration processors being present"); + } catch (VerificationException e) { + verifier.verifyTextInLog("There can only be one user supplied ConfigurationProcessor"); } } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5783PluginDependencyFiltering.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5783PluginDependencyFiltering.java index 5f85342814..7180196d56 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5783PluginDependencyFiltering.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5783PluginDependencyFiltering.java @@ -1,54 +1,63 @@ +/* + * 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.it; -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; - import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; -public class MavenITmng5783PluginDependencyFiltering - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng5783PluginDependencyFiltering extends AbstractMavenIntegrationTestCase { - public MavenITmng5783PluginDependencyFiltering() - { - super( "[3.0,)" ); + public MavenITmng5783PluginDependencyFiltering() { + super("[3.0,)"); } @Test - public void testSLF4j() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5783-plugin-dependency-filtering" ); - Verifier verifier = newVerifier( new File( testDir, "plugin" ).getAbsolutePath(), "remote" ); - verifier.addCliArgument( "install" ); + public void testSLF4j() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5783-plugin-dependency-filtering"); + Verifier verifier = newVerifier(new File(testDir, "plugin").getAbsolutePath(), "remote"); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier = newVerifier( new File( testDir, "slf4j" ).getAbsolutePath(), "remote" ); - verifier.addCliArgument( "validate" ); + verifier = newVerifier(new File(testDir, "slf4j").getAbsolutePath(), "remote"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); // Note that plugin dependencies always include plugin itself and plexus-utils - List dependencies = verifier.loadLines( "target/dependencies.txt", "UTF-8" ); - if ( matchesVersionRange( "(,3.9.0)" ) ) - { - assertEquals( 3, dependencies.size() ); + List dependencies = verifier.loadLines("target/dependencies.txt", "UTF-8"); + if (matchesVersionRange("(,3.9.0)")) { + assertEquals(3, dependencies.size()); + } else { + assertEquals(2, dependencies.size()); } - else - { - assertEquals( 2, dependencies.size() ); - } - assertEquals( "mng-5783-plugin-dependency-filtering:mng-5783-plugin-dependency-filtering-plugin:maven-plugin:0.1", - dependencies.get( 0 ) ); - assertEquals( "org.slf4j:slf4j-api:jar:1.7.5", dependencies.get( 1 ) ); - if ( matchesVersionRange( "(,3.9.0)" ) ) - { - assertEquals( "org.codehaus.plexus:plexus-utils:jar:1.1", dependencies.get( 2 ) ); + assertEquals( + "mng-5783-plugin-dependency-filtering:mng-5783-plugin-dependency-filtering-plugin:maven-plugin:0.1", + dependencies.get(0)); + assertEquals("org.slf4j:slf4j-api:jar:1.7.5", dependencies.get(1)); + if (matchesVersionRange("(,3.9.0)")) { + assertEquals("org.codehaus.plexus:plexus-utils:jar:1.1", dependencies.get(2)); } } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5805PkgTypeMojoConfiguration2.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5805PkgTypeMojoConfiguration2.java index 3f67e84c0d..2643494013 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5805PkgTypeMojoConfiguration2.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5805PkgTypeMojoConfiguration2.java @@ -1,34 +1,45 @@ +/* + * 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.it; -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; - import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; -public class MavenITmng5805PkgTypeMojoConfiguration2 - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng5805PkgTypeMojoConfiguration2 extends AbstractMavenIntegrationTestCase { - public MavenITmng5805PkgTypeMojoConfiguration2() - { - super( "(3.3.3,)" ); + public MavenITmng5805PkgTypeMojoConfiguration2() { + super("(3.3.3,)"); } @Test - public void testPkgTypeMojoConfiguration() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5805-pkg-type-mojo-configuration2" ); + public void testPkgTypeMojoConfiguration() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5805-pkg-type-mojo-configuration2"); Verifier verifier; - - verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.addCliArgument( "validate" ); + verifier = newVerifier(testDir.getAbsolutePath()); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyTextInLog( "CLASS_NAME=org.apache.maven.its.mng5805.TestClass1" ); + verifier.verifyTextInLog("CLASS_NAME=org.apache.maven.its.mng5805.TestClass1"); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5840ParentVersionRanges.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5840ParentVersionRanges.java index 6ab892af79..f95e447209 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5840ParentVersionRanges.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5840ParentVersionRanges.java @@ -1,52 +1,61 @@ +/* + * 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.it; -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; - import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; -public class MavenITmng5840ParentVersionRanges - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng5840ParentVersionRanges() - { - super( "[3.3,)" ); +public class MavenITmng5840ParentVersionRanges extends AbstractMavenIntegrationTestCase { + public MavenITmng5840ParentVersionRanges() { + super("[3.3,)"); } @Test - public void testParentRangeRelativePathPointsToWrongVersion() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5840-relative-path-range-negative" ); + public void testParentRangeRelativePathPointsToWrongVersion() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5840-relative-path-range-negative"); - Verifier verifier = newVerifier( new File( testDir, "parent-1" ).getAbsolutePath(), "remote" ); - verifier.addCliArgument( "install" ); + Verifier verifier = newVerifier(new File(testDir, "parent-1").getAbsolutePath(), "remote"); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier = newVerifier( new File( testDir, "child" ).getAbsolutePath(), "remote" ); - verifier.addCliArgument( "validate" ); + verifier = newVerifier(new File(testDir, "child").getAbsolutePath(), "remote"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); } @Test - public void testParentRangeRelativePathPointsToCorrectVersion() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5840-relative-path-range-positive" ); + public void testParentRangeRelativePathPointsToCorrectVersion() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5840-relative-path-range-positive"); - Verifier verifier = newVerifier( new File( testDir, "parent-1" ).getAbsolutePath(), "remote" ); - verifier.addCliArgument( "install" ); + Verifier verifier = newVerifier(new File(testDir, "parent-1").getAbsolutePath(), "remote"); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier = newVerifier( new File( testDir, "child" ).getAbsolutePath(), "remote" ); - verifier.addCliArgument( "validate" ); + verifier = newVerifier(new File(testDir, "child").getAbsolutePath(), "remote"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5840RelativePathReactorMatching.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5840RelativePathReactorMatching.java index eb314aec82..444f872dba 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5840RelativePathReactorMatching.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5840RelativePathReactorMatching.java @@ -1,33 +1,45 @@ +/* + * 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.it; -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; - import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; -public class MavenITmng5840RelativePathReactorMatching - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng5840RelativePathReactorMatching() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenITmng5840RelativePathReactorMatching extends AbstractMavenIntegrationTestCase { + public MavenITmng5840RelativePathReactorMatching() { + super(ALL_MAVEN_VERSIONS); } @Test - public void testRelativePathPointsToWrongVersion() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5840-relative-path-reactor-matching" ); + public void testRelativePathPointsToWrongVersion() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5840-relative-path-reactor-matching"); - Verifier verifier = newVerifier( new File( testDir, "parent-1" ).getAbsolutePath(), "remote" ); - verifier.addCliArgument( "install" ); + Verifier verifier = newVerifier(new File(testDir, "parent-1").getAbsolutePath(), "remote"); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier = newVerifier( new File( testDir, "child" ).getAbsolutePath(), "remote" ); - verifier.addCliArgument( "validate" ); + verifier = newVerifier(new File(testDir, "child").getAbsolutePath(), "remote"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5868NoDuplicateAttachedArtifacts.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5868NoDuplicateAttachedArtifacts.java index c27e03d8bb..46d1cd6427 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5868NoDuplicateAttachedArtifacts.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5868NoDuplicateAttachedArtifacts.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,9 +16,7 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -28,8 +24,9 @@ import javax.servlet.http.HttpServletResponse; import java.io.File; import java.nio.file.Files; import java.nio.file.Path; -import java.util.Arrays; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.eclipse.jetty.server.Handler; import org.eclipse.jetty.server.NetworkConnector; import org.eclipse.jetty.server.Request; @@ -45,9 +42,7 @@ import org.junit.jupiter.api.Test; * * @author Olivier Lamy */ -public class MavenITmng5868NoDuplicateAttachedArtifacts - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng5868NoDuplicateAttachedArtifacts extends AbstractMavenIntegrationTestCase { private File testDir; @@ -57,86 +52,71 @@ public class MavenITmng5868NoDuplicateAttachedArtifacts private int deployedJarArtifactNumber = 0; - public MavenITmng5868NoDuplicateAttachedArtifacts() - { - super( "[3.8.2,)" ); + public MavenITmng5868NoDuplicateAttachedArtifacts() { + super("[3.8.2,)"); } @BeforeEach - protected void setUp() - throws Exception - { - testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5868" ); + protected void setUp() throws Exception { + testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5868"); - Handler repoHandler = new AbstractHandler() - { + Handler repoHandler = new AbstractHandler() { @Override - public void handle( String target, Request baseRequest, HttpServletRequest request, - HttpServletResponse response ) - { - System.out.println( "Handling " + request.getMethod() + " " + request.getRequestURL() ); + public void handle( + String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) { + System.out.println("Handling " + request.getMethod() + " " + request.getRequestURL()); - if ( "PUT".equalsIgnoreCase( request.getMethod() ) ) - { + if ("PUT".equalsIgnoreCase(request.getMethod())) { String uri = request.getRequestURI(); - if (uri.startsWith( "/repo/org/apache/maven/its/mng5868/mng5868/1.0-SNAPSHOT/mng5868-1.0" ) && uri.endsWith( "-run.jar" )) - { + if (uri.startsWith("/repo/org/apache/maven/its/mng5868/mng5868/1.0-SNAPSHOT/mng5868-1.0") + && uri.endsWith("-run.jar")) { deployedJarArtifactNumber++; } - response.setStatus( HttpServletResponse.SC_OK ); - } - else - { - response.setStatus( HttpServletResponse.SC_NOT_FOUND ); + response.setStatus(HttpServletResponse.SC_OK); + } else { + response.setStatus(HttpServletResponse.SC_NOT_FOUND); } - ( (Request) request ).setHandled( true ); + ((Request) request).setHandled(true); } }; - server = new Server( 0 ); + server = new Server(0); HandlerList handlerList = new HandlerList(); - handlerList.addHandler( repoHandler ); + handlerList.addHandler(repoHandler); - server.setHandler( handlerList ); + server.setHandler(handlerList); server.start(); - if ( server.isFailed() ) - { - fail( "Couldn't bind the server socket to a free port!" ); + if (server.isFailed()) { + fail("Couldn't bind the server socket to a free port!"); } - port = ( (NetworkConnector) server.getConnectors()[0] ).getLocalPort(); - System.out.println( "Bound server socket to the port " + port ); + port = ((NetworkConnector) server.getConnectors()[0]).getLocalPort(); + System.out.println("Bound server socket to the port " + port); } @AfterEach - protected void tearDown() - throws Exception - { - if ( server != null ) - { + protected void tearDown() throws Exception { + if (server != null) { server.stop(); server.join(); } } @Test - public void testNoDeployNotDuplicate() - throws Exception - { - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - Path tmp = Files.createTempFile( testDir.toPath(), "FOO", "txt"); + public void testNoDeployNotDuplicate() throws Exception { + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + Path tmp = Files.createTempFile(testDir.toPath(), "FOO", "txt"); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng5868" ); - verifier.addCliArgument( "-Dartifact.attachedFile=" + tmp.toFile().getCanonicalPath() ); - verifier.addCliArgument( "-DdeploymentPort=" + port ); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng5868"); + verifier.addCliArgument("-Dartifact.attachedFile=" + tmp.toFile().getCanonicalPath()); + verifier.addCliArgument("-DdeploymentPort=" + port); verifier.displayStreamBuffers(); - verifier.addCliArguments( "org.apache.maven.its.plugins:maven-it-plugin-artifact:2.1-SNAPSHOT:attach", "deploy" ); + verifier.addCliArguments("org.apache.maven.its.plugins:maven-it-plugin-artifact:2.1-SNAPSHOT:attach", "deploy"); verifier.execute(); verifier.verifyErrorFreeLog(); - assertEquals("deployedJarArtifactNumber: " + deployedJarArtifactNumber, 1, deployedJarArtifactNumber ); + assertEquals("deployedJarArtifactNumber: " + deployedJarArtifactNumber, 1, deployedJarArtifactNumber); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5889FindBasedir.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5889FindBasedir.java index c22ff1d23a..382ba5d081 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5889FindBasedir.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5889FindBasedir.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,25 +16,22 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** * This is a test set for MNG-5889: * check that extensions in .mvn/ are found when Maven is run with -f path/to/pom.xml. */ -public class MavenITmng5889FindBasedir - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng5889FindBasedir() - { - super( "[3.5.0,3.5.1)" ); +public class MavenITmng5889FindBasedir extends AbstractMavenIntegrationTestCase { + public MavenITmng5889FindBasedir() { + super("[3.5.0,3.5.1)"); } /** @@ -45,10 +40,8 @@ public class MavenITmng5889FindBasedir * @throws Exception in case of failure */ @Test - public void testMvnFileLongOption() - throws Exception - { - runCoreExtensionWithOption( "--file", null ); + public void testMvnFileLongOption() throws Exception { + runCoreExtensionWithOption("--file", null); } /** @@ -57,10 +50,8 @@ public class MavenITmng5889FindBasedir * @throws Exception in case of failure */ @Test - public void testMvnFileShortOption() - throws Exception - { - runCoreExtensionWithOption( "-f", null ); + public void testMvnFileShortOption() throws Exception { + runCoreExtensionWithOption("-f", null); } /** @@ -69,10 +60,8 @@ public class MavenITmng5889FindBasedir * @throws Exception in case of failure */ @Test - public void testMvnFileLongOptionModule() - throws Exception - { - runCoreExtensionWithOption( "--file", "module" ); + public void testMvnFileLongOptionModule() throws Exception { + runCoreExtensionWithOption("--file", "module"); } /** @@ -81,44 +70,39 @@ public class MavenITmng5889FindBasedir * @throws Exception in case of failure */ @Test - public void testMvnFileShortOptionModule() - throws Exception - { - runCoreExtensionWithOption( "-f", "module" ); + public void testMvnFileShortOptionModule() throws Exception { + runCoreExtensionWithOption("-f", "module"); } - private void runCoreExtensionWithOption( String option, String subdir ) - throws Exception - { - runCoreExtensionWithOption( option, subdir, true ); + private void runCoreExtensionWithOption(String option, String subdir) throws Exception { + runCoreExtensionWithOption(option, subdir, true); } - protected void runCoreExtensionWithOption( String option, String subdir, boolean pom ) - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5889-find.mvn" ); + protected void runCoreExtensionWithOption(String option, String subdir, boolean pom) throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5889-find.mvn"); - File basedir = new File( testDir, "../mng-" + ( pom ? "5889" : "6223" ) + "-find.mvn" + option + ( pom ? "Pom" : "Dir" ) ); + File basedir = + new File(testDir, "../mng-" + (pom ? "5889" : "6223") + "-find.mvn" + option + (pom ? "Pom" : "Dir")); basedir.mkdir(); - if ( subdir != null ) - { - testDir = new File( testDir, subdir ); - basedir = new File( basedir, subdir ); + if (subdir != null) { + testDir = new File(testDir, subdir); + basedir = new File(basedir, subdir); basedir.mkdirs(); } - Verifier verifier = newVerifier( basedir.getAbsolutePath() ); - verifier.addCliArgument( "-Dexpression.outputFile=" + new File( basedir, "expression.properties" ).getAbsolutePath() ); - verifier.addCliArgument( option ); // -f/--file client/pom.xml - verifier.addCliArgument( ( pom ? new File( testDir, "pom.xml" ) : testDir ).getAbsolutePath() ); - verifier.setForkJvm( true ); // force forked JVM since we need the shell script to detect .mvn/ location - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(basedir.getAbsolutePath()); + verifier.addCliArgument( + "-Dexpression.outputFile=" + new File(basedir, "expression.properties").getAbsolutePath()); + verifier.addCliArgument(option); // -f/--file client/pom.xml + verifier.addCliArgument((pom ? new File(testDir, "pom.xml") : testDir).getAbsolutePath()); + verifier.setForkJvm(true); // force forked JVM since we need the shell script to detect .mvn/ location + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "expression.properties" ); - assertEquals( "ok", props.getProperty( "project.properties.jvm-config" ) ); - assertEquals( "ok", props.getProperty( "project.properties.maven-config" ) ); + Properties props = verifier.loadProperties("expression.properties"); + assertEquals("ok", props.getProperty("project.properties.jvm-config")); + assertEquals("ok", props.getProperty("project.properties.maven-config")); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5895CIFriendlyUsageWithPropertyTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5895CIFriendlyUsageWithPropertyTest.java index 499add2c14..4b30fcb118 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5895CIFriendlyUsageWithPropertyTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5895CIFriendlyUsageWithPropertyTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -35,15 +33,12 @@ import org.junit.jupiter.api.Test; * * @author Karl Heinz Marbaise khmarbaise@apache.org */ -public class MavenITmng5895CIFriendlyUsageWithPropertyTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng5895CIFriendlyUsageWithPropertyTest extends AbstractMavenIntegrationTestCase { - public MavenITmng5895CIFriendlyUsageWithPropertyTest() - { + public MavenITmng5895CIFriendlyUsageWithPropertyTest() { // The first version which contains the fix for the MNG-issue. // TODO: Think about it! - super( "[3.5.0-alpha-2,)" ); + super("[3.5.0-alpha-2,)"); } /** @@ -54,43 +49,38 @@ public class MavenITmng5895CIFriendlyUsageWithPropertyTest * @throws Exception in case of failure */ @Test - public void testitShouldResolveTheDependenciesWithoutBuildConsumer() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5895-ci-friendly-usage-with-property" ); + public void testitShouldResolveTheDependenciesWithoutBuildConsumer() throws Exception { + File testDir = + ResourceExtractor.simpleExtractResources(getClass(), "/mng-5895-ci-friendly-usage-with-property"); - Verifier verifier = newVerifier( testDir.getAbsolutePath(), false ); - verifier.setAutoclean( false ); + Verifier verifier = newVerifier(testDir.getAbsolutePath(), false); + verifier.setAutoclean(false); - //verifier.setLogFileName( "log-only.txt" ); - verifier.addCliArgument( "-Drevision=1.2" ); - verifier.addCliArgument( "-Dmaven.experimental.buildconsumer=false" ); - verifier.addCliArgument( "clean" ); + // verifier.setLogFileName( "log-only.txt" ); + verifier.addCliArgument("-Drevision=1.2"); + verifier.addCliArgument("-Dmaven.experimental.buildconsumer=false"); + verifier.addCliArgument("clean"); verifier.execute(); - verifier.addCliArgument( "package" ); + verifier.addCliArgument("package"); verifier.execute(); verifier.verifyErrorFreeLog(); - } @Test - public void testitShouldResolveTheDependenciesWithBuildConsumer() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5895-ci-friendly-usage-with-property" ); + public void testitShouldResolveTheDependenciesWithBuildConsumer() throws Exception { + File testDir = + ResourceExtractor.simpleExtractResources(getClass(), "/mng-5895-ci-friendly-usage-with-property"); - Verifier verifier = newVerifier( testDir.getAbsolutePath(), false ); - verifier.setAutoclean( false ); + Verifier verifier = newVerifier(testDir.getAbsolutePath(), false); + verifier.setAutoclean(false); - verifier.setLogFileName( "log-bc.txt" ); - verifier.addCliArgument( "-Drevision=1.2" ); - verifier.addCliArgument( "-Dmaven.experimental.buildconsumer=true" ); - verifier.addCliArgument( "clean" ); + verifier.setLogFileName("log-bc.txt"); + verifier.addCliArgument("-Drevision=1.2"); + verifier.addCliArgument("-Dmaven.experimental.buildconsumer=true"); + verifier.addCliArgument("clean"); verifier.execute(); - verifier.addCliArgument( "package" ); + verifier.addCliArgument("package"); verifier.execute(); verifier.verifyErrorFreeLog(); - } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5898BuildMultimoduleWithEARFailsToResolveWARTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5898BuildMultimoduleWithEARFailsToResolveWARTest.java index 7abe5eb1e8..d77639c473 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5898BuildMultimoduleWithEARFailsToResolveWARTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5898BuildMultimoduleWithEARFailsToResolveWARTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,13 +29,10 @@ import org.junit.jupiter.api.Test; * * @author Karl Heinz Marbaise */ -public class MavenITmng5898BuildMultimoduleWithEARFailsToResolveWARTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng5898BuildMultimoduleWithEARFailsToResolveWARTest extends AbstractMavenIntegrationTestCase { - public MavenITmng5898BuildMultimoduleWithEARFailsToResolveWARTest() - { - super( "[3.1,)" ); + public MavenITmng5898BuildMultimoduleWithEARFailsToResolveWARTest() { + super("[3.1,)"); } /** @@ -45,17 +40,14 @@ public class MavenITmng5898BuildMultimoduleWithEARFailsToResolveWARTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5898" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5898"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "test" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("test"); verifier.execute(); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5935OptionalLostInTranstiveManagedDependenciesTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5935OptionalLostInTranstiveManagedDependenciesTest.java index e523cb175c..f8d4ed7bd1 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5935OptionalLostInTranstiveManagedDependenciesTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5935OptionalLostInTranstiveManagedDependenciesTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,48 +16,43 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** * This is a test set for MNG-5935. * */ -public class MavenITmng5935OptionalLostInTranstiveManagedDependenciesTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng5935OptionalLostInTranstiveManagedDependenciesTest extends AbstractMavenIntegrationTestCase { - public MavenITmng5935OptionalLostInTranstiveManagedDependenciesTest() - { - super( "[3.5.1,)" ); + public MavenITmng5935OptionalLostInTranstiveManagedDependenciesTest() { + super("[3.5.1,)"); } @Test - public void testitMNG5935() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5935-optional-lost-in-transtive-managed-dependencies" ); + public void testitMNG5935() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources( + getClass(), "/mng-5935-optional-lost-in-transtive-managed-dependencies"); - Verifier verifier = newVerifier( testDir.getAbsolutePath(), "remote" ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath(), "remote"); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List dependencies = verifier.loadLines( "target/dependencies.txt", "UTF-8" ); - assertEquals( 5, dependencies.size() ); - assertEquals( "com.mysema.querydsl:querydsl-core:jar:3.4.3 (optional)", dependencies.get( 0 ) ); - assertEquals( "com.google.guava:guava:jar:17.0 (optional)", dependencies.get( 1 ) ); - assertEquals( "com.google.code.findbugs:jsr305:jar:2.0.3 (optional)", dependencies.get( 2 ) ); - assertEquals( "com.mysema.commons:mysema-commons-lang:jar:0.2.4 (optional)", dependencies.get( 3 ) ); - assertEquals( "com.infradna.tool:bridge-method-annotation:jar:1.13 (optional)", dependencies.get( 4 ) ); + List dependencies = verifier.loadLines("target/dependencies.txt", "UTF-8"); + assertEquals(5, dependencies.size()); + assertEquals("com.mysema.querydsl:querydsl-core:jar:3.4.3 (optional)", dependencies.get(0)); + assertEquals("com.google.guava:guava:jar:17.0 (optional)", dependencies.get(1)); + assertEquals("com.google.code.findbugs:jsr305:jar:2.0.3 (optional)", dependencies.get(2)); + assertEquals("com.mysema.commons:mysema-commons-lang:jar:0.2.4 (optional)", dependencies.get(3)); + assertEquals("com.infradna.tool:bridge-method-annotation:jar:1.13 (optional)", dependencies.get(4)); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5958LifecyclePhaseBinaryCompat.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5958LifecyclePhaseBinaryCompat.java index 963de36692..4fe4d5a388 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5958LifecyclePhaseBinaryCompat.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5958LifecyclePhaseBinaryCompat.java @@ -1,53 +1,60 @@ +/* + * 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.it; -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; - import java.io.File; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; -public class MavenITmng5958LifecyclePhaseBinaryCompat - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng5958LifecyclePhaseBinaryCompat extends AbstractMavenIntegrationTestCase { - public MavenITmng5958LifecyclePhaseBinaryCompat() - { - super( "(3.3.9,)" ); + public MavenITmng5958LifecyclePhaseBinaryCompat() { + super("(3.3.9,)"); } @Test - public void testGood() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5958-lifecycle-phases/good" ); + public void testGood() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5958-lifecycle-phases/good"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyTextInLog( "CLASS_NAME=java.lang.String" ); + verifier.verifyTextInLog("CLASS_NAME=java.lang.String"); } @Test - public void testBad() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5958-lifecycle-phases/bad" ); + public void testBad() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5958-lifecycle-phases/bad"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - try - { - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + try { + verifier.addCliArgument("validate"); verifier.execute(); - } - catch ( VerificationException e ) - { + } catch (VerificationException e) { // There is no good way to test for Java 9+ in Verifier in order to add 'java.base/' to the string. // Java 11: Internal error: java.lang.ClassCastException: class org.apache.maven.. - verifier.verifyTextInLog( "[ERROR] Internal error: java.lang.ClassCastException: " ); - verifier.verifyTextInLog( "org.apache.maven.lifecycle.mapping.LifecyclePhase cannot be cast to " ); + verifier.verifyTextInLog("[ERROR] Internal error: java.lang.ClassCastException: "); + verifier.verifyTextInLog("org.apache.maven.lifecycle.mapping.LifecyclePhase cannot be cast to "); } } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5965ParallelBuildMultipliesWorkTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5965ParallelBuildMultipliesWorkTest.java index 2c3f91191f..08334206c7 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5965ParallelBuildMultipliesWorkTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5965ParallelBuildMultipliesWorkTest.java @@ -1,83 +1,85 @@ +/* + * 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.it; -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; - import java.io.File; import java.util.ArrayList; -import java.util.Arrays; import java.util.LinkedHashSet; import java.util.List; import java.util.Set; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** * Test set for MNG-5965. */ -public class MavenITmng5965ParallelBuildMultipliesWorkTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng5965ParallelBuildMultipliesWorkTest() - { - super( "[3.6.1,)" ); +public class MavenITmng5965ParallelBuildMultipliesWorkTest extends AbstractMavenIntegrationTestCase { + public MavenITmng5965ParallelBuildMultipliesWorkTest() { + super("[3.6.1,)"); } @Test - public void testItShouldOnlyRunEachTaskOnce() - throws Exception - { - File testDir = - ResourceExtractor.simpleExtractResources( getClass(), "/mng-5965-parallel-build-multiplies-work" ); + public void testItShouldOnlyRunEachTaskOnce() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5965-parallel-build-multiplies-work"); - Verifier verifier = newVerifier( testDir.getAbsolutePath(), false ); - verifier.setAutoclean( false ); + Verifier verifier = newVerifier(testDir.getAbsolutePath(), false); + verifier.setAutoclean(false); - verifier.setLogFileName( "log-only.txt" ); - verifier.addCliArgument( "-T1" ); + verifier.setLogFileName("log-only.txt"); + verifier.addCliArgument("-T1"); // include an aggregator task so that the two goals end up in different task segments - verifier.addCliArguments( "clean", "install:help" ); + verifier.addCliArguments("clean", "install:help"); verifier.execute(); verifier.verifyErrorFreeLog(); - List logLines = verifier.loadLines( "log-only.txt", "UTF-8" ); + List logLines = verifier.loadLines("log-only.txt", "UTF-8"); - List cleanGoalsExecuted = findCleanExecutions( logLines ); + List cleanGoalsExecuted = findCleanExecutions(logLines); // clean only executed once per module - assertNoRepeatedLines( cleanGoalsExecuted ); + assertNoRepeatedLines(cleanGoalsExecuted); // clean executed in the 3 modules - assertEquals( cleanGoalsExecuted.size(), 3 ); + assertEquals(cleanGoalsExecuted.size(), 3); } - private void assertNoRepeatedLines( List logLines ) - throws VerificationException - { + private void assertNoRepeatedLines(List logLines) throws VerificationException { Set uniqueLines = new LinkedHashSet<>(); - for ( String line : logLines ) - { - if ( uniqueLines.contains( line ) ) - { - throw new VerificationException( "Goal executed twice: " + line ); + for (String line : logLines) { + if (uniqueLines.contains(line)) { + throw new VerificationException("Goal executed twice: " + line); } - uniqueLines.add( line ); + uniqueLines.add(line); } } - private List findCleanExecutions( List fullLog ) - { + private List findCleanExecutions(List fullLog) { List cleanExecutions = new ArrayList<>(); - for ( String line : fullLog ) - { - if ( line.contains( "(default-clean)" ) ) - { - cleanExecutions.add( line ); + for (String line : fullLog) { + if (line.contains("(default-clean)")) { + cleanExecutions.add(line); } } return cleanExecutions; } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6057CheckReactorOrderTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6057CheckReactorOrderTest.java index c0a2445a6e..5ba8a40572 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6057CheckReactorOrderTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6057CheckReactorOrderTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.LinkedList; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -35,15 +33,12 @@ import org.junit.jupiter.api.Test; * * @author Karl Heinz Marbaise khmarbaise@apache.org */ -public class MavenITmng6057CheckReactorOrderTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng6057CheckReactorOrderTest extends AbstractMavenIntegrationTestCase { - public MavenITmng6057CheckReactorOrderTest() - { + public MavenITmng6057CheckReactorOrderTest() { // The first version which contains the fix for the MNG-6057 issue. // TODO: Think about it! - super( "[3.5.0-alpha-2,)" ); + super("[3.5.0-alpha-2,)"); } /** @@ -52,30 +47,28 @@ public class MavenITmng6057CheckReactorOrderTest * @throws Exception in case of failure */ @Test - public void testitReactorShouldResultInExpectedOrder() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6057-check-reactor-order" ); + public void testitReactorShouldResultInExpectedOrder() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-6057-check-reactor-order"); - Verifier verifier = newVerifier( testDir.getAbsolutePath(), false ); - verifier.setAutoclean( false ); + Verifier verifier = newVerifier(testDir.getAbsolutePath(), false); + verifier.setAutoclean(false); - verifier.setLogFileName( "log-only.txt" ); - verifier.addCliArgument( "-Drevision=1.3.0-SNAPSHOT" ); - verifier.addCliArgument( "clean" ); + verifier.setLogFileName("log-only.txt"); + verifier.addCliArgument("-Drevision=1.3.0-SNAPSHOT"); + verifier.addCliArgument("clean"); verifier.execute(); verifier.verifyErrorFreeLog(); - List loadedLines = verifier.loadLines( "log-only.txt", "UTF-8" ); - List resultingLines = extractReactorBuildOrder( loadedLines ); + List loadedLines = verifier.loadLines("log-only.txt", "UTF-8"); + List resultingLines = extractReactorBuildOrder(loadedLines); // We're expecting exactly three lines as result. - assertEquals( 3, resultingLines.size() ); + assertEquals(3, resultingLines.size()); // We expect those lines in the following exact order. - assertTrue( resultingLines.get( 0 ).startsWith( "[INFO] base-project" ) ); - assertTrue( resultingLines.get( 1 ).startsWith( "[INFO] module-1" ) ); - assertTrue( resultingLines.get( 2 ).startsWith( "[INFO] module-2" ) ); + assertTrue(resultingLines.get(0).startsWith("[INFO] base-project")); + assertTrue(resultingLines.get(1).startsWith("[INFO] module-1")); + assertTrue(resultingLines.get(2).startsWith("[INFO] module-2")); } /** @@ -90,34 +83,22 @@ public class MavenITmng6057CheckReactorOrderTest * [INFO] * */ - private List extractReactorBuildOrder( List loadedLines ) - { + private List extractReactorBuildOrder(List loadedLines) { List resultingLines = new LinkedList(); boolean start = false; - for ( String line : loadedLines ) - { - if ( start ) - { - if ( line.startsWith( "[INFO] -------------" ) ) - { + for (String line : loadedLines) { + if (start) { + if (line.startsWith("[INFO] -------------")) { start = false; + } else if (!line.endsWith("[INFO] ")) { + resultingLines.add(line); } - else if ( !line.endsWith( "[INFO] " ) ) - { - resultingLines.add( line ); - } - } - else - { - if ( line.startsWith( "[INFO] Reactor Build Order:" ) ) - { + } else { + if (line.startsWith("[INFO] Reactor Build Order:")) { start = true; } - } } return resultingLines; - } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6065FailOnSeverityTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6065FailOnSeverityTest.java index 9e9c2fdfb3..141d220e5e 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6065FailOnSeverityTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6065FailOnSeverityTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -34,57 +32,47 @@ import org.junit.jupiter.api.Test; * MNG-6065. * */ -public class MavenITmng6065FailOnSeverityTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng6065FailOnSeverityTest extends AbstractMavenIntegrationTestCase { - public MavenITmng6065FailOnSeverityTest() - { - super( "[4.0.0-alpha-1,)" ); + public MavenITmng6065FailOnSeverityTest() { + super("[4.0.0-alpha-1,)"); } @Test - public void testItShouldFailOnWarnLogMessages() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6065-fail-on-severity" ); + public void testItShouldFailOnWarnLogMessages() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-6065-fail-on-severity"); - Verifier verifier = newVerifier( testDir.getAbsolutePath(), false ); - verifier.setForkJvm( true ); - verifier.addCliArgument( "--fail-on-severity" ); - verifier.addCliArgument( "WARN" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath(), false); + verifier.setForkJvm(true); + verifier.addCliArgument("--fail-on-severity"); + verifier.addCliArgument("WARN"); boolean failed = false; - try - { - verifier.addCliArgument( "compile" ); + try { + verifier.addCliArgument("compile"); verifier.execute(); - } - catch ( VerificationException e ) - { + } catch (VerificationException e) { failed = true; - verifier.verifyTextInLog( "Enabled to break the build on log level WARN." ); - verifier.verifyTextInLog( "Build failed due to log statements with a higher severity than allowed." ); + verifier.verifyTextInLog("Enabled to break the build on log level WARN."); + verifier.verifyTextInLog("Build failed due to log statements with a higher severity than allowed."); } - assertTrue( "Build should have failed", failed ); + assertTrue("Build should have failed", failed); } @Test - public void testItShouldSucceedOnWarnLogMessagesWhenFailLevelIsError() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6065-fail-on-severity" ); + public void testItShouldSucceedOnWarnLogMessagesWhenFailLevelIsError() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-6065-fail-on-severity"); - Verifier verifier = newVerifier( testDir.getAbsolutePath(), false ); - verifier.setForkJvm( true ); - verifier.addCliArgument( "--fail-on-severity" ); - verifier.addCliArgument( "ERROR" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath(), false); + verifier.setForkJvm(true); + verifier.addCliArgument("--fail-on-severity"); + verifier.addCliArgument("ERROR"); - verifier.addCliArgument( "compile" ); + verifier.addCliArgument("compile"); verifier.execute(); - verifier.verifyTextInLog( "Enabled to break the build on log level ERROR." ); + verifier.verifyTextInLog("Enabled to break the build on log level ERROR."); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6071GetResourceWithCustomPom.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6071GetResourceWithCustomPom.java index a45ce02cbf..e930edfff0 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6071GetResourceWithCustomPom.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6071GetResourceWithCustomPom.java @@ -1,22 +1,36 @@ +/* + * 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.it; -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; - import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** * This is a test set for MNG-6071: * check that getClass().getResource("/") returns consistent results when Maven is run with -f ./pom.xml. */ -public class MavenITmng6071GetResourceWithCustomPom - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng6071GetResourceWithCustomPom() - { - super( "[3.8.2,)" ); +public class MavenITmng6071GetResourceWithCustomPom extends AbstractMavenIntegrationTestCase { + public MavenITmng6071GetResourceWithCustomPom() { + super("[3.8.2,)"); } /** @@ -25,16 +39,14 @@ public class MavenITmng6071GetResourceWithCustomPom * @throws Exception in case of failure */ @Test - public void testRunCustomPomWithDot( ) - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6071" ); + public void testRunCustomPomWithDot() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-6071"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.addCliArgument( "-f" ); - verifier.addCliArgument( "./pom.xml" ); - verifier.setForkJvm( true ); - verifier.addCliArgument( "verify" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.addCliArgument("-f"); + verifier.addCliArgument("./pom.xml"); + verifier.setForkJvm(true); + verifier.addCliArgument("verify"); verifier.execute(); verifier.verifyErrorFreeLog(); } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6084Jsr250PluginTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6084Jsr250PluginTest.java index 8f605381ad..07d788685a 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6084Jsr250PluginTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6084Jsr250PluginTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,61 +16,52 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; /** * This is a test set for MNG-6084. */ -public class MavenITmng6084Jsr250PluginTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng6084Jsr250PluginTest extends AbstractMavenIntegrationTestCase { private File testDir; - public MavenITmng6084Jsr250PluginTest() - { - super( "[3.5.1,)" ); + public MavenITmng6084Jsr250PluginTest() { + super("[3.5.1,)"); } @BeforeEach - public void setUp() - throws Exception - { - testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6084-jsr250-support" ); + public void setUp() throws Exception { + testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-6084-jsr250-support"); } @Test - public void testJsr250PluginExecution() - throws Exception - { + public void testJsr250PluginExecution() throws Exception { // // Build a plugin that uses JSR 250 annotations // - Verifier v0 = newVerifier( testDir.getAbsolutePath(), "remote" ); - v0.setAutoclean( false ); - v0.deleteDirectory( "target" ); - v0.deleteArtifacts( "org.apache.maven.its.mng6084" ); - v0.addCliArgument( "install" ); + Verifier v0 = newVerifier(testDir.getAbsolutePath(), "remote"); + v0.setAutoclean(false); + v0.deleteDirectory("target"); + v0.deleteArtifacts("org.apache.maven.its.mng6084"); + v0.addCliArgument("install"); v0.execute(); v0.verifyErrorFreeLog(); // // Execute the JSR 250 plugin // - Verifier v1 = newVerifier( testDir.getAbsolutePath(), "remote" ); - v1.setAutoclean( false ); - v1.addCliArgument( "org.apache.maven.its.mng6084:jsr250-maven-plugin:0.0.1-SNAPSHOT:hello" ); + Verifier v1 = newVerifier(testDir.getAbsolutePath(), "remote"); + v1.setAutoclean(false); + v1.addCliArgument("org.apache.maven.its.mng6084:jsr250-maven-plugin:0.0.1-SNAPSHOT:hello"); v1.execute(); v1.verifyErrorFreeLog(); - v1.verifyTextInLog( "Hello! I am a component using JSR 250 with @PostConstruct support" ); - + v1.verifyTextInLog("Hello! I am a component using JSR 250 with @PostConstruct support"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6090CIFriendlyTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6090CIFriendlyTest.java index d278f045dd..72bd50eeb0 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6090CIFriendlyTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6090CIFriendlyTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; -import java.util.Arrays; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -35,15 +32,12 @@ import org.junit.jupiter.api.Test; * * @author Karl Heinz Marbaise khmarbaise@apache.org */ -public class MavenITmng6090CIFriendlyTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng6090CIFriendlyTest extends AbstractMavenIntegrationTestCase { - public MavenITmng6090CIFriendlyTest() - { + public MavenITmng6090CIFriendlyTest() { // The first version which contains the fix for the MNG-issue. // TODO: Think about it! - super( "[3.5.0-alpha-2,)" ); + super("[3.5.0-alpha-2,)"); } /** @@ -55,59 +49,54 @@ public class MavenITmng6090CIFriendlyTest * @throws Exception in case of failure */ @Test - public void testitShouldResolveTheDependenciesWithoutBuildConsumer() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6090-ci-friendly" ); + public void testitShouldResolveTheDependenciesWithoutBuildConsumer() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-6090-ci-friendly"); - Verifier verifier = newVerifier( testDir.getAbsolutePath(), false ); - verifier.setAutoclean( false ); + Verifier verifier = newVerifier(testDir.getAbsolutePath(), false); + verifier.setAutoclean(false); - verifier.addCliArgument( "-Drevision=1.2" ); - verifier.addCliArgument( "-Dmaven.experimental.buildconsumer=false" ); - verifier.setLogFileName( "install-log.txt" ); - verifier.addCliArguments( "clean", "install" ); + verifier.addCliArgument("-Drevision=1.2"); + verifier.addCliArgument("-Dmaven.experimental.buildconsumer=false"); + verifier.setLogFileName("install-log.txt"); + verifier.addCliArguments("clean", "install"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier = newVerifier( testDir.getAbsolutePath(), false ); - verifier.setAutoclean( false ); + verifier = newVerifier(testDir.getAbsolutePath(), false); + verifier.setAutoclean(false); - verifier.addCliArgument( "-Drevision=1.2" ); - verifier.addCliArgument( "-pl" ); - verifier.addCliArgument( "module-3" ); - verifier.addCliArgument( "package" ); + verifier.addCliArgument("-Drevision=1.2"); + verifier.addCliArgument("-pl"); + verifier.addCliArgument("module-3"); + verifier.addCliArgument("package"); verifier.execute(); verifier.verifyErrorFreeLog(); } @Test - public void testitShouldResolveTheDependenciesWithBuildConsumer() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6090-ci-friendly" ); + public void testitShouldResolveTheDependenciesWithBuildConsumer() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-6090-ci-friendly"); - Verifier verifier = newVerifier( testDir.getAbsolutePath(), false ); - verifier.setAutoclean( false ); + Verifier verifier = newVerifier(testDir.getAbsolutePath(), false); + verifier.setAutoclean(false); verifier.setForkJvm(true); - verifier.addCliArgument( "-Drevision=1.2" ); - verifier.addCliArgument( "-Dmaven.experimental.buildconsumer=true" ); - verifier.setLogFileName( "install-log.txt" ); - verifier.addCliArguments( "clean", "install" ); + verifier.addCliArgument("-Drevision=1.2"); + verifier.addCliArgument("-Dmaven.experimental.buildconsumer=true"); + verifier.setLogFileName("install-log.txt"); + verifier.addCliArguments("clean", "install"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier = newVerifier( testDir.getAbsolutePath(), false ); - verifier.setAutoclean( false ); + verifier = newVerifier(testDir.getAbsolutePath(), false); + verifier.setAutoclean(false); verifier.setForkJvm(true); - verifier.addCliArgument( "-Drevision=1.2" ); - verifier.addCliArgument( "-pl" ); - verifier.addCliArgument( "module-3" ); - verifier.addCliArgument( "package" ); + verifier.addCliArgument("-Drevision=1.2"); + verifier.addCliArgument("-pl"); + verifier.addCliArgument("module-3"); + verifier.addCliArgument("package"); verifier.execute(); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6118SubmoduleInvocation.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6118SubmoduleInvocation.java index 85de17dbb4..c1d7ce8677 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6118SubmoduleInvocation.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6118SubmoduleInvocation.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.io.IOException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -40,15 +38,13 @@ import org.junit.jupiter.api.Test; * @author Maarten Mulders * @author Martin Kanters */ -public class MavenITmng6118SubmoduleInvocation extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng6118SubmoduleInvocation extends AbstractMavenIntegrationTestCase { private static final String RESOURCE_PATH = "/mng-6118-submodule-invocation-full-reactor"; private final File testDir; - public MavenITmng6118SubmoduleInvocation() throws IOException - { - super( "[4.0.0-alpha-1,)" ); - testDir = ResourceExtractor.simpleExtractResources( getClass(), RESOURCE_PATH ); + public MavenITmng6118SubmoduleInvocation() throws IOException { + super("[4.0.0-alpha-1,)"); + testDir = ResourceExtractor.simpleExtractResources(getClass(), RESOURCE_PATH); } /** @@ -57,18 +53,17 @@ public class MavenITmng6118SubmoduleInvocation extends AbstractMavenIntegrationT * @throws Exception in case of failure */ @Test - public void testInSubModule() throws Exception - { + public void testInSubModule() throws Exception { // Compile the whole project first. - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.addCliArgument( "package" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.addCliArgument("package"); verifier.execute(); - final File submoduleDirectory = new File( testDir, "app" ); - verifier = newVerifier( submoduleDirectory.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.setLogFileName( "log-insubmodule.txt" ); - verifier.addCliArgument( "compile" ); + final File submoduleDirectory = new File(testDir, "app"); + verifier = newVerifier(submoduleDirectory.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.setLogFileName("log-insubmodule.txt"); + verifier.addCliArgument("compile"); verifier.execute(); } @@ -78,19 +73,18 @@ public class MavenITmng6118SubmoduleInvocation extends AbstractMavenIntegrationT * @throws Exception in case of failure */ @Test - public void testWithFile() throws Exception - { + public void testWithFile() throws Exception { // Compile the whole project first. - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.addCliArgument( "package" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.addCliArgument("package"); verifier.execute(); - verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.setLogFileName( "log-withfile.txt" ); - verifier.addCliArgument( "-f" ); - verifier.addCliArgument( "app/pom.xml" ); - verifier.addCliArgument( "compile" ); + verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.setLogFileName("log-withfile.txt"); + verifier.addCliArgument("-f"); + verifier.addCliArgument("app/pom.xml"); + verifier.addCliArgument("compile"); verifier.execute(); } @@ -100,16 +94,15 @@ public class MavenITmng6118SubmoduleInvocation extends AbstractMavenIntegrationT * @throws Exception in case of failure */ @Test - public void testWithFileAndAlsoMake() throws Exception - { - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.addCliArgument( "-am" ); - verifier.addCliArgument( "-f" ); - verifier.addCliArgument( "app/pom.xml" ); - verifier.setLogFileName( "log-withfilealsomake.txt" ); - verifier.addCliArgument( "compile" ); + public void testWithFileAndAlsoMake() throws Exception { + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.addCliArgument("-am"); + verifier.addCliArgument("-f"); + verifier.addCliArgument("app/pom.xml"); + verifier.setLogFileName("log-withfilealsomake.txt"); + verifier.addCliArgument("compile"); verifier.execute(); - verifier.verifyTextInLog( "Building Maven Integration Test :: MNG-6118 :: Library 1.0" ); + verifier.verifyTextInLog("Building Maven Integration Test :: MNG-6118 :: Library 1.0"); } /** @@ -118,14 +111,13 @@ public class MavenITmng6118SubmoduleInvocation extends AbstractMavenIntegrationT * @throws Exception in case of failure */ @Test - public void testInSubModuleWithAlsoMake() throws Exception - { - File submoduleDirectory = new File( testDir, "app" ); - Verifier verifier = newVerifier( submoduleDirectory.getAbsolutePath() ); - verifier.addCliArgument( "-am" ); - verifier.setLogFileName( "log-insubmodulealsomake.txt" ); - verifier.addCliArgument( "compile" ); + public void testInSubModuleWithAlsoMake() throws Exception { + File submoduleDirectory = new File(testDir, "app"); + Verifier verifier = newVerifier(submoduleDirectory.getAbsolutePath()); + verifier.addCliArgument("-am"); + verifier.setLogFileName("log-insubmodulealsomake.txt"); + verifier.addCliArgument("compile"); verifier.execute(); - verifier.verifyTextInLog( "Building Maven Integration Test :: MNG-6118 :: Library 1.0" ); + verifier.verifyTextInLog("Building Maven Integration Test :: MNG-6118 :: Library 1.0"); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6127PluginExecutionConfigurationInterferenceTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6127PluginExecutionConfigurationInterferenceTest.java index 88250d5145..0b804e3573 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6127PluginExecutionConfigurationInterferenceTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6127PluginExecutionConfigurationInterferenceTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,68 +16,62 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import org.apache.maven.shared.utils.io.FileUtils; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; -public class MavenITmng6127PluginExecutionConfigurationInterferenceTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng6127PluginExecutionConfigurationInterferenceTest extends AbstractMavenIntegrationTestCase { - public MavenITmng6127PluginExecutionConfigurationInterferenceTest() - { - super( "[3.5.1,)" ); + public MavenITmng6127PluginExecutionConfigurationInterferenceTest() { + super("[3.5.1,)"); } @Test - public void testCustomMojoExecutionConfigurator() - throws Exception - { - File testDir = - ResourceExtractor.simpleExtractResources( getClass(), - "/mng-6127-plugin-execution-configuration-interference" ); - File pluginDir = new File( testDir, "plugin" ); - File projectDir = new File( testDir, "project" ); - File modAprojectDir = new File( projectDir, "mod-a" ); - File modBprojectDir = new File( projectDir, "mod-b" ); - File modCprojectDir = new File( projectDir, "mod-c" ); + public void testCustomMojoExecutionConfigurator() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources( + getClass(), "/mng-6127-plugin-execution-configuration-interference"); + File pluginDir = new File(testDir, "plugin"); + File projectDir = new File(testDir, "project"); + File modAprojectDir = new File(projectDir, "mod-a"); + File modBprojectDir = new File(projectDir, "mod-b"); + File modCprojectDir = new File(projectDir, "mod-c"); Verifier verifier; // install the test plugin - verifier = newVerifier( pluginDir.getAbsolutePath(), "remote" ); - verifier.addCliArgument( "install" ); + verifier = newVerifier(pluginDir.getAbsolutePath(), "remote"); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); - File modAconfigurationFile = new File( modAprojectDir, "configuration.txt" ); - File modBconfigurationFile = new File( modBprojectDir, "configuration.txt" ); - File modCconfigurationFile = new File( modCprojectDir, "configuration.txt" ); + File modAconfigurationFile = new File(modAprojectDir, "configuration.txt"); + File modBconfigurationFile = new File(modBprojectDir, "configuration.txt"); + File modCconfigurationFile = new File(modCprojectDir, "configuration.txt"); modAconfigurationFile.delete(); modBconfigurationFile.delete(); modCconfigurationFile.delete(); // build the test project - verifier = newVerifier( projectDir.getAbsolutePath(), "remote" ); - verifier.addCliArgument( "verify" ); + verifier = newVerifier(projectDir.getAbsolutePath(), "remote"); + verifier.addCliArgument("verify"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( modAconfigurationFile.getCanonicalPath() ); - String modAactual = FileUtils.fileRead( modAconfigurationFile ); - assertEquals( "name=mod-a, secondName=second from components.xml", modAactual ); + verifier.verifyFilePresent(modAconfigurationFile.getCanonicalPath()); + String modAactual = FileUtils.fileRead(modAconfigurationFile); + assertEquals("name=mod-a, secondName=second from components.xml", modAactual); - verifier.verifyFilePresent( modBconfigurationFile.getCanonicalPath() ); - String modBactual = FileUtils.fileRead( modBconfigurationFile ); - assertEquals( "name=mod-b, secondName=second from components.xml", modBactual ); + verifier.verifyFilePresent(modBconfigurationFile.getCanonicalPath()); + String modBactual = FileUtils.fileRead(modBconfigurationFile); + assertEquals("name=mod-b, secondName=second from components.xml", modBactual); - verifier.verifyFilePresent( modCconfigurationFile.getCanonicalPath() ); - String modCactual = FileUtils.fileRead( modCconfigurationFile ); - assertEquals( "secondName=second from components.xml", modCactual ); + verifier.verifyFilePresent(modCconfigurationFile.getCanonicalPath()); + String modCactual = FileUtils.fileRead(modCconfigurationFile); + assertEquals("secondName=second from components.xml", modCactual); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6173GetAllProjectsInReactorTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6173GetAllProjectsInReactorTest.java index a8959b3e9f..474129f09d 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6173GetAllProjectsInReactorTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6173GetAllProjectsInReactorTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,9 +16,7 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.ArrayList; @@ -29,18 +25,17 @@ import java.util.Collections; import java.util.List; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** * Test case for MNG-6173. */ -public class MavenITmng6173GetAllProjectsInReactorTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng6173GetAllProjectsInReactorTest extends AbstractMavenIntegrationTestCase { - public MavenITmng6173GetAllProjectsInReactorTest() - { - super( "[3.2.1,3.3.1),[3.5.0-alpha-2,)" ); + public MavenITmng6173GetAllProjectsInReactorTest() { + super("[3.2.1,3.3.1),[3.5.0-alpha-2,)"); } /** @@ -50,45 +45,38 @@ public class MavenITmng6173GetAllProjectsInReactorTest * @throws Exception in case of failure */ @Test - public void testitShouldReturnAllProjectsInReactor() - throws Exception - { + public void testitShouldReturnAllProjectsInReactor() throws Exception { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6173-get-all-projects-in-reactor" ); + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-6173-get-all-projects-in-reactor"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteDirectory( "module-1/target" ); - verifier.deleteDirectory( "module-2/target" ); - verifier.addCliArgument( "-pl" ); - verifier.addCliArgument( "module-1" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteDirectory("module-1/target"); + verifier.deleteDirectory("module-2/target"); + verifier.addCliArgument("-pl"); + verifier.addCliArgument("module-1"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties properties = verifier.loadProperties( "module-1/target/session.properties" ); - assertEquals( "3", properties.getProperty( "session.allProjects.size" ) ); - assertEquals( Arrays.asList( new String[]{ "base-project", "module-1", "module-2" } ), - getProjects( properties ) ); + Properties properties = verifier.loadProperties("module-1/target/session.properties"); + assertEquals("3", properties.getProperty("session.allProjects.size")); + assertEquals(Arrays.asList(new String[] {"base-project", "module-1", "module-2"}), getProjects(properties)); } - private List getProjects(Properties properties ) - { + private List getProjects(Properties properties) { List projects = new ArrayList<>(); - for ( Object o : properties.keySet() ) - { + for (Object o : properties.keySet()) { String key = o.toString(); - if ( key.startsWith( "session.allProjects." ) && !key.endsWith( ".size" ) ) - { - projects.add( properties.getProperty( key ) ); + if (key.startsWith("session.allProjects.") && !key.endsWith(".size")) { + projects.add(properties.getProperty(key)); } } - Collections.sort( projects ); + Collections.sort(projects); return projects; } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6173GetProjectsAndDependencyGraphTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6173GetProjectsAndDependencyGraphTest.java index 6d43439747..c338b6d00a 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6173GetProjectsAndDependencyGraphTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6173GetProjectsAndDependencyGraphTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,25 +16,22 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** * Test case for MNG-6173. */ -public class MavenITmng6173GetProjectsAndDependencyGraphTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng6173GetProjectsAndDependencyGraphTest extends AbstractMavenIntegrationTestCase { - public MavenITmng6173GetProjectsAndDependencyGraphTest() - { - super( "[3.0-alpha-3,)" ); + public MavenITmng6173GetProjectsAndDependencyGraphTest() { + super("[3.0-alpha-3,)"); } /** @@ -46,30 +41,26 @@ public class MavenITmng6173GetProjectsAndDependencyGraphTest * @throws Exception in case of failure */ @Test - public void testitShouldReturnProjectsAndProjectDependencyGraph() - throws Exception - { + public void testitShouldReturnProjectsAndProjectDependencyGraph() throws Exception { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), - "/mng-6173-get-projects-and-dependency-graph" ); + File testDir = + ResourceExtractor.simpleExtractResources(getClass(), "/mng-6173-get-projects-and-dependency-graph"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteDirectory( "module-1/target" ); - verifier.deleteDirectory( "module-2/target" ); - verifier.addCliArgument( "-pl" ); - verifier.addCliArgument( "module-1" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteDirectory("module-1/target"); + verifier.deleteDirectory("module-2/target"); + verifier.addCliArgument("-pl"); + verifier.addCliArgument("module-1"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties properties = verifier.loadProperties( "module-1/target/session.properties" ); - assertEquals( "1", properties.getProperty( "session.projects.size" ) ); - assertEquals( "module-1", properties.getProperty( "session.projects.0.artifactId" ) ); - assertEquals( "1", properties.getProperty("session.projectDependencyGraph.sortedProjects.size" ) ); - assertEquals( "module-1", properties.getProperty( - "session.projectDependencyGraph.sortedProjects.0.artifactId" ) ); + Properties properties = verifier.loadProperties("module-1/target/session.properties"); + assertEquals("1", properties.getProperty("session.projects.size")); + assertEquals("module-1", properties.getProperty("session.projects.0.artifactId")); + assertEquals("1", properties.getProperty("session.projectDependencyGraph.sortedProjects.size")); + assertEquals("module-1", properties.getProperty("session.projectDependencyGraph.sortedProjects.0.artifactId")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6189SiteReportPluginsWarningTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6189SiteReportPluginsWarningTest.java index cdf52d7b88..a25cc6c853 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6189SiteReportPluginsWarningTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6189SiteReportPluginsWarningTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,27 +30,21 @@ import org.junit.jupiter.api.Test; * * @author Hervé Boutemy */ -public class MavenITmng6189SiteReportPluginsWarningTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng6189SiteReportPluginsWarningTest extends AbstractMavenIntegrationTestCase { - public MavenITmng6189SiteReportPluginsWarningTest() - { - super( "(3.5-alpha-1,4.0.0-alpha-2]" ); + public MavenITmng6189SiteReportPluginsWarningTest() { + super("(3.5-alpha-1,4.0.0-alpha-2]"); } @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6189-site-reportPlugins-warning" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-6189-site-reportPlugins-warning"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); - verifier.verifyTextInLog( "[WARNING] Reporting configuration should be done in section" ); + verifier.verifyTextInLog("[WARNING] Reporting configuration should be done in section"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6210CoreExtensionsCustomScopesTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6210CoreExtensionsCustomScopesTest.java index fb52bd5f81..075ba649e0 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6210CoreExtensionsCustomScopesTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6210CoreExtensionsCustomScopesTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,29 +30,24 @@ import org.junit.jupiter.api.Test; * {@code @MojoExecutionScoped} components contributed by .mvn/extensions.xml are * available to regular plugins. */ -public class MavenITmng6210CoreExtensionsCustomScopesTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng6210CoreExtensionsCustomScopesTest() - { - super( "(3.5.0,)" ); +public class MavenITmng6210CoreExtensionsCustomScopesTest extends AbstractMavenIntegrationTestCase { + public MavenITmng6210CoreExtensionsCustomScopesTest() { + super("(3.5.0,)"); } @Test - public void testCoreExtensionCustomScopes() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6210-core-extensions-scopes" ); + public void testCoreExtensionCustomScopes() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-6210-core-extensions-scopes"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); - verifier = newVerifier( new File( testDir, "client" ).getAbsolutePath() ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.it-core-extensions-custom-scopes" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( new File( testDir, "settings.xml" ).getAbsolutePath() ); - verifier.addCliArgument( "validate" ); + verifier = newVerifier(new File(testDir, "client").getAbsolutePath()); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.it-core-extensions-custom-scopes"); + verifier.addCliArgument("-s"); + verifier.addCliArgument(new File(testDir, "settings.xml").getAbsolutePath()); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6223FindBasedir.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6223FindBasedir.java index d25793bac2..2a43a3b4b9 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6223FindBasedir.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6223FindBasedir.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,12 +30,9 @@ import org.junit.jupiter.api.Test; * check that extensions in .mvn/ are found when Maven is run with -f path/to/dir. * @see MavenITmng5889FindBasedir */ -public class MavenITmng6223FindBasedir - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng6223FindBasedir() - { - super( "[3.5.1,)" ); +public class MavenITmng6223FindBasedir extends AbstractMavenIntegrationTestCase { + public MavenITmng6223FindBasedir() { + super("[3.5.1,)"); } /** @@ -46,10 +41,8 @@ public class MavenITmng6223FindBasedir * @throws Exception in case of failure */ @Test - public void testMvnFileLongOptionToDir() - throws Exception - { - runCoreExtensionWithOptionToDir( "--file", null ); + public void testMvnFileLongOptionToDir() throws Exception { + runCoreExtensionWithOptionToDir("--file", null); } /** @@ -58,10 +51,8 @@ public class MavenITmng6223FindBasedir * @throws Exception in case of failure */ @Test - public void testMvnFileShortOptionToDir() - throws Exception - { - runCoreExtensionWithOptionToDir( "-f", null ); + public void testMvnFileShortOptionToDir() throws Exception { + runCoreExtensionWithOptionToDir("-f", null); } /** @@ -70,10 +61,8 @@ public class MavenITmng6223FindBasedir * @throws Exception in case of failure */ @Test - public void testMvnFileLongOptionModuleToDir() - throws Exception - { - runCoreExtensionWithOptionToDir( "--file", "module" ); + public void testMvnFileLongOptionModuleToDir() throws Exception { + runCoreExtensionWithOptionToDir("--file", "module"); } /** @@ -82,44 +71,39 @@ public class MavenITmng6223FindBasedir * @throws Exception in case of failure */ @Test - public void testMvnFileShortOptionModuleToDir() - throws Exception - { - runCoreExtensionWithOptionToDir( "-f", "module" ); + public void testMvnFileShortOptionModuleToDir() throws Exception { + runCoreExtensionWithOptionToDir("-f", "module"); } - private void runCoreExtensionWithOptionToDir( String option, String subdir ) - throws Exception - { - runCoreExtensionWithOption( option, subdir, false ); + private void runCoreExtensionWithOptionToDir(String option, String subdir) throws Exception { + runCoreExtensionWithOption(option, subdir, false); } - protected void runCoreExtensionWithOption( String option, String subdir, boolean pom ) - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5889-find.mvn" ); + protected void runCoreExtensionWithOption(String option, String subdir, boolean pom) throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5889-find.mvn"); - File basedir = new File( testDir, "../mng-" + ( pom ? "5889" : "6223" ) + "-find.mvn" + option + ( pom ? "Pom" : "Dir" ) ); + File basedir = + new File(testDir, "../mng-" + (pom ? "5889" : "6223") + "-find.mvn" + option + (pom ? "Pom" : "Dir")); basedir.mkdir(); - if ( subdir != null ) - { - testDir = new File( testDir, subdir ); - basedir = new File( basedir, subdir ); + if (subdir != null) { + testDir = new File(testDir, subdir); + basedir = new File(basedir, subdir); basedir.mkdirs(); } - Verifier verifier = newVerifier( basedir.getAbsolutePath() ); - verifier.addCliArgument( "-Dexpression.outputFile=" + new File( basedir, "expression.properties" ).getAbsolutePath() ); - verifier.addCliArgument( option ); // -f/--file client/pom.xml - verifier.addCliArgument( ( pom ? new File( testDir, "pom.xml" ) : testDir ).getAbsolutePath() ); - verifier.setForkJvm( true ); // force forked JVM since we need the shell script to detect .mvn/ location - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(basedir.getAbsolutePath()); + verifier.addCliArgument( + "-Dexpression.outputFile=" + new File(basedir, "expression.properties").getAbsolutePath()); + verifier.addCliArgument(option); // -f/--file client/pom.xml + verifier.addCliArgument((pom ? new File(testDir, "pom.xml") : testDir).getAbsolutePath()); + verifier.setForkJvm(true); // force forked JVM since we need the shell script to detect .mvn/ location + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "expression.properties" ); - assertEquals( "ok", props.getProperty( "project.properties.jvm-config" ) ); - assertEquals( "ok", props.getProperty( "project.properties.maven-config" ) ); + Properties props = verifier.loadProperties("expression.properties"); + assertEquals("ok", props.getProperty("project.properties.jvm-config")); + assertEquals("ok", props.getProperty("project.properties.maven-config")); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6240PluginExtensionAetherProvider.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6240PluginExtensionAetherProvider.java index c828f2cc36..1dfe0abb1f 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6240PluginExtensionAetherProvider.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6240PluginExtensionAetherProvider.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,12 +30,9 @@ import org.junit.jupiter.api.Test; * * @author gboue */ -public class MavenITmng6240PluginExtensionAetherProvider - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng6240PluginExtensionAetherProvider() - { - super( "[3.5.1,)" ); +public class MavenITmng6240PluginExtensionAetherProvider extends AbstractMavenIntegrationTestCase { + public MavenITmng6240PluginExtensionAetherProvider() { + super("[3.5.1,)"); } /** @@ -53,35 +48,29 @@ public class MavenITmng6240PluginExtensionAetherProvider * @throws Exception in case of failure */ @Test - public void testPluginExtensionDependingOnMavenAetherProvider() - throws Exception - { + public void testPluginExtensionDependingOnMavenAetherProvider() throws Exception { File testDir = - ResourceExtractor.simpleExtractResources( getClass(), "/mng-6240-plugin-extension-aether-provider" ); - File pluginDir = new File( testDir, "plugin-extension" ); - File projectDir = new File( testDir, "project" ); + ResourceExtractor.simpleExtractResources(getClass(), "/mng-6240-plugin-extension-aether-provider"); + File pluginDir = new File(testDir, "plugin-extension"); + File projectDir = new File(testDir, "project"); - Verifier verifier = newVerifier( pluginDir.getAbsolutePath(), "remote" ); - verifier.addCliArgument( "install" ); + Verifier verifier = newVerifier(pluginDir.getAbsolutePath(), "remote"); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier = newVerifier( projectDir.getAbsolutePath(), "remote" ); - verifier.addCliArgument( "deploy" ); + verifier = newVerifier(projectDir.getAbsolutePath(), "remote"); + verifier.addCliArgument("deploy"); verifier.execute(); verifier.verifyErrorFreeLog(); - List lines = verifier.loadFile( verifier.getBasedir(), verifier.getLogFileName(), false ); + List lines = verifier.loadFile(verifier.getBasedir(), verifier.getLogFileName(), false); int count = 0; - for ( String line : lines ) - { - if ( line.endsWith( "/repo/org/apache/maven/its/mng6240/project/1.0-SNAPSHOT/maven-metadata.xml" ) ) - { + for (String line : lines) { + if (line.endsWith("/repo/org/apache/maven/its/mng6240/project/1.0-SNAPSHOT/maven-metadata.xml")) { count++; } } - assertEquals( 2, count ); // 1 from download, 1 from upload - + assertEquals(2, count); // 1 from download, 1 from upload } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6255FixConcatLines.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6255FixConcatLines.java index 1e5c54b855..02f3f882cc 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6255FixConcatLines.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6255FixConcatLines.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,9 +16,7 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; @@ -28,6 +24,8 @@ import java.util.Properties; import com.google.common.base.Charsets; import com.google.common.base.Joiner; import com.google.common.io.Files; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -35,12 +33,9 @@ import org.junit.jupiter.api.Test; * Check that the .mvn/jvm.config file contents are concatenated properly, no matter * what line endings are used. */ -public class MavenITmng6255FixConcatLines - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng6255FixConcatLines() - { - super( "[3.5.3,)" ); +public class MavenITmng6255FixConcatLines extends AbstractMavenIntegrationTestCase { + public MavenITmng6255FixConcatLines() { + super("[3.5.3,)"); } /** @@ -50,10 +45,8 @@ public class MavenITmng6255FixConcatLines * * @throws Exception in case of failure */ - public void disabledJvmConfigFileCR() - throws Exception - { - runWithLineEndings( "\r" ); + public void disabledJvmConfigFileCR() throws Exception { + runWithLineEndings("\r"); } /** @@ -62,10 +55,8 @@ public class MavenITmng6255FixConcatLines * @throws Exception in case of failure */ @Test - public void testJvmConfigFileLF() - throws Exception - { - runWithLineEndings( "\n" ); + public void testJvmConfigFileLF() throws Exception { + runWithLineEndings("\n"); } /** @@ -74,36 +65,31 @@ public class MavenITmng6255FixConcatLines * @throws Exception in case of failure */ @Test - public void testJvmConfigFileCRLF() - throws Exception - { - runWithLineEndings( "\r\n" ); + public void testJvmConfigFileCRLF() throws Exception { + runWithLineEndings("\r\n"); } - protected void runWithLineEndings( String lineEndings ) - throws Exception - { - File baseDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6255" ); - File mvnDir = new File( baseDir, ".mvn" ); + protected void runWithLineEndings(String lineEndings) throws Exception { + File baseDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-6255"); + File mvnDir = new File(baseDir, ".mvn"); - File jvmConfig = new File( mvnDir, "jvm.config" ); - createJvmConfigFile( jvmConfig, lineEndings, "-Djvm.config=ok", "-Xms256m", "-Xmx512m" ); + File jvmConfig = new File(mvnDir, "jvm.config"); + createJvmConfigFile(jvmConfig, lineEndings, "-Djvm.config=ok", "-Xms256m", "-Xmx512m"); - Verifier verifier = newVerifier( baseDir.getAbsolutePath() ); - verifier.addCliArgument( "-Dexpression.outputFile=" + new File( baseDir, "expression.properties" ).getAbsolutePath() ); - verifier.setForkJvm( true ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(baseDir.getAbsolutePath()); + verifier.addCliArgument( + "-Dexpression.outputFile=" + new File(baseDir, "expression.properties").getAbsolutePath()); + verifier.setForkJvm(true); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "expression.properties" ); - assertEquals( "ok", props.getProperty( "project.properties.jvm-config" ) ); + Properties props = verifier.loadProperties("expression.properties"); + assertEquals("ok", props.getProperty("project.properties.jvm-config")); } - protected void createJvmConfigFile( File jvmConfig, String lineEndings, String...lines ) - throws Exception - { + protected void createJvmConfigFile(File jvmConfig, String lineEndings, String... lines) throws Exception { String content = Joiner.on(lineEndings).join(lines); - Files.write( content, jvmConfig, Charsets.UTF_8 ); + Files.write(content, jvmConfig, Charsets.UTF_8); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6256SpecialCharsAlternatePOMLocation.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6256SpecialCharsAlternatePOMLocation.java index b067b50aaf..94f0375787 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6256SpecialCharsAlternatePOMLocation.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6256SpecialCharsAlternatePOMLocation.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -31,12 +29,9 @@ import org.junit.jupiter.api.Test; * passed via -f/--file containing special characters do not break the script. E.g * -f "directoryWithClosing)Bracket/pom.xml". */ -public class MavenITmng6256SpecialCharsAlternatePOMLocation - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng6256SpecialCharsAlternatePOMLocation() - { - super( "(3.6.0,)" ); +public class MavenITmng6256SpecialCharsAlternatePOMLocation extends AbstractMavenIntegrationTestCase { + public MavenITmng6256SpecialCharsAlternatePOMLocation() { + super("(3.6.0,)"); } /** @@ -45,11 +40,9 @@ public class MavenITmng6256SpecialCharsAlternatePOMLocation * @throws Exception in case of failure */ @Test - public void testDirectoryWithSpace() - throws Exception - { - runWithMvnFileLongOption( "directory-with- -space" ); - runWithMvnFileShortOption( "directory-with- -space" ); + public void testDirectoryWithSpace() throws Exception { + runWithMvnFileLongOption("directory-with- -space"); + runWithMvnFileShortOption("directory-with- -space"); } /** @@ -58,38 +51,30 @@ public class MavenITmng6256SpecialCharsAlternatePOMLocation * @throws Exception in case of failure */ @Test - public void testDirectoryWithClosingBracket() - throws Exception - { - runWithMvnFileLongOption( "directory-with-)-closing-bracket" ); - runWithMvnFileShortOption( "directory-with-)-closing-bracket" ); + public void testDirectoryWithClosingBracket() throws Exception { + runWithMvnFileLongOption("directory-with-)-closing-bracket"); + runWithMvnFileShortOption("directory-with-)-closing-bracket"); } - private void runWithMvnFileLongOption( String subDir ) - throws Exception - { - runCoreExtensionWithOption( "--file", subDir ); + private void runWithMvnFileLongOption(String subDir) throws Exception { + runCoreExtensionWithOption("--file", subDir); } - private void runWithMvnFileShortOption( String subDir ) - throws Exception - { - runCoreExtensionWithOption( "-f", subDir ); + private void runWithMvnFileShortOption(String subDir) throws Exception { + runCoreExtensionWithOption("-f", subDir); } - private void runCoreExtensionWithOption( String option, String subDir ) - throws Exception - { + private void runCoreExtensionWithOption(String option, String subDir) throws Exception { File resourceDir = - ResourceExtractor.simpleExtractResources( getClass(), "/mng-6256-special-chars-alternate-pom-location" ); + ResourceExtractor.simpleExtractResources(getClass(), "/mng-6256-special-chars-alternate-pom-location"); - File testDir = new File( resourceDir, "../mng-6256-" + subDir ); + File testDir = new File(resourceDir, "../mng-6256-" + subDir); testDir.mkdir(); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.addCliArgument( option ); // -f/--file - verifier.addCliArgument( "\"" + new File( resourceDir, subDir ).getAbsolutePath() + "\"" ); // "" - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.addCliArgument(option); // -f/--file + verifier.addCliArgument("\"" + new File(resourceDir, subDir).getAbsolutePath() + "\""); // "" + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6326CoreExtensionsNotFoundTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6326CoreExtensionsNotFoundTest.java index 35eead4ab1..b686a285fc 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6326CoreExtensionsNotFoundTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6326CoreExtensionsNotFoundTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,10 +16,7 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.ByteArrayOutputStream; import java.io.File; @@ -29,52 +24,43 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** * This is a test set for MNG-6326: * check that Maven fails if it cannot load core extensions contributed by .mvn/extensions.xml. */ -public class MavenITmng6326CoreExtensionsNotFoundTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng6326CoreExtensionsNotFoundTest() - { - super( "[3.8.5,)" ); +public class MavenITmng6326CoreExtensionsNotFoundTest extends AbstractMavenIntegrationTestCase { + public MavenITmng6326CoreExtensionsNotFoundTest() { + super("[3.8.5,)"); } @Test - public void testCoreExtensionsNotFound() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6326-core-extensions-not-found" ); + public void testCoreExtensionsNotFound() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-6326-core-extensions-not-found"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - try - { - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + try { + verifier.addCliArgument("validate"); verifier.execute(); - fail( "should have failed "); - } - catch ( VerificationException e ) - { - try - { - verifier.verifyTextInLog( "[ERROR] Error executing Maven." ); - verifier.verifyTextInLog( "Extension org.apache.maven.its.it-core-extensions:maven-it-unknown-extensions:0.1 or one of its dependencies could not be resolved" ); - } - catch ( VerificationException e2 ) - { - throw new VerificationException( e2.getMessage() + "\nLog:" + getLogContent( verifier ) ); + fail("should have failed "); + } catch (VerificationException e) { + try { + verifier.verifyTextInLog("[ERROR] Error executing Maven."); + verifier.verifyTextInLog( + "Extension org.apache.maven.its.it-core-extensions:maven-it-unknown-extensions:0.1 or one of its dependencies could not be resolved"); + } catch (VerificationException e2) { + throw new VerificationException(e2.getMessage() + "\nLog:" + getLogContent(verifier)); } } } - private String getLogContent( Verifier verifier ) throws IOException - { + private String getLogContent(Verifier verifier) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); - Files.copy( Paths.get( verifier.getBasedir(), verifier.getLogFileName() ), baos ); + Files.copy(Paths.get(verifier.getBasedir(), verifier.getLogFileName()), baos); return baos.toString(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6330RelativePath.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6330RelativePath.java index 77b7304f85..bbbe2a0cc3 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6330RelativePath.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6330RelativePath.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -32,31 +30,24 @@ import org.junit.jupiter.api.Test; * * @author Robert Scholte */ -public class MavenITmng6330RelativePath - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng6330RelativePath() - { - super( "(,3.5.0),(3.5.2,)" ); +public class MavenITmng6330RelativePath extends AbstractMavenIntegrationTestCase { + public MavenITmng6330RelativePath() { + super("(,3.5.0),(3.5.2,)"); } @Test - public void testRelativePath() throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6330-relative-path" ); + public void testRelativePath() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-6330-relative-path"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setForkJvm( true ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setForkJvm(true); - try - { - verifier.addCliArgument( "validate"); + try { + verifier.addCliArgument("validate"); verifier.execute(); - fail( "Should fail due to non-resolvable parent" ); - } - catch ( VerificationException e ) - { - assertTrue( e.getMessage().contains( "Non-resolvable parent POM" ) ); + fail("Should fail due to non-resolvable parent"); + } catch (VerificationException e) { + assertTrue(e.getMessage().contains("Non-resolvable parent POM")); } } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6386BaseUriPropertyTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6386BaseUriPropertyTest.java index 370b3cf425..4c2eb1b015 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6386BaseUriPropertyTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6386BaseUriPropertyTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,90 +16,84 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.Properties; import org.apache.maven.shared.utils.Os; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** * This is a test set for MNG-6386. */ -public class MavenITmng6386BaseUriPropertyTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng6386BaseUriPropertyTest extends AbstractMavenIntegrationTestCase { - public MavenITmng6386BaseUriPropertyTest() - { - super( "[3.5.4,)" ); + public MavenITmng6386BaseUriPropertyTest() { + super("[3.5.4,)"); } @Test - public void testitMNG6386() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6386" ).getCanonicalFile(); + public void testitMNG6386() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-6386") + .getCanonicalFile(); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.setLogFileName( "log-basic.txt" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.setLogFileName("log-basic.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/profile.properties" ); - String pomProperty = props.getProperty( "project.properties.pomProperty" ); + Properties props = verifier.loadProperties("target/profile.properties"); + String pomProperty = props.getProperty("project.properties.pomProperty"); // set via project - assertEquals( testDir.toPath().toUri().toASCIIString(), pomProperty ); + assertEquals(testDir.toPath().toUri().toASCIIString(), pomProperty); // check that baseUri begins with file:/// - assertTrue( pomProperty.startsWith( "file:///" ) ); + assertTrue(pomProperty.startsWith("file:///")); } - @Test - - public void testitMNG6386UnicodeChars() - throws Exception - { - String fileEncoding = System.getProperty( "file.encoding" ); + @Test + public void testitMNG6386UnicodeChars() throws Exception { + String fileEncoding = System.getProperty("file.encoding"); /* * Unfortunately, AbstractMavenIntegrationTestCase still uses JUnit 3.8 which does not have * Assume, so we cannot make assumptions and skip the test on non-compatible systems. */ - if ( Os.isFamily( Os.FAMILY_WINDOWS ) || - "UTF-8".equalsIgnoreCase( fileEncoding ) || "UTF8".equalsIgnoreCase( fileEncoding ) ) - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6386-это по-русский" ).getCanonicalFile(); + if (Os.isFamily(Os.FAMILY_WINDOWS) + || "UTF-8".equalsIgnoreCase(fileEncoding) + || "UTF8".equalsIgnoreCase(fileEncoding)) { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-6386-это по-русский") + .getCanonicalFile(); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.setLogFileName( "log-basic.txt" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.setLogFileName("log-basic.txt"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/profile.properties" ); - String pomProperty = props.getProperty( "project.properties.pomProperty" ); + Properties props = verifier.loadProperties("target/profile.properties"); + String pomProperty = props.getProperty("project.properties.pomProperty"); // set via project - assertEquals( testDir.toPath().toUri().toASCIIString(), pomProperty ); + assertEquals(testDir.toPath().toUri().toASCIIString(), pomProperty); // check that baseUri begins with file:/// - assertTrue( pomProperty.startsWith( "file:///" ) ); + assertTrue(pomProperty.startsWith("file:///")); // check that baseUri ends with "это по-русский/", but properly URI-encoded // We need to make sure that either form NFC or NFD is accepted since HFS+ and APFS might use them - assertTrue( pomProperty.endsWith( "%D1%8D%D1%82%D0%BE%20%D0%BF%D0%BE-%D1%80%D1%83%D1%81%D1%81%D0%BA%D0%B8%D0%B9/" ) - || pomProperty.endsWith( "%D1%8D%D1%82%D0%BE%20%D0%BF%D0%BE-%D1%80%D1%83%D1%81%D1%81%D0%BA%D0%B8%D0%B8%CC%86/" ) ); - } - else - { + assertTrue(pomProperty.endsWith( + "%D1%8D%D1%82%D0%BE%20%D0%BF%D0%BE-%D1%80%D1%83%D1%81%D1%81%D0%BA%D0%B8%D0%B9/") + || pomProperty.endsWith( + "%D1%8D%D1%82%D0%BE%20%D0%BF%D0%BE-%D1%80%D1%83%D1%81%D1%81%D0%BA%D0%B8%D0%B8%CC%86/")); + } else { System.out.println(); - System.out.println( "[WARNING] Skipping MNG-6386 Unicode Chars Test on incompatible encoding: " + fileEncoding ); + System.out.println( + "[WARNING] Skipping MNG-6386 Unicode Chars Test on incompatible encoding: " + fileEncoding); System.out.println(); } } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6391PrintVersionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6391PrintVersionTest.java index 9d2eb32e4d..8bfac3282d 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6391PrintVersionTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6391PrintVersionTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,15 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; -import java.util.Arrays; import java.util.LinkedList; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -38,13 +35,10 @@ import org.junit.jupiter.api.Test; * * @author Karl Heinz Marbaise khmarbaise@apache.org */ -public class MavenITmng6391PrintVersionTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng6391PrintVersionTest extends AbstractMavenIntegrationTestCase { - public MavenITmng6391PrintVersionTest() - { - super( "[3.6.0,)" ); + public MavenITmng6391PrintVersionTest() { + super("[3.6.0,)"); } /** @@ -56,40 +50,37 @@ public class MavenITmng6391PrintVersionTest * @throws Exception in case of failure */ @Test - public void testitShouldPrintVersionAtTopAndAtBottom() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6391-print-version" ); + public void testitShouldPrintVersionAtTopAndAtBottom() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-6391-print-version"); - Verifier verifier = newVerifier( testDir.getAbsolutePath(), false ); - verifier.setAutoclean( false ); + Verifier verifier = newVerifier(testDir.getAbsolutePath(), false); + verifier.setAutoclean(false); - verifier.setLogFileName( "version-log.txt" ); - verifier.addCliArgument( "clean" ); + verifier.setLogFileName("version-log.txt"); + verifier.addCliArgument("clean"); verifier.execute(); verifier.verifyErrorFreeLog(); - List loadedLines = verifier.loadLines( "version-log.txt", "UTF-8" ); - List resultingLines = extractReactorBuildOrder( loadedLines ); + List loadedLines = verifier.loadLines("version-log.txt", "UTF-8"); + List resultingLines = extractReactorBuildOrder(loadedLines); // We're expecting exactly four lines as result. - assertEquals( 5, resultingLines.size() ); + assertEquals(5, resultingLines.size()); // We expect those lines in the following exact order. // Maven 4.0.x has some code new code which takes care of the terminal width to adjust the output. // The number of dots can thus vary when running the tests. - assertTrue( resultingLines.get( 0 ).startsWith( "[INFO] Reactor Summary for base-project 1.3.0-SNAPSHOT:" ) ); - assertTrue( resultingLines.get( 1 ).matches( "\\Q[INFO] base-project ............\\E\\.+\\Q SUCCESS [\\E.*" ) ); - assertTrue( resultingLines.get( 2 ).matches( "\\Q[INFO] module-1 ................\\E\\.+\\Q SUCCESS [\\E.*" ) ); - assertTrue( resultingLines.get( 3 ).matches( "\\Q[INFO] module-2 ................\\E\\.+\\Q SUCCESS [\\E.*" ) ); - assertTrue( resultingLines.get( 4 ).matches( "\\Q[INFO] module-3 ................\\E\\.+\\Q SUCCESS [\\E.*" ) ); + assertTrue(resultingLines.get(0).startsWith("[INFO] Reactor Summary for base-project 1.3.0-SNAPSHOT:")); + assertTrue(resultingLines.get(1).matches("\\Q[INFO] base-project ............\\E\\.+\\Q SUCCESS [\\E.*")); + assertTrue(resultingLines.get(2).matches("\\Q[INFO] module-1 ................\\E\\.+\\Q SUCCESS [\\E.*")); + assertTrue(resultingLines.get(3).matches("\\Q[INFO] module-2 ................\\E\\.+\\Q SUCCESS [\\E.*")); + assertTrue(resultingLines.get(4).matches("\\Q[INFO] module-3 ................\\E\\.+\\Q SUCCESS [\\E.*")); // We expect that line 1..4 have the same length - int line1Length = resultingLines.get( 1 ).length(); - assertEquals( line1Length, resultingLines.get( 2 ).length() ); - assertEquals( line1Length, resultingLines.get( 3 ).length() ); - assertEquals( line1Length, resultingLines.get( 4 ).length() ); - + int line1Length = resultingLines.get(1).length(); + assertEquals(line1Length, resultingLines.get(2).length()); + assertEquals(line1Length, resultingLines.get(3).length()); + assertEquals(line1Length, resultingLines.get(4).length()); } /** @@ -100,40 +91,45 @@ public class MavenITmng6391PrintVersionTest * @throws Exception in case of failure */ @Test - public void testitShouldPrintVersionInAllLines() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6391-print-version-aggregator" ); + public void testitShouldPrintVersionInAllLines() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-6391-print-version-aggregator"); - Verifier verifier = newVerifier( testDir.getAbsolutePath(), false ); - verifier.setAutoclean( false ); + Verifier verifier = newVerifier(testDir.getAbsolutePath(), false); + verifier.setAutoclean(false); - verifier.setLogFileName( "version-log.txt" ); - verifier.addCliArguments( "clean" ); + verifier.setLogFileName("version-log.txt"); + verifier.addCliArguments("clean"); verifier.execute(); verifier.verifyErrorFreeLog(); - List loadedLines = verifier.loadLines( "version-log.txt", "UTF-8" ); - List resultingLines = extractReactorBuildOrder( loadedLines ); + List loadedLines = verifier.loadLines("version-log.txt", "UTF-8"); + List resultingLines = extractReactorBuildOrder(loadedLines); // We're expecting exactly four lines as result. - assertEquals( 5, resultingLines.size() ); + assertEquals(5, resultingLines.size()); // We expect those lines in the following exact order. // Maven 4.0.x has some code new code which takes care of the terminal width to adjust the output. // The number of dots can thus vary when running the tests. - assertTrue( resultingLines.get( 0 ).startsWith( "[INFO] Reactor Summary:" ) ); - assertTrue( resultingLines.get( 1 ).matches( "\\Q[INFO] module-1 1.2.7.43.RELEASE ...............\\E\\.+\\Q SUCCESS [ \\E.*" ) ); - assertTrue( resultingLines.get( 2 ).matches( "\\Q[INFO] module-2 7.5-SNAPSHOT ...................\\E\\.+\\Q SUCCESS [ \\E.*" ) ); - assertTrue( resultingLines.get( 3 ).matches( "\\Q[INFO] module-3 1-RC1 ..........................\\E\\.+\\Q SUCCESS [ \\E.*" ) ); - assertTrue( resultingLines.get( 4 ).matches( "\\Q[INFO] base-project 1.0.0-SNAPSHOT .............\\E\\.+\\Q SUCCESS [ \\E.*" ) ); + assertTrue(resultingLines.get(0).startsWith("[INFO] Reactor Summary:")); + assertTrue(resultingLines + .get(1) + .matches("\\Q[INFO] module-1 1.2.7.43.RELEASE ...............\\E\\.+\\Q SUCCESS [ \\E.*")); + assertTrue(resultingLines + .get(2) + .matches("\\Q[INFO] module-2 7.5-SNAPSHOT ...................\\E\\.+\\Q SUCCESS [ \\E.*")); + assertTrue(resultingLines + .get(3) + .matches("\\Q[INFO] module-3 1-RC1 ..........................\\E\\.+\\Q SUCCESS [ \\E.*")); + assertTrue(resultingLines + .get(4) + .matches("\\Q[INFO] base-project 1.0.0-SNAPSHOT .............\\E\\.+\\Q SUCCESS [ \\E.*")); // We expect that line 1..4 have the same length - int line1Length = resultingLines.get( 1 ).length(); - assertEquals( line1Length, resultingLines.get( 2 ).length() ); - assertEquals( line1Length, resultingLines.get( 3 ).length() ); - assertEquals( line1Length, resultingLines.get( 4 ).length() ); - + int line1Length = resultingLines.get(1).length(); + assertEquals(line1Length, resultingLines.get(2).length()); + assertEquals(line1Length, resultingLines.get(3).length()); + assertEquals(line1Length, resultingLines.get(4).length()); } /** @@ -147,35 +143,23 @@ public class MavenITmng6391PrintVersionTest * [INFO] ...SUCCESS [ 0.035 s] * */ - private List extractReactorBuildOrder( List loadedLines ) - { + private List extractReactorBuildOrder(List loadedLines) { List resultingLines = new LinkedList(); boolean start = false; - for ( String line : loadedLines ) - { - if ( start ) - { - if ( line.startsWith( "[INFO] -------------" ) ) - { + for (String line : loadedLines) { + if (start) { + if (line.startsWith("[INFO] -------------")) { start = false; + } else if (!line.endsWith("[INFO] ")) { + resultingLines.add(line); } - else if ( !line.endsWith( "[INFO] " ) ) - { - resultingLines.add( line ); - } - } - else - { - if ( line.startsWith( "[INFO] Reactor Summary" ) ) - { + } else { + if (line.startsWith("[INFO] Reactor Summary")) { start = true; - resultingLines.add( line ); + resultingLines.add(line); } - } } return resultingLines; - } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6506PackageAnnotationTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6506PackageAnnotationTest.java index 04f62c7cf9..0b8f883ecb 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6506PackageAnnotationTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6506PackageAnnotationTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,44 +16,37 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; -public class MavenITmng6506PackageAnnotationTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng6506PackageAnnotationTest extends AbstractMavenIntegrationTestCase { - public MavenITmng6506PackageAnnotationTest() - { - super( "[3.6.1,)" ); + public MavenITmng6506PackageAnnotationTest() { + super("[3.6.1,)"); } @Test - public void testGetPackageAnnotation() - throws Exception - { - File testDir = - ResourceExtractor.simpleExtractResources( getClass(), - "/mng-6506-package-annotation" ); - File pluginDir = new File( testDir, "plugin" ); - File projectDir = new File( testDir, "project" ); + public void testGetPackageAnnotation() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-6506-package-annotation"); + File pluginDir = new File(testDir, "plugin"); + File projectDir = new File(testDir, "project"); Verifier verifier; - verifier = newVerifier( pluginDir.getAbsolutePath(), "remote" ); - verifier.addCliArgument( "install" ); + verifier = newVerifier(pluginDir.getAbsolutePath(), "remote"); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier = newVerifier( projectDir.getAbsolutePath(), "remote" ); - verifier.addCliArgument( "verify" ); + verifier = newVerifier(projectDir.getAbsolutePath(), "remote"); + verifier.addCliArgument("verify"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyTextInLog( "MNG-6506 check succeeded" ); + verifier.verifyTextInLog("MNG-6506 check succeeded"); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6511OptionalProjectSelectionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6511OptionalProjectSelectionTest.java index 5b963f1c03..e7b6b6ee73 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6511OptionalProjectSelectionTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6511OptionalProjectSelectionTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; import java.io.IOException; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -35,99 +33,93 @@ import org.junit.jupiter.api.Test; * @author Maarten Mulders * @author Martin Kanters */ -public class MavenITmng6511OptionalProjectSelectionTest extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng6511OptionalProjectSelectionTest extends AbstractMavenIntegrationTestCase { private static final String RESOURCE_PATH = "/mng-6511-optional-project-selection"; private final File testDir; - public MavenITmng6511OptionalProjectSelectionTest() throws IOException - { - super( "[4.0.0-alpha-1,)" ); - testDir = ResourceExtractor.simpleExtractResources( getClass(), RESOURCE_PATH ); + public MavenITmng6511OptionalProjectSelectionTest() throws IOException { + super("[4.0.0-alpha-1,)"); + testDir = ResourceExtractor.simpleExtractResources(getClass(), RESOURCE_PATH); } @Test - public void testSelectExistingOptionalProfile() throws VerificationException - { - Verifier cleaner = newVerifier( testDir.getAbsolutePath() ); - cleaner.addCliArgument( "clean" ); + public void testSelectExistingOptionalProfile() throws VerificationException { + Verifier cleaner = newVerifier(testDir.getAbsolutePath()); + cleaner.addCliArgument("clean"); cleaner.execute(); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setLogFileName( "log-select-existing.txt" ); - verifier.addCliArgument( "-pl" ); - verifier.addCliArgument( "?existing-module" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setLogFileName("log-select-existing.txt"); + verifier.addCliArgument("-pl"); + verifier.addCliArgument("?existing-module"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "existing-module/target/touch.txt" ); // existing-module should have been built. + verifier.verifyFilePresent("existing-module/target/touch.txt"); // existing-module should have been built. } @Test - public void testSelectExistingOptionalProfileByArtifactId() throws VerificationException - { - Verifier cleaner = newVerifier( testDir.getAbsolutePath() ); - cleaner.addCliArgument( "clean" ); + public void testSelectExistingOptionalProfileByArtifactId() throws VerificationException { + Verifier cleaner = newVerifier(testDir.getAbsolutePath()); + cleaner.addCliArgument("clean"); cleaner.execute(); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setLogFileName( "log-select-existing-artifact-id.txt" ); - verifier.addCliArgument( "-pl" ); - verifier.addCliArgument( "?:existing-module" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setLogFileName("log-select-existing-artifact-id.txt"); + verifier.addCliArgument("-pl"); + verifier.addCliArgument("?:existing-module"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "existing-module/target/touch.txt" ); // existing-module should have been built. + verifier.verifyFilePresent("existing-module/target/touch.txt"); // existing-module should have been built. } @Test - public void testSelectNonExistingOptionalProfile() throws VerificationException - { - Verifier cleaner = newVerifier( testDir.getAbsolutePath() ); - cleaner.addCliArgument( "clean" ); + public void testSelectNonExistingOptionalProfile() throws VerificationException { + Verifier cleaner = newVerifier(testDir.getAbsolutePath()); + cleaner.addCliArgument("clean"); cleaner.execute(); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setLogFileName( "log-select-non-existing.txt" ); - verifier.addCliArgument( "-pl" ); - verifier.addCliArgument( "?non-existing-module" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setLogFileName("log-select-non-existing.txt"); + verifier.addCliArgument("-pl"); + verifier.addCliArgument("?non-existing-module"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "existing-module/target/touch.txt" ); // existing-module should have been built. + verifier.verifyFilePresent("existing-module/target/touch.txt"); // existing-module should have been built. } @Test - public void testDeselectExistingOptionalProfile() throws VerificationException - { - Verifier cleaner = newVerifier( testDir.getAbsolutePath() ); - cleaner.addCliArgument( "clean" ); + public void testDeselectExistingOptionalProfile() throws VerificationException { + Verifier cleaner = newVerifier(testDir.getAbsolutePath()); + cleaner.addCliArgument("clean"); cleaner.execute(); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setLogFileName( "log-deselect-existing.txt" ); - verifier.addCliArgument( "-pl" ); - verifier.addCliArgument( "!?existing-module" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setLogFileName("log-deselect-existing.txt"); + verifier.addCliArgument("-pl"); + verifier.addCliArgument("!?existing-module"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFileNotPresent( "existing-module/target/touch.txt" ); // existing-module should not have been built. + verifier.verifyFileNotPresent( + "existing-module/target/touch.txt"); // existing-module should not have been built. } @Test - public void testDeselectNonExistingOptionalProfile() throws VerificationException - { - Verifier cleaner = newVerifier( testDir.getAbsolutePath() ); - cleaner.addCliArgument( "clean" ); + public void testDeselectNonExistingOptionalProfile() throws VerificationException { + Verifier cleaner = newVerifier(testDir.getAbsolutePath()); + cleaner.addCliArgument("clean"); cleaner.execute(); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setLogFileName( "log-deselect-non-existing.txt" ); - verifier.addCliArgument( "-pl" ); - verifier.addCliArgument( "!?non-existing-module" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setLogFileName("log-deselect-non-existing.txt"); + verifier.addCliArgument("-pl"); + verifier.addCliArgument("!?non-existing-module"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "existing-module/target/touch.txt" ); // existing-module should have been built. + verifier.verifyFilePresent("existing-module/target/touch.txt"); // existing-module should have been built. } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6558ToolchainsBuildingEventTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6558ToolchainsBuildingEventTest.java index 774d55bfcf..19dc466f36 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6558ToolchainsBuildingEventTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6558ToolchainsBuildingEventTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,25 +16,22 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** * This is a test set for MNG-6558. */ -public class MavenITmng6558ToolchainsBuildingEventTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng6558ToolchainsBuildingEventTest extends AbstractMavenIntegrationTestCase { - public MavenITmng6558ToolchainsBuildingEventTest() - { - super( "[3.6.1,)" ); + public MavenITmng6558ToolchainsBuildingEventTest() { + super("[3.6.1,)"); } /** @@ -45,28 +40,27 @@ public class MavenITmng6558ToolchainsBuildingEventTest * @throws Exception in case of failure */ @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6558" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-6558"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setForkJvm( true ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "-Dmaven.ext.class.path=spy-0.1.jar" ); - verifier.addCliArgument( "-X" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setForkJvm(true); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("-Dmaven.ext.class.path=spy-0.1.jar"); + verifier.addCliArgument("-X"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List lines = verifier.loadLines( "target/spy.log", "UTF-8" ); - assertTrue( lines.toString(), lines.get( 0 ).startsWith( "init" ) ); - assertTrue( lines.toString(), lines.get( lines.size() - 1 ).startsWith( "close" ) ); - assertTrue( lines.toString(), - lines.contains( "event: org.apache.maven.toolchain.building.DefaultToolchainsBuildingRequest" ) ); - assertTrue( lines.toString(), - lines.contains( "event: org.apache.maven.toolchain.building.DefaultToolchainsBuildingResult" ) ); + List lines = verifier.loadLines("target/spy.log", "UTF-8"); + assertTrue(lines.toString(), lines.get(0).startsWith("init")); + assertTrue(lines.toString(), lines.get(lines.size() - 1).startsWith("close")); + assertTrue( + lines.toString(), + lines.contains("event: org.apache.maven.toolchain.building.DefaultToolchainsBuildingRequest")); + assertTrue( + lines.toString(), + lines.contains("event: org.apache.maven.toolchain.building.DefaultToolchainsBuildingResult")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6562WarnDefaultBindings.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6562WarnDefaultBindings.java index c6b2c25a9f..8ccea33262 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6562WarnDefaultBindings.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6562WarnDefaultBindings.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,132 +16,115 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; -import java.util.Arrays; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; -public class MavenITmng6562WarnDefaultBindings - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng6562WarnDefaultBindings extends AbstractMavenIntegrationTestCase { - public MavenITmng6562WarnDefaultBindings() - { - super( "[4.0.0-alpha-1,)" ); + public MavenITmng6562WarnDefaultBindings() { + super("[4.0.0-alpha-1,)"); } @Test - public void testItShouldNotWarn() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6562-default-bindings" ); + public void testItShouldNotWarn() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-6562-default-bindings"); String phase = "validate"; - Verifier verifier = newVerifier( testDir.getAbsolutePath(), false ); - verifier.setAutoclean( false ); - verifier.setLogFileName( phase + ".txt" ); - verifier.setForkJvm( true ); // required due to --fail-on-severity - verifier.addCliArgument( "-fos" ); - verifier.addCliArgument( "WARN" ); // ALSO NO WARNINGS - verifier.addCliArgument( phase ); + Verifier verifier = newVerifier(testDir.getAbsolutePath(), false); + verifier.setAutoclean(false); + verifier.setLogFileName(phase + ".txt"); + verifier.setForkJvm(true); // required due to --fail-on-severity + verifier.addCliArgument("-fos"); + verifier.addCliArgument("WARN"); // ALSO NO WARNINGS + verifier.addCliArgument(phase); verifier.execute(); verifier.verifyErrorFreeLog(); } - @Test - public void testItShouldNotWarn2() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6562-default-bindings" ); + public void testItShouldNotWarn2() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-6562-default-bindings"); String phase = "process-resources"; - Verifier verifier = newVerifier( testDir.getAbsolutePath(), false ); - verifier.setAutoclean( false ); - verifier.setLogFileName( phase + ".txt" ); - verifier.setForkJvm( true ); // required due to --fail-on-severity - verifier.addCliArgument( "-fos" ); - verifier.addCliArgument( "WARN" ); // ALSO NO WARNINGS - verifier.addCliArgument( phase ); + Verifier verifier = newVerifier(testDir.getAbsolutePath(), false); + verifier.setAutoclean(false); + verifier.setLogFileName(phase + ".txt"); + verifier.setForkJvm(true); // required due to --fail-on-severity + verifier.addCliArgument("-fos"); + verifier.addCliArgument("WARN"); // ALSO NO WARNINGS + verifier.addCliArgument(phase); verifier.execute(); verifier.verifyErrorFreeLog(); } @Test - public void testItShouldWarnForCompilerPlugin() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6562-default-bindings" ); + public void testItShouldWarnForCompilerPlugin() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-6562-default-bindings"); String phase = "compile"; - Verifier verifier = newVerifier( testDir.getAbsolutePath(), false ); - verifier.setAutoclean( false ); - verifier.setLogFileName( phase +".txt" ); - verifier.addCliArgument( phase ); + Verifier verifier = newVerifier(testDir.getAbsolutePath(), false); + verifier.setAutoclean(false); + verifier.setLogFileName(phase + ".txt"); + verifier.addCliArgument(phase); verifier.execute(); - verifier.verifyTextInLog( "Version not locked for default bindings plugins [maven-compiler-plugin]" - + ", you should define versions in pluginManagement section of your pom.xml or parent" ); + verifier.verifyTextInLog("Version not locked for default bindings plugins [maven-compiler-plugin]" + + ", you should define versions in pluginManagement section of your pom.xml or parent"); } @Test - public void testItShouldWarnForCompilerPlugin2() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6562-default-bindings" ); + public void testItShouldWarnForCompilerPlugin2() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-6562-default-bindings"); String phase = "process-test-resources"; - Verifier verifier = newVerifier( testDir.getAbsolutePath(), false ); - verifier.setAutoclean( false ); - verifier.setLogFileName( phase +".txt" ); - verifier.addCliArgument( phase ); + Verifier verifier = newVerifier(testDir.getAbsolutePath(), false); + verifier.setAutoclean(false); + verifier.setLogFileName(phase + ".txt"); + verifier.addCliArgument(phase); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyTextInLog( "Version not locked for default bindings plugins [maven-compiler-plugin]" - + ", you should define versions in pluginManagement section of your pom.xml or parent" ); + verifier.verifyTextInLog("Version not locked for default bindings plugins [maven-compiler-plugin]" + + ", you should define versions in pluginManagement section of your pom.xml or parent"); } @Test - public void testItShouldWarnForCompilerPlugin3() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6562-default-bindings" ); + public void testItShouldWarnForCompilerPlugin3() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-6562-default-bindings"); String phase = "test-compile"; - Verifier verifier = newVerifier( testDir.getAbsolutePath(), false ); - verifier.setAutoclean( false ); - verifier.setLogFileName( phase +".txt" ); - verifier.addCliArgument( phase ); + Verifier verifier = newVerifier(testDir.getAbsolutePath(), false); + verifier.setAutoclean(false); + verifier.setLogFileName(phase + ".txt"); + verifier.addCliArgument(phase); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyTextInLog( "Version not locked for default bindings plugins [maven-compiler-plugin]" - + ", you should define versions in pluginManagement section of your pom.xml or parent" ); + verifier.verifyTextInLog("Version not locked for default bindings plugins [maven-compiler-plugin]" + + ", you should define versions in pluginManagement section of your pom.xml or parent"); } @Test - public void testItShouldWarnForCompilerPluginAndSurefirePlugin() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6562-default-bindings" ); + public void testItShouldWarnForCompilerPluginAndSurefirePlugin() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-6562-default-bindings"); String phase = "test"; - Verifier verifier = newVerifier( testDir.getAbsolutePath(), false ); - verifier.setAutoclean( false ); - verifier.setLogFileName( phase +".txt" ); - verifier.addCliArgument( phase ); + Verifier verifier = newVerifier(testDir.getAbsolutePath(), false); + verifier.setAutoclean(false); + verifier.setLogFileName(phase + ".txt"); + verifier.addCliArgument(phase); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyTextInLog( "Version not locked for default bindings plugins [maven-compiler-plugin, maven-surefire-plugin]" - + ", you should define versions in pluginManagement section of your pom.xml or parent" ); + verifier.verifyTextInLog( + "Version not locked for default bindings plugins [maven-compiler-plugin, maven-surefire-plugin]" + + ", you should define versions in pluginManagement section of your pom.xml or parent"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6566ExecuteAnnotationShouldNotReExecuteGoalsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6566ExecuteAnnotationShouldNotReExecuteGoalsTest.java index 2b2ee346d7..62b8fed144 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6566ExecuteAnnotationShouldNotReExecuteGoalsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6566ExecuteAnnotationShouldNotReExecuteGoalsTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,57 +16,50 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -public class MavenITmng6566ExecuteAnnotationShouldNotReExecuteGoalsTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng6566ExecuteAnnotationShouldNotReExecuteGoalsTest extends AbstractMavenIntegrationTestCase { private static final String RESOURCE_PATH = "/mng-6566-execute-annotation-should-not-re-execute-goals"; private static final String PLUGIN_KEY = "org.apache.maven.its.mng6566:plugin:1.0-SNAPSHOT"; private File testDir; - public MavenITmng6566ExecuteAnnotationShouldNotReExecuteGoalsTest() - { - super( "[4.0.0-alpha-1,)" ); + public MavenITmng6566ExecuteAnnotationShouldNotReExecuteGoalsTest() { + super("[4.0.0-alpha-1,)"); } @BeforeEach - public void setUp() - throws Exception - { - testDir = ResourceExtractor.simpleExtractResources( getClass(), RESOURCE_PATH ); + public void setUp() throws Exception { + testDir = ResourceExtractor.simpleExtractResources(getClass(), RESOURCE_PATH); - File pluginDir = new File( testDir, "plugin" ); - Verifier verifier = newVerifier( pluginDir.getAbsolutePath(), "remote" ); - verifier.addCliArgument( "install" ); + File pluginDir = new File(testDir, "plugin"); + Verifier verifier = newVerifier(pluginDir.getAbsolutePath(), "remote"); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); } @Test - public void testRunsCompileGoalOnceWithDirectPluginInvocation() - throws Exception - { - File consumerDir = new File( testDir, "consumer" ); + public void testRunsCompileGoalOnceWithDirectPluginInvocation() throws Exception { + File consumerDir = new File(testDir, "consumer"); - Verifier verifier = newVerifier( consumerDir.getAbsolutePath() ); - verifier.setLogFileName( "log-direct-plugin-invocation.txt" ); - verifier.addCliArgument( PLUGIN_KEY + ":require-compile-phase" ); + Verifier verifier = newVerifier(consumerDir.getAbsolutePath()); + verifier.setLogFileName("log-direct-plugin-invocation.txt"); + verifier.addCliArgument(PLUGIN_KEY + ":require-compile-phase"); verifier.execute(); verifier.verifyErrorFreeLog(); - assertCompiledOnce( verifier ); - verifier.verifyTextInLog( "MNG-6566 plugin require-compile-phase goal executed" ); + assertCompiledOnce(verifier); + verifier.verifyTextInLog("MNG-6566 plugin require-compile-phase goal executed"); } /** @@ -77,33 +68,27 @@ public class MavenITmng6566ExecuteAnnotationShouldNotReExecuteGoalsTest * @throws Exception in case of failure */ @Test - public void testRunsCompileGoalOnceWithPhaseExecution() - throws Exception - { - File consumerDir = new File( testDir, "consumer" ); + public void testRunsCompileGoalOnceWithPhaseExecution() throws Exception { + File consumerDir = new File(testDir, "consumer"); - Verifier verifier = newVerifier( consumerDir.getAbsolutePath() ); - verifier.setLogFileName( "log-phase-execution.txt" ); - verifier.addCliArgument( "compile" ); + Verifier verifier = newVerifier(consumerDir.getAbsolutePath()); + verifier.setLogFileName("log-phase-execution.txt"); + verifier.addCliArgument("compile"); verifier.execute(); verifier.verifyErrorFreeLog(); - assertCompiledOnce( verifier ); - verifier.verifyTextInLog( "MNG-6566 plugin require-compile-phase goal executed" ); + assertCompiledOnce(verifier); + verifier.verifyTextInLog("MNG-6566 plugin require-compile-phase goal executed"); } - private void assertCompiledOnce( Verifier verifier ) - throws VerificationException - { - List lines = verifier.loadFile( verifier.getBasedir(), verifier.getLogFileName(), false ); + private void assertCompiledOnce(Verifier verifier) throws VerificationException { + List lines = verifier.loadFile(verifier.getBasedir(), verifier.getLogFileName(), false); int counter = 0; - for ( String line : lines ) - { - if ( line.contains( "compiler:0.1-stub-SNAPSHOT:compile") ) - { + for (String line : lines) { + if (line.contains("compiler:0.1-stub-SNAPSHOT:compile")) { counter++; } } - assertEquals( "Compile goal was expected to run once", counter, 1 ); + assertEquals("Compile goal was expected to run once", counter, 1); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6609ProfileActivationForPackagingTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6609ProfileActivationForPackagingTest.java index d5047d5b5c..111f4a0113 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6609ProfileActivationForPackagingTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6609ProfileActivationForPackagingTest.java @@ -1,3 +1,21 @@ +/* + * 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.it; import java.io.File; @@ -11,13 +29,10 @@ import org.junit.jupiter.api.Test; * This is a test set for MNG-6609. * Similar to {@link MavenITmng2276ProfileActivationBySettingsPropertyTest}. */ -class MavenITmng6609ProfileActivationForPackagingTest - extends AbstractMavenIntegrationTestCase -{ +class MavenITmng6609ProfileActivationForPackagingTest extends AbstractMavenIntegrationTestCase { - public MavenITmng6609ProfileActivationForPackagingTest() - { - super( "[3.9.0,4.0.0-alpha-1),[4.0.0-alpha-3,)" ); + public MavenITmng6609ProfileActivationForPackagingTest() { + super("[3.9.0,4.0.0-alpha-1),[4.0.0-alpha-3,)"); } /** @@ -27,24 +42,22 @@ class MavenITmng6609ProfileActivationForPackagingTest * @throws Exception in case of failure */ @Test - void testitMojoExecution() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6609" ); + void testitMojoExecution() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-6609"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - Properties props = verifier.loadProperties( "target/profile.properties" ); - assertEquals( "pom", props.getProperty( "project.properties.packaging" ) ); - props = verifier.loadProperties( "jar/target/profile.properties" ); - assertEquals( "jar", props.getProperty( "project.properties.packaging" ) ); - props = verifier.loadProperties( "jar-no-packaging/target/profile.properties" ); - assertEquals( "jar", props.getProperty( "project.properties.packaging" ) ); - props = verifier.loadProperties( "war/target/profile.properties" ); - assertEquals( "war", props.getProperty( "project.properties.packaging" ) ); + Properties props = verifier.loadProperties("target/profile.properties"); + assertEquals("pom", props.getProperty("project.properties.packaging")); + props = verifier.loadProperties("jar/target/profile.properties"); + assertEquals("jar", props.getProperty("project.properties.packaging")); + props = verifier.loadProperties("jar-no-packaging/target/profile.properties"); + assertEquals("jar", props.getProperty("project.properties.packaging")); + props = verifier.loadProperties("war/target/profile.properties"); + assertEquals("war", props.getProperty("project.properties.packaging")); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6656BuildConsumer.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6656BuildConsumer.java index f697516981..a5ec53118c 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6656BuildConsumer.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6656BuildConsumer.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,15 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.io.IOException; -import java.util.Collections; import org.apache.maven.shared.utils.io.FileUtils; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -46,13 +43,10 @@ import org.junit.jupiter.api.Test; * MNG-6656. * */ -public class MavenITmng6656BuildConsumer - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng6656BuildConsumer extends AbstractMavenIntegrationTestCase { - public MavenITmng6656BuildConsumer() - { - super( "[4.0.0-alpha-1,)" ); + public MavenITmng6656BuildConsumer() { + super("[4.0.0-alpha-1,)"); } /** @@ -67,36 +61,39 @@ public class MavenITmng6656BuildConsumer * @throws Exception in case of failure */ @Test - public void testPublishedPoms() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6656-buildconsumer" ); + public void testPublishedPoms() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-6656-buildconsumer"); - Verifier verifier = newVerifier( testDir.getAbsolutePath(), false ); - verifier.setAutoclean( false ); - verifier.addCliArgument( "-Dchangelist=MNG6656" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath(), false); + verifier.setAutoclean(false); + verifier.addCliArgument("-Dchangelist=MNG6656"); - verifier.addCliArgument( "install" ); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); - assertTextEquals( new File( testDir, "expected/parent.pom"), - new File( verifier.getArtifactPath( "org.sonatype.mavenbook.multi", "parent", "0.9-MNG6656-SNAPSHOT", "pom" ) ) ); + assertTextEquals( + new File(testDir, "expected/parent.pom"), + new File(verifier.getArtifactPath( + "org.sonatype.mavenbook.multi", "parent", "0.9-MNG6656-SNAPSHOT", "pom"))); - assertTextEquals( new File( testDir, "expected/simple-parent.pom"), - new File( verifier.getArtifactPath( "org.sonatype.mavenbook.multi", "simple-parent", "0.9-MNG6656-SNAPSHOT", "pom" ) ) ); + assertTextEquals( + new File(testDir, "expected/simple-parent.pom"), + new File(verifier.getArtifactPath( + "org.sonatype.mavenbook.multi", "simple-parent", "0.9-MNG6656-SNAPSHOT", "pom"))); - assertTextEquals( new File( testDir, "expected/simple-weather.pom"), - new File( verifier.getArtifactPath( "org.sonatype.mavenbook.multi", "simple-weather", "0.9-MNG6656-SNAPSHOT", "pom" ) ) ); + assertTextEquals( + new File(testDir, "expected/simple-weather.pom"), + new File(verifier.getArtifactPath( + "org.sonatype.mavenbook.multi", "simple-weather", "0.9-MNG6656-SNAPSHOT", "pom"))); - assertTextEquals( new File( testDir, "expected/simple-webapp.pom"), - new File( verifier.getArtifactPath( "org.sonatype.mavenbook.multi", "simple-webapp", "0.9-MNG6656-SNAPSHOT", "pom" ) ) ); + assertTextEquals( + new File(testDir, "expected/simple-webapp.pom"), + new File(verifier.getArtifactPath( + "org.sonatype.mavenbook.multi", "simple-webapp", "0.9-MNG6656-SNAPSHOT", "pom"))); } - static void assertTextEquals( File file1, File file2 ) - throws IOException - { - assertEquals( FileUtils.loadFile( file1 ), FileUtils.loadFile( file2 ) ); + static void assertTextEquals(File file1, File file2) throws IOException { + assertEquals(FileUtils.loadFile(file1), FileUtils.loadFile(file2)); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6720FailFastTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6720FailFastTest.java index e9f5e7a4ea..8090ce94a4 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6720FailFastTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6720FailFastTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,7 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.it; import java.io.File; import java.util.List; @@ -34,44 +33,36 @@ import org.junit.jupiter.api.Test; * MNG-6720. * */ -class MavenITmng6720FailFastTest - extends AbstractMavenIntegrationTestCase -{ +class MavenITmng6720FailFastTest extends AbstractMavenIntegrationTestCase { - public MavenITmng6720FailFastTest() - { - super( "[3.6.2,)" ); + public MavenITmng6720FailFastTest() { + super("[3.6.2,)"); } @Test - void testItShouldWaitForConcurrentModulesToFinish() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6720-fail-fast" ); + void testItShouldWaitForConcurrentModulesToFinish() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-6720-fail-fast"); - Verifier verifier = newVerifier( testDir.getAbsolutePath(), false ); - verifier.setAutoclean( false ); - verifier.addCliArguments( "-T", "2" ); - verifier.addCliArgument( "-Dmaven.test.redirectTestOutputToFile=true" ); - verifier.addCliArguments( "clean", "test" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath(), false); + verifier.setAutoclean(false); + verifier.addCliArguments("-T", "2"); + verifier.addCliArgument("-Dmaven.test.redirectTestOutputToFile=true"); + verifier.addCliArguments("clean", "test"); - try - { + try { verifier.execute(); - } - catch ( VerificationException e) - { - //expected + } catch (VerificationException e) { + // expected } - List module1Lines = verifier.loadFile( - new File( testDir, "module-1/target/surefire-reports/Module1Test-output.txt" ), false ); - assertTrue( "module-1 should be executed", module1Lines.contains( "Module1" ) ); - List module2Lines = verifier.loadFile( - new File( testDir, "module-2/target/surefire-reports/Module2Test-output.txt" ), false ); - assertTrue("module-2 should be executed", module2Lines.contains( "Module2" ) ); - List module3Lines = verifier.loadFile( - new File( testDir, "module-3/target/surefire-reports/Module3Test-output.txt" ), false ); - assertTrue( "module-3 should be skipped", module3Lines.isEmpty() ); + List module1Lines = + verifier.loadFile(new File(testDir, "module-1/target/surefire-reports/Module1Test-output.txt"), false); + assertTrue("module-1 should be executed", module1Lines.contains("Module1")); + List module2Lines = + verifier.loadFile(new File(testDir, "module-2/target/surefire-reports/Module2Test-output.txt"), false); + assertTrue("module-2 should be executed", module2Lines.contains("Module2")); + List module3Lines = + verifier.loadFile(new File(testDir, "module-3/target/surefire-reports/Module3Test-output.txt"), false); + assertTrue("module-3 should be skipped", module3Lines.isEmpty()); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6754TimestampInMultimoduleProject.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6754TimestampInMultimoduleProject.java index 874342f74d..4d0f4e8042 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6754TimestampInMultimoduleProject.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6754TimestampInMultimoduleProject.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,9 +16,7 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.io.IOException; @@ -32,191 +28,364 @@ import java.util.Properties; import org.apache.maven.artifact.repository.metadata.Metadata; import org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Reader; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.codehaus.plexus.util.xml.pull.XmlPullParserException; import org.junit.jupiter.api.Test; -public class MavenITmng6754TimestampInMultimoduleProject - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng6754TimestampInMultimoduleProject extends AbstractMavenIntegrationTestCase { private static final String RESOURCE_PATH = "/mng-6754-version-timestamp-in-multimodule-build"; private static final String VERSION = "1.0-SNAPSHOT"; - - public MavenITmng6754TimestampInMultimoduleProject() - { - super( "[3.8.2,)" ); + public MavenITmng6754TimestampInMultimoduleProject() { + super("[3.8.2,)"); } @Test - public void testArtifactsHaveSameTimestamp() - throws Exception - { - final File testDir = ResourceExtractor.simpleExtractResources( getClass(), RESOURCE_PATH ); - final Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - final Path localRepoDir = Paths.get( verifier.getLocalRepository() ); - final Path remoteRepoDir = Paths.get( verifier.getBasedir(), "repo" ); + public void testArtifactsHaveSameTimestamp() throws Exception { + final File testDir = ResourceExtractor.simpleExtractResources(getClass(), RESOURCE_PATH); + final Verifier verifier = newVerifier(testDir.getAbsolutePath()); + final Path localRepoDir = Paths.get(verifier.getLocalRepository()); + final Path remoteRepoDir = Paths.get(verifier.getBasedir(), "repo"); - verifier.deleteDirectory( "repo" ); - verifier.deleteArtifacts ( "org.apache.maven.its.mng6754" ); - verifier.addCliArgument( "-Drepodir=" + remoteRepoDir ); - verifier.addCliArgument( "deploy" ); + verifier.deleteDirectory("repo"); + verifier.deleteArtifacts("org.apache.maven.its.mng6754"); + verifier.addCliArgument("-Drepodir=" + remoteRepoDir); + verifier.addCliArgument("deploy"); verifier.execute(); verifier.verifyErrorFreeLog(); - final Properties props = verifier.loadProperties( "target/timestamp.properties" ); + final Properties props = verifier.loadProperties("target/timestamp.properties"); // Reference timestamp - final String mavenBuildTimestamp = props.getProperty( "project.properties.timestamp" ); + final String mavenBuildTimestamp = props.getProperty("project.properties.timestamp"); - final Metadata parentMetadataLocal = getMetadata( getLocalMetadataPath( localRepoDir, "parent", null ) ); - final Metadata aMetadataLocal = getMetadata( getLocalMetadataPath( localRepoDir, "child-a", null ) ); - final Metadata bMetadataLocal = getMetadata( getLocalMetadataPath( localRepoDir, "child-b", null ) ); + final Metadata parentMetadataLocal = getMetadata(getLocalMetadataPath(localRepoDir, "parent", null)); + final Metadata aMetadataLocal = getMetadata(getLocalMetadataPath(localRepoDir, "child-a", null)); + final Metadata bMetadataLocal = getMetadata(getLocalMetadataPath(localRepoDir, "child-b", null)); - final String parentLastUpdatedLocal = parentMetadataLocal.getVersioning().getLastUpdated(); + final String parentLastUpdatedLocal = + parentMetadataLocal.getVersioning().getLastUpdated(); final String aLastUpdatedLocal = aMetadataLocal.getVersioning().getLastUpdated(); final String bLastUpdatedLocal = bMetadataLocal.getVersioning().getLastUpdated(); - assertEquals ( "parent", "local", "lastUpdated", mavenBuildTimestamp, parentLastUpdatedLocal ); - assertEquals ( "child-a", "local", "lastUpdated", mavenBuildTimestamp, aLastUpdatedLocal ); - assertEquals ( "child-b", "local", "lastUpdated", mavenBuildTimestamp, bLastUpdatedLocal ); + assertEquals("parent", "local", "lastUpdated", mavenBuildTimestamp, parentLastUpdatedLocal); + assertEquals("child-a", "local", "lastUpdated", mavenBuildTimestamp, aLastUpdatedLocal); + assertEquals("child-b", "local", "lastUpdated", mavenBuildTimestamp, bLastUpdatedLocal); - final Metadata parentVersionedMetadataLocal = getMetadata( getLocalMetadataPath( localRepoDir, "parent", VERSION ) ); - final Metadata aVersionedMetadataLocal = getMetadata( getLocalMetadataPath( localRepoDir, "child-a", VERSION ) ); - final Metadata bVersionedMetadataLocal = getMetadata( getLocalMetadataPath( localRepoDir, "child-b", VERSION ) ); + final Metadata parentVersionedMetadataLocal = + getMetadata(getLocalMetadataPath(localRepoDir, "parent", VERSION)); + final Metadata aVersionedMetadataLocal = getMetadata(getLocalMetadataPath(localRepoDir, "child-a", VERSION)); + final Metadata bVersionedMetadataLocal = getMetadata(getLocalMetadataPath(localRepoDir, "child-b", VERSION)); - final String parentVersionedLastUpdatedLocal = parentVersionedMetadataLocal.getVersioning().getLastUpdated(); - final String parentVersionedSnapshotVersionUpdatedLocal = parentVersionedMetadataLocal.getVersioning().getSnapshotVersions().get( 0 ).getUpdated(); - final String aLastVersionedUpdatedLocal = aVersionedMetadataLocal.getVersioning().getLastUpdated(); - final String aVersionedSnapshotVersionUpdated1Local = aVersionedMetadataLocal.getVersioning().getSnapshotVersions().get( 0 ).getUpdated(); - final String aVersionedSnapshotVersionUpdated2Local = aVersionedMetadataLocal.getVersioning().getSnapshotVersions().get( 1 ).getUpdated(); - final String bLastVersionedUpdatedLocal = bVersionedMetadataLocal.getVersioning().getLastUpdated(); - final String bVersionedSnapshotVersionUpdated1Local = bVersionedMetadataLocal.getVersioning().getSnapshotVersions().get( 0 ).getUpdated(); - final String bVersionedSnapshotVersionUpdated2Local = bVersionedMetadataLocal.getVersioning().getSnapshotVersions().get( 1 ).getUpdated(); + final String parentVersionedLastUpdatedLocal = + parentVersionedMetadataLocal.getVersioning().getLastUpdated(); + final String parentVersionedSnapshotVersionUpdatedLocal = parentVersionedMetadataLocal + .getVersioning() + .getSnapshotVersions() + .get(0) + .getUpdated(); + final String aLastVersionedUpdatedLocal = + aVersionedMetadataLocal.getVersioning().getLastUpdated(); + final String aVersionedSnapshotVersionUpdated1Local = aVersionedMetadataLocal + .getVersioning() + .getSnapshotVersions() + .get(0) + .getUpdated(); + final String aVersionedSnapshotVersionUpdated2Local = aVersionedMetadataLocal + .getVersioning() + .getSnapshotVersions() + .get(1) + .getUpdated(); + final String bLastVersionedUpdatedLocal = + bVersionedMetadataLocal.getVersioning().getLastUpdated(); + final String bVersionedSnapshotVersionUpdated1Local = bVersionedMetadataLocal + .getVersioning() + .getSnapshotVersions() + .get(0) + .getUpdated(); + final String bVersionedSnapshotVersionUpdated2Local = bVersionedMetadataLocal + .getVersioning() + .getSnapshotVersions() + .get(1) + .getUpdated(); - assertEquals ( "parent", "local", "lastUpdated", mavenBuildTimestamp, parentVersionedLastUpdatedLocal ); - assertEquals ( "parent", "local", "snapshotVersion[0]/updated", mavenBuildTimestamp, parentVersionedSnapshotVersionUpdatedLocal ); - assertEquals ( "child-a", "local", "lastUpdated", mavenBuildTimestamp, aLastVersionedUpdatedLocal ); - assertEquals ( "child-a", "local", "snapshotVersion[0]/updated", mavenBuildTimestamp, aVersionedSnapshotVersionUpdated1Local ); - assertEquals ( "child-a", "local", "snapshotVersion[1]/updated", mavenBuildTimestamp, aVersionedSnapshotVersionUpdated2Local ); - assertEquals ( "child-b", "local", "lastUpdated", mavenBuildTimestamp, bLastVersionedUpdatedLocal ); - assertEquals ( "child-b", "local", "snapshotVersion[0]/updated", mavenBuildTimestamp, bVersionedSnapshotVersionUpdated1Local ); - assertEquals ( "child-b", "local", "snapshotVersion[1]/updated", mavenBuildTimestamp, bVersionedSnapshotVersionUpdated2Local ); + assertEquals("parent", "local", "lastUpdated", mavenBuildTimestamp, parentVersionedLastUpdatedLocal); + assertEquals( + "parent", + "local", + "snapshotVersion[0]/updated", + mavenBuildTimestamp, + parentVersionedSnapshotVersionUpdatedLocal); + assertEquals("child-a", "local", "lastUpdated", mavenBuildTimestamp, aLastVersionedUpdatedLocal); + assertEquals( + "child-a", + "local", + "snapshotVersion[0]/updated", + mavenBuildTimestamp, + aVersionedSnapshotVersionUpdated1Local); + assertEquals( + "child-a", + "local", + "snapshotVersion[1]/updated", + mavenBuildTimestamp, + aVersionedSnapshotVersionUpdated2Local); + assertEquals("child-b", "local", "lastUpdated", mavenBuildTimestamp, bLastVersionedUpdatedLocal); + assertEquals( + "child-b", + "local", + "snapshotVersion[0]/updated", + mavenBuildTimestamp, + bVersionedSnapshotVersionUpdated1Local); + assertEquals( + "child-b", + "local", + "snapshotVersion[1]/updated", + mavenBuildTimestamp, + bVersionedSnapshotVersionUpdated2Local); - final Metadata parentMetadataRemote = getMetadata( getRemoteMetadataPath( remoteRepoDir, "parent", null ) ); - final Metadata aMetadataRemote = getMetadata( getRemoteMetadataPath( remoteRepoDir, "child-a", null ) ); - final Metadata bMetadataRemote = getMetadata( getRemoteMetadataPath( remoteRepoDir, "child-b", null ) ); + final Metadata parentMetadataRemote = getMetadata(getRemoteMetadataPath(remoteRepoDir, "parent", null)); + final Metadata aMetadataRemote = getMetadata(getRemoteMetadataPath(remoteRepoDir, "child-a", null)); + final Metadata bMetadataRemote = getMetadata(getRemoteMetadataPath(remoteRepoDir, "child-b", null)); - final String parentLastUpdatedRemote = parentMetadataRemote.getVersioning().getLastUpdated(); + final String parentLastUpdatedRemote = + parentMetadataRemote.getVersioning().getLastUpdated(); final String aLastUpdatedRemote = aMetadataRemote.getVersioning().getLastUpdated(); final String bLastUpdatedRemote = bMetadataRemote.getVersioning().getLastUpdated(); - assertEquals ( "parent", "remote", "lastUpdated", mavenBuildTimestamp, parentLastUpdatedRemote ); - assertEquals ( "child-a", "remote", "lastUpdated", mavenBuildTimestamp, aLastUpdatedRemote ); - assertEquals ( "child-b", "remote", "lastUpdated", mavenBuildTimestamp, bLastUpdatedRemote ); + assertEquals("parent", "remote", "lastUpdated", mavenBuildTimestamp, parentLastUpdatedRemote); + assertEquals("child-a", "remote", "lastUpdated", mavenBuildTimestamp, aLastUpdatedRemote); + assertEquals("child-b", "remote", "lastUpdated", mavenBuildTimestamp, bLastUpdatedRemote); - final Metadata parentVersionedMetadataRemote = getMetadata( getRemoteMetadataPath( remoteRepoDir, "parent", VERSION ) ); - final Metadata aVersionedMetadataRemote = getMetadata( getRemoteMetadataPath( remoteRepoDir, "child-a", VERSION ) ); - final Metadata bVersionedMetadataRemote = getMetadata( getRemoteMetadataPath( remoteRepoDir, "child-b", VERSION ) ); + final Metadata parentVersionedMetadataRemote = + getMetadata(getRemoteMetadataPath(remoteRepoDir, "parent", VERSION)); + final Metadata aVersionedMetadataRemote = getMetadata(getRemoteMetadataPath(remoteRepoDir, "child-a", VERSION)); + final Metadata bVersionedMetadataRemote = getMetadata(getRemoteMetadataPath(remoteRepoDir, "child-b", VERSION)); - final String parentVersionedLastUpdatedRemote = parentVersionedMetadataRemote.getVersioning().getLastUpdated(); - final String parentVersionedSnapshotTimestamp = parentVersionedMetadataRemote.getVersioning().getSnapshot().getTimestamp().replace( ".", "" ); - final String parentVersionedSnapshotVersionUpdatedRemote = parentVersionedMetadataRemote.getVersioning().getSnapshotVersions().get( 0 ).getUpdated(); - final String parentVersionedSnapshotVersionValueRemote = parentVersionedMetadataRemote.getVersioning().getSnapshotVersions().get( 0 ).getVersion(); - final String aLastVersionedUpdatedRemote = aVersionedMetadataRemote.getVersioning().getLastUpdated(); - final String aVersionedSnapshotTimestamp = aVersionedMetadataRemote.getVersioning().getSnapshot().getTimestamp().replace( ".", "" ); - final String aVersionedSnapshotVersionUpdated1Remote = aVersionedMetadataRemote.getVersioning().getSnapshotVersions().get( 0 ).getUpdated(); - final String aVersionedSnapshotVersionValue1Remote = aVersionedMetadataRemote.getVersioning().getSnapshotVersions().get( 0 ).getVersion(); - final String aVersionedSnapshotVersionUpdated2Remote = aVersionedMetadataRemote.getVersioning().getSnapshotVersions().get( 1 ).getUpdated(); - final String aVersionedSnapshotVersionValue2Remote = aVersionedMetadataRemote.getVersioning().getSnapshotVersions().get( 1 ).getVersion(); - final String bLastVersionedUpdatedRemote = bVersionedMetadataRemote.getVersioning().getLastUpdated(); - final String bVersionedSnapshotTimestamp = bVersionedMetadataRemote.getVersioning().getSnapshot().getTimestamp().replace( ".", "" ); - final String bVersionedSnapshotVersionUpdated1Remote = bVersionedMetadataRemote.getVersioning().getSnapshotVersions().get( 0 ).getUpdated(); - final String bVersionedSnapshotVersionValue1Remote = bVersionedMetadataRemote.getVersioning().getSnapshotVersions().get( 0 ).getVersion(); - final String bVersionedSnapshotVersionUpdated2Remote = bVersionedMetadataRemote.getVersioning().getSnapshotVersions().get( 1 ).getUpdated(); - final String bVersionedSnapshotVersionValue2Remote = bVersionedMetadataRemote.getVersioning().getSnapshotVersions().get( 1 ).getVersion(); + final String parentVersionedLastUpdatedRemote = + parentVersionedMetadataRemote.getVersioning().getLastUpdated(); + final String parentVersionedSnapshotTimestamp = parentVersionedMetadataRemote + .getVersioning() + .getSnapshot() + .getTimestamp() + .replace(".", ""); + final String parentVersionedSnapshotVersionUpdatedRemote = parentVersionedMetadataRemote + .getVersioning() + .getSnapshotVersions() + .get(0) + .getUpdated(); + final String parentVersionedSnapshotVersionValueRemote = parentVersionedMetadataRemote + .getVersioning() + .getSnapshotVersions() + .get(0) + .getVersion(); + final String aLastVersionedUpdatedRemote = + aVersionedMetadataRemote.getVersioning().getLastUpdated(); + final String aVersionedSnapshotTimestamp = aVersionedMetadataRemote + .getVersioning() + .getSnapshot() + .getTimestamp() + .replace(".", ""); + final String aVersionedSnapshotVersionUpdated1Remote = aVersionedMetadataRemote + .getVersioning() + .getSnapshotVersions() + .get(0) + .getUpdated(); + final String aVersionedSnapshotVersionValue1Remote = aVersionedMetadataRemote + .getVersioning() + .getSnapshotVersions() + .get(0) + .getVersion(); + final String aVersionedSnapshotVersionUpdated2Remote = aVersionedMetadataRemote + .getVersioning() + .getSnapshotVersions() + .get(1) + .getUpdated(); + final String aVersionedSnapshotVersionValue2Remote = aVersionedMetadataRemote + .getVersioning() + .getSnapshotVersions() + .get(1) + .getVersion(); + final String bLastVersionedUpdatedRemote = + bVersionedMetadataRemote.getVersioning().getLastUpdated(); + final String bVersionedSnapshotTimestamp = bVersionedMetadataRemote + .getVersioning() + .getSnapshot() + .getTimestamp() + .replace(".", ""); + final String bVersionedSnapshotVersionUpdated1Remote = bVersionedMetadataRemote + .getVersioning() + .getSnapshotVersions() + .get(0) + .getUpdated(); + final String bVersionedSnapshotVersionValue1Remote = bVersionedMetadataRemote + .getVersioning() + .getSnapshotVersions() + .get(0) + .getVersion(); + final String bVersionedSnapshotVersionUpdated2Remote = bVersionedMetadataRemote + .getVersioning() + .getSnapshotVersions() + .get(1) + .getUpdated(); + final String bVersionedSnapshotVersionValue2Remote = bVersionedMetadataRemote + .getVersioning() + .getSnapshotVersions() + .get(1) + .getVersion(); - assertEquals ( "parent", "remote", "lastUpdated", mavenBuildTimestamp, parentVersionedLastUpdatedRemote ); - assertEquals ( "parent", "remote", "snapshot/timestamp", mavenBuildTimestamp, parentVersionedSnapshotTimestamp ); - assertEquals ( "parent", "remote", "snapshotVersion[0]/updated", mavenBuildTimestamp, parentVersionedSnapshotVersionUpdatedRemote ); - assertEquals ( "parent", "remote", "snapshotVersion[0]/value", mavenBuildTimestamp, parentVersionedSnapshotVersionValueRemote.substring( 4, 19 ).replace( ".", "" ) ); - assertEquals ( "child-a", "remote", "lastUpdated", mavenBuildTimestamp, aLastVersionedUpdatedRemote ); - assertEquals ( "child-a", "remote", "snapshot/timestamp", mavenBuildTimestamp, aVersionedSnapshotTimestamp ); - assertEquals ( "child-a", "remote", "snapshotVersion[0]/updated", mavenBuildTimestamp, aVersionedSnapshotVersionUpdated1Remote ); - assertEquals ( "child-a", "remote", "snapshotVersion[0]/value", mavenBuildTimestamp, aVersionedSnapshotVersionValue1Remote.substring( 4, 19 ).replace( ".", "" ) ); - assertEquals ( "child-a", "remote", "snapshotVersion[1]/updated", mavenBuildTimestamp, aVersionedSnapshotVersionUpdated2Remote ); - assertEquals ( "child-a", "remote", "snapshotVersion[1]/value", mavenBuildTimestamp, aVersionedSnapshotVersionValue2Remote.substring( 4, 19 ).replace( ".", "" ) ); - assertEquals ( "child-b", "remote", "lastUpdated", mavenBuildTimestamp, bLastVersionedUpdatedRemote ); - assertEquals ( "child-b", "remote", "snapshot/timestamp", mavenBuildTimestamp, bVersionedSnapshotTimestamp ); - assertEquals ( "child-b", "remote", "snapshotVersion[0]/updated", mavenBuildTimestamp, bVersionedSnapshotVersionUpdated1Remote ); - assertEquals ( "child-b", "remote", "snapshotVersion[0]/value", mavenBuildTimestamp, bVersionedSnapshotVersionValue1Remote.substring( 4, 19 ).replace( ".", "" ) ); - assertEquals ( "child-b", "remote", "snapshotVersion[1]/updated", mavenBuildTimestamp, bVersionedSnapshotVersionUpdated2Remote ); - assertEquals ( "child-b", "remote", "snapshotVersion[1]/value", mavenBuildTimestamp, bVersionedSnapshotVersionValue2Remote.substring( 4, 19 ).replace( ".", "" ) ); - assertPathExists( remoteRepoDir, "parent", "remote", VERSION, "parent-" + parentVersionedSnapshotVersionValueRemote + ".pom" ); - assertPathExists( remoteRepoDir, "child-a", "remote", VERSION, "child-a-" + aVersionedSnapshotVersionValue1Remote + ".pom" ); - assertPathExists( remoteRepoDir, "child-a", "remote", VERSION, "child-a-" + aVersionedSnapshotVersionValue2Remote + ".jar" ); - assertPathExists( remoteRepoDir, "child-b", "remote", VERSION, "child-b-" + bVersionedSnapshotVersionValue1Remote + ".pom" ); - assertPathExists( remoteRepoDir, "child-b", "remote", VERSION, "child-b-" + bVersionedSnapshotVersionValue2Remote + ".jar" ); + assertEquals("parent", "remote", "lastUpdated", mavenBuildTimestamp, parentVersionedLastUpdatedRemote); + assertEquals("parent", "remote", "snapshot/timestamp", mavenBuildTimestamp, parentVersionedSnapshotTimestamp); + assertEquals( + "parent", + "remote", + "snapshotVersion[0]/updated", + mavenBuildTimestamp, + parentVersionedSnapshotVersionUpdatedRemote); + assertEquals( + "parent", + "remote", + "snapshotVersion[0]/value", + mavenBuildTimestamp, + parentVersionedSnapshotVersionValueRemote.substring(4, 19).replace(".", "")); + assertEquals("child-a", "remote", "lastUpdated", mavenBuildTimestamp, aLastVersionedUpdatedRemote); + assertEquals("child-a", "remote", "snapshot/timestamp", mavenBuildTimestamp, aVersionedSnapshotTimestamp); + assertEquals( + "child-a", + "remote", + "snapshotVersion[0]/updated", + mavenBuildTimestamp, + aVersionedSnapshotVersionUpdated1Remote); + assertEquals( + "child-a", + "remote", + "snapshotVersion[0]/value", + mavenBuildTimestamp, + aVersionedSnapshotVersionValue1Remote.substring(4, 19).replace(".", "")); + assertEquals( + "child-a", + "remote", + "snapshotVersion[1]/updated", + mavenBuildTimestamp, + aVersionedSnapshotVersionUpdated2Remote); + assertEquals( + "child-a", + "remote", + "snapshotVersion[1]/value", + mavenBuildTimestamp, + aVersionedSnapshotVersionValue2Remote.substring(4, 19).replace(".", "")); + assertEquals("child-b", "remote", "lastUpdated", mavenBuildTimestamp, bLastVersionedUpdatedRemote); + assertEquals("child-b", "remote", "snapshot/timestamp", mavenBuildTimestamp, bVersionedSnapshotTimestamp); + assertEquals( + "child-b", + "remote", + "snapshotVersion[0]/updated", + mavenBuildTimestamp, + bVersionedSnapshotVersionUpdated1Remote); + assertEquals( + "child-b", + "remote", + "snapshotVersion[0]/value", + mavenBuildTimestamp, + bVersionedSnapshotVersionValue1Remote.substring(4, 19).replace(".", "")); + assertEquals( + "child-b", + "remote", + "snapshotVersion[1]/updated", + mavenBuildTimestamp, + bVersionedSnapshotVersionUpdated2Remote); + assertEquals( + "child-b", + "remote", + "snapshotVersion[1]/value", + mavenBuildTimestamp, + bVersionedSnapshotVersionValue2Remote.substring(4, 19).replace(".", "")); + assertPathExists( + remoteRepoDir, + "parent", + "remote", + VERSION, + "parent-" + parentVersionedSnapshotVersionValueRemote + ".pom"); + assertPathExists( + remoteRepoDir, + "child-a", + "remote", + VERSION, + "child-a-" + aVersionedSnapshotVersionValue1Remote + ".pom"); + assertPathExists( + remoteRepoDir, + "child-a", + "remote", + VERSION, + "child-a-" + aVersionedSnapshotVersionValue2Remote + ".jar"); + assertPathExists( + remoteRepoDir, + "child-b", + "remote", + VERSION, + "child-b-" + bVersionedSnapshotVersionValue1Remote + ".pom"); + assertPathExists( + remoteRepoDir, + "child-b", + "remote", + VERSION, + "child-b-" + bVersionedSnapshotVersionValue2Remote + ".jar"); } - private Path getLocalMetadataPath( final Path repoDir, final String moduleName, String version ) - { - return getRepoFile(repoDir, moduleName, version, "maven-metadata-local.xml" ); + private Path getLocalMetadataPath(final Path repoDir, final String moduleName, String version) { + return getRepoFile(repoDir, moduleName, version, "maven-metadata-local.xml"); } - private Path getRemoteMetadataPath( final Path repoDir, final String moduleName, String version ) - { - return getRepoFile(repoDir, moduleName, version, "maven-metadata.xml" ); + private Path getRemoteMetadataPath(final Path repoDir, final String moduleName, String version) { + return getRepoFile(repoDir, moduleName, version, "maven-metadata.xml"); } - private Path getRepoFile( final Path repoDir, final String moduleName, String version, String fileName ) - { - final Path mng6754Path = Paths.get( "org", "apache", "maven", "its", "mng6754" ); - Path modulePath = repoDir.resolve( mng6754Path.resolve( moduleName ) ); - if ( version != null ) - { - modulePath = modulePath.resolve( version ); + private Path getRepoFile(final Path repoDir, final String moduleName, String version, String fileName) { + final Path mng6754Path = Paths.get("org", "apache", "maven", "its", "mng6754"); + Path modulePath = repoDir.resolve(mng6754Path.resolve(moduleName)); + if (version != null) { + modulePath = modulePath.resolve(version); } - return modulePath.resolve( fileName ); + return modulePath.resolve(fileName); } - private Metadata getMetadata( final Path metadataFile ) throws IOException, XmlPullParserException - { + private Metadata getMetadata(final Path metadataFile) throws IOException, XmlPullParserException { MetadataXpp3Reader r = new MetadataXpp3Reader(); - try ( InputStream is = Files.newInputStream( metadataFile ) ) - { - return r.read( is ); + try (InputStream is = Files.newInputStream(metadataFile)) { + return r.read(is); } } - private void assertEquals( String moduleName, String location, String field, String expected, String actual ) - { + private void assertEquals(String moduleName, String location, String field, String expected, String actual) { String phase = null; - switch ( location ) - { - case "local": - phase = "Installed"; - break; - case "remote": - phase = "Deployed"; - break; + switch (location) { + case "local": + phase = "Installed"; + break; + case "remote": + phase = "Deployed"; + break; } - assertEquals( String.format( "%s %s module should have equal %s %s with the Maven build timestamp", - phase, moduleName, location, field ), expected, actual ); + assertEquals( + String.format( + "%s %s module should have equal %s %s with the Maven build timestamp", + phase, moduleName, location, field), + expected, + actual); } - private void assertPathExists( Path repoDir, String moduleName, String location, String version, String fileName ) - { + private void assertPathExists(Path repoDir, String moduleName, String location, String version, String fileName) { String phase = null; - switch ( location ) - { - case "local": - phase = "Installed"; - break; - case "remote": - phase = "Deployed"; - break; + switch (location) { + case "local": + phase = "Installed"; + break; + case "remote": + phase = "Deployed"; + break; } - Path file = getRepoFile( repoDir, moduleName, version, fileName ); - assertTrue( String.format( "%s %s module %s file %s should exist", - phase, moduleName, location, file ), Files.exists( file ) ); + Path file = getRepoFile(repoDir, moduleName, version, fileName); + assertTrue( + String.format("%s %s module %s file %s should exist", phase, moduleName, location, file), + Files.exists(file)); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6759TransitiveDependencyRepositoriesTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6759TransitiveDependencyRepositoriesTest.java index c82e9ac70b..0369f64940 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6759TransitiveDependencyRepositoriesTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6759TransitiveDependencyRepositoriesTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.net.URI; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -35,7 +33,7 @@ public class MavenITmng6759TransitiveDependencyRepositoriesTest extends Abstract private final String projectBaseDir = "/mng-6759-transitive-dependency-repositories"; public MavenITmng6759TransitiveDependencyRepositoriesTest() { - super( "(,3.6.2),(3.6.2,)" ); + super("(,3.6.2),(3.6.2,)"); } /** @@ -47,32 +45,29 @@ public class MavenITmng6759TransitiveDependencyRepositoriesTest extends Abstract @Test public void testTransitiveDependenciesAccountForRepositoriesListedByDependencyTrailPredecessor() throws Exception { installDependencyCInCustomRepo(); - File testDir = ResourceExtractor.simpleExtractResources( getClass(), projectBaseDir ); + File testDir = ResourceExtractor.simpleExtractResources(getClass(), projectBaseDir); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); - verifier.addCliArgument( "package" ); + verifier.addCliArgument("package"); verifier.execute(); verifier.verifyErrorFreeLog(); } private void installDependencyCInCustomRepo() throws Exception { - File dependencyCProjectDir = ResourceExtractor.simpleExtractResources( getClass(), projectBaseDir + "/dependency-in-custom-repo" ); - URI customRepoUri = new File(new File(dependencyCProjectDir, "target" ), "repo" ).toURI(); - Verifier verifier = newVerifier( dependencyCProjectDir.getAbsolutePath() ); + File dependencyCProjectDir = + ResourceExtractor.simpleExtractResources(getClass(), projectBaseDir + "/dependency-in-custom-repo"); + URI customRepoUri = new File(new File(dependencyCProjectDir, "target"), "repo").toURI(); + Verifier verifier = newVerifier(dependencyCProjectDir.getAbsolutePath()); - verifier.deleteDirectory( "target" ); - if ( getMavenVersion().getMajorVersion() <= 3 ) - { - verifier.addCliArgument( "-DaltDeploymentRepository=customRepo::default::" + customRepoUri ); + verifier.deleteDirectory("target"); + if (getMavenVersion().getMajorVersion() <= 3) { + verifier.addCliArgument("-DaltDeploymentRepository=customRepo::default::" + customRepoUri); + } else { + verifier.addCliArgument("-DaltDeploymentRepository=customRepo::" + customRepoUri); } - else - { - verifier.addCliArgument( "-DaltDeploymentRepository=customRepo::" + customRepoUri ); - } - verifier.addCliArgument( "deploy" ); + verifier.addCliArgument("deploy"); verifier.execute(); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6772NestedImportScopeRepositoryOverride.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6772NestedImportScopeRepositoryOverride.java index 1d6a3ce4db..eb61c048b7 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6772NestedImportScopeRepositoryOverride.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6772NestedImportScopeRepositoryOverride.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,12 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; @@ -38,65 +36,53 @@ import org.junit.jupiter.api.Test; * */ @Disabled // This IT has been disabled until it is decided how the solution shall look like -public class MavenITmng6772NestedImportScopeRepositoryOverride - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng6772NestedImportScopeRepositoryOverride extends AbstractMavenIntegrationTestCase { - public MavenITmng6772NestedImportScopeRepositoryOverride() - { - super( "(,4.0.0-alpha-1),[4.0.0-alpha-1,)" ); + public MavenITmng6772NestedImportScopeRepositoryOverride() { + super("(,4.0.0-alpha-1),[4.0.0-alpha-1,)"); } // This will test the behavior using ProjectModelResolver @Test - public void testitInProject() - throws Exception - { - final File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6772-override-in-project" ); + public void testitInProject() throws Exception { + final File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-6772-override-in-project"); - final Verifier verifier = newVerifier( testDir.getAbsolutePath(), null ); - overrideGlobalSettings( testDir, verifier ); - verifier.deleteArtifacts( "org.apache.maven.its.mng6772" ); + final Verifier verifier = newVerifier(testDir.getAbsolutePath(), null); + overrideGlobalSettings(testDir, verifier); + verifier.deleteArtifacts("org.apache.maven.its.mng6772"); - verifier.filterFile( "pom-template.xml", "pom.xml", "UTF-8" ); + verifier.filterFile("pom-template.xml", "pom.xml", "UTF-8"); - verifier.addCliArgument( "validate" ); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); } // This will test the behavior using DefaultModelResolver @Test - public void testitInDependency() - throws Exception - { - final File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6772-override-in-dependency" ); + public void testitInDependency() throws Exception { + final File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-6772-override-in-dependency"); - final Verifier verifier = newVerifier( testDir.getAbsolutePath(), null ); - overrideGlobalSettings( testDir, verifier ); - verifier.deleteArtifacts( "org.apache.maven.its.mng6772" ); + final Verifier verifier = newVerifier(testDir.getAbsolutePath(), null); + overrideGlobalSettings(testDir, verifier); + verifier.deleteArtifacts("org.apache.maven.its.mng6772"); - verifier.filterFile( "pom-template.xml", "pom.xml", "UTF-8" ); + verifier.filterFile("pom-template.xml", "pom.xml", "UTF-8"); - verifier.addCliArgument( "compile" ); + verifier.addCliArgument("compile"); verifier.execute(); verifier.verifyErrorFreeLog(); } // central must not be defined in any settings.xml or super POM will never be in play. - private void overrideGlobalSettings( final File testDir, final Verifier verifier ) - { - final File settingsFile = new File( testDir, "settings-override.xml" ); + private void overrideGlobalSettings(final File testDir, final Verifier verifier) { + final File settingsFile = new File(testDir, "settings-override.xml"); final String path = settingsFile.getAbsolutePath(); - verifier.addCliArgument( "--global-settings" ); - if ( path.indexOf( ' ' ) < 0 ) - { - verifier.addCliArgument( path ); - } - else - { - verifier.addCliArgument( '"' + path + '"' ); + verifier.addCliArgument("--global-settings"); + if (path.indexOf(' ') < 0) { + verifier.addCliArgument(path); + } else { + verifier.addCliArgument('"' + path + '"'); } } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6957BuildConsumer.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6957BuildConsumer.java index cdecd61491..5b27a9142d 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6957BuildConsumer.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6957BuildConsumer.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,15 +16,14 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.io.IOException; -import java.util.Collections; import org.apache.maven.shared.utils.io.FileUtils; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -46,13 +43,10 @@ import org.junit.jupiter.api.Test; * MNG-6656. * */ -public class MavenITmng6957BuildConsumer - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng6957BuildConsumer extends AbstractMavenIntegrationTestCase { - public MavenITmng6957BuildConsumer() - { - super( "[4.0.0-alpha-1,)" ); + public MavenITmng6957BuildConsumer() { + super("[4.0.0-alpha-1,)"); } /** @@ -67,42 +61,49 @@ public class MavenITmng6957BuildConsumer * @throws Exception in case of failure */ @Test - public void testPublishedPoms() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6957-buildconsumer" ); + public void testPublishedPoms() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-6957-buildconsumer"); - Verifier verifier = newVerifier( testDir.getAbsolutePath(), false ); - verifier.setAutoclean( false ); - verifier.addCliArgument( "-Dchangelist=MNG6957" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath(), false); + verifier.setAutoclean(false); + verifier.addCliArgument("-Dchangelist=MNG6957"); - verifier.addCliArgument( "install" ); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); - assertTextEquals( new File( testDir, "expected/parent.pom"), - new File( verifier.getArtifactPath( "org.sonatype.mavenbook.multi", "parent", "0.9-MNG6957-SNAPSHOT", "pom" ) ) ); + assertTextEquals( + new File(testDir, "expected/parent.pom"), + new File(verifier.getArtifactPath( + "org.sonatype.mavenbook.multi", "parent", "0.9-MNG6957-SNAPSHOT", "pom"))); - assertTextEquals( new File( testDir, "expected/simple-parent.pom"), - new File( verifier.getArtifactPath( "org.sonatype.mavenbook.multi", "simple-parent", "0.9-MNG6957-SNAPSHOT", "pom" ) ) ); + assertTextEquals( + new File(testDir, "expected/simple-parent.pom"), + new File(verifier.getArtifactPath( + "org.sonatype.mavenbook.multi", "simple-parent", "0.9-MNG6957-SNAPSHOT", "pom"))); - assertTextEquals( new File( testDir, "expected/simple-weather.pom"), - new File( verifier.getArtifactPath( "org.sonatype.mavenbook.multi", "simple-weather", "0.9-MNG6957-SNAPSHOT", "pom" ) ) ); + assertTextEquals( + new File(testDir, "expected/simple-weather.pom"), + new File(verifier.getArtifactPath( + "org.sonatype.mavenbook.multi", "simple-weather", "0.9-MNG6957-SNAPSHOT", "pom"))); - assertTextEquals( new File( testDir, "expected/simple-webapp.pom"), - new File( verifier.getArtifactPath( "org.sonatype.mavenbook.multi", "simple-webapp", "0.9-MNG6957-SNAPSHOT", "pom" ) ) ); + assertTextEquals( + new File(testDir, "expected/simple-webapp.pom"), + new File(verifier.getArtifactPath( + "org.sonatype.mavenbook.multi", "simple-webapp", "0.9-MNG6957-SNAPSHOT", "pom"))); - assertTextEquals( new File( testDir, "expected/simple-testutils.pom"), - new File( verifier.getArtifactPath( "org.sonatype.mavenbook.multi", "simple-testutils", "0.9-MNG6957-SNAPSHOT", "pom" ) ) ); + assertTextEquals( + new File(testDir, "expected/simple-testutils.pom"), + new File(verifier.getArtifactPath( + "org.sonatype.mavenbook.multi", "simple-testutils", "0.9-MNG6957-SNAPSHOT", "pom"))); - assertTextEquals( new File( testDir, "expected/utils-parent.pom"), - new File( verifier.getArtifactPath( "org.sonatype.mavenbook.multi", "utils-parent", "0.9-MNG6957-SNAPSHOT", "pom" ) ) ); + assertTextEquals( + new File(testDir, "expected/utils-parent.pom"), + new File(verifier.getArtifactPath( + "org.sonatype.mavenbook.multi", "utils-parent", "0.9-MNG6957-SNAPSHOT", "pom"))); } - static void assertTextEquals( File file1, File file2 ) - throws IOException - { - assertEquals( FileUtils.loadFile( file1 ), FileUtils.loadFile( file2 ) ); + static void assertTextEquals(File file1, File file2) throws IOException { + assertEquals(FileUtils.loadFile(file1), FileUtils.loadFile(file2)); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6972AllowAccessToGraphPackageTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6972AllowAccessToGraphPackageTest.java index bac8259680..e26d9da554 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6972AllowAccessToGraphPackageTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6972AllowAccessToGraphPackageTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,33 +16,29 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** * This is a test for MNG-6972. */ -public class MavenITmng6972AllowAccessToGraphPackageTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng6972AllowAccessToGraphPackageTest extends AbstractMavenIntegrationTestCase { - public MavenITmng6972AllowAccessToGraphPackageTest() - { - super( "[3.9.0,)" ); + public MavenITmng6972AllowAccessToGraphPackageTest() { + super("[3.9.0,)"); } @Test - public void testit() - throws Exception - { + public void testit() throws Exception { // The testdir is computed from the location of this file. - final File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6972-allow-access-to-graph-package" ); + final File testDir = + ResourceExtractor.simpleExtractResources(getClass(), "/mng-6972-allow-access-to-graph-package"); Verifier verifier; @@ -55,19 +49,19 @@ public class MavenITmng6972AllowAccessToGraphPackageTest * unstable test results. Fortunately, the verifier * makes it easy to do this. */ - verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.deleteArtifact( "mng-6972-allow-access-to-graph-package", "build-plugin", "1.0", "jar" ); - verifier.deleteArtifact( "mng-6972-allow-access-to-graph-package", "using-module", "1.0", "jar" ); + verifier = newVerifier(testDir.getAbsolutePath()); + verifier.deleteArtifact("mng-6972-allow-access-to-graph-package", "build-plugin", "1.0", "jar"); + verifier.deleteArtifact("mng-6972-allow-access-to-graph-package", "using-module", "1.0", "jar"); - verifier = newVerifier( new File( testDir.getAbsolutePath(), "build-plugin" ).getAbsolutePath() ); - verifier.getSystemProperties().put( "maven.multiModuleProjectDirectory", testDir.getAbsolutePath() ); - verifier.addCliArgument( "install" ); + verifier = newVerifier(new File(testDir.getAbsolutePath(), "build-plugin").getAbsolutePath()); + verifier.getSystemProperties().put("maven.multiModuleProjectDirectory", testDir.getAbsolutePath()); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier = newVerifier( new File( testDir.getAbsolutePath(), "using-module" ).getAbsolutePath() ); - verifier.getSystemProperties().put( "maven.multiModuleProjectDirectory", testDir.getAbsolutePath() ); - verifier.addCliArgument( "install" ); + verifier = newVerifier(new File(testDir.getAbsolutePath(), "using-module").getAbsolutePath()); + verifier.getSystemProperties().put("maven.multiModuleProjectDirectory", testDir.getAbsolutePath()); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6981ProjectListShouldIncludeChildrenTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6981ProjectListShouldIncludeChildrenTest.java index a4a51884a2..2fd8da0e50 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6981ProjectListShouldIncludeChildrenTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6981ProjectListShouldIncludeChildrenTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,39 +16,34 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; import java.util.List; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; -public class MavenITmng6981ProjectListShouldIncludeChildrenTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng6981ProjectListShouldIncludeChildrenTest extends AbstractMavenIntegrationTestCase { private static final String RESOURCE_PATH = "/mng-6981-pl-should-include-children"; - public MavenITmng6981ProjectListShouldIncludeChildrenTest() - { - super( "[4.0.0-alpha-1,)" ); + public MavenITmng6981ProjectListShouldIncludeChildrenTest() { + super("[4.0.0-alpha-1,)"); } @Test - public void testProjectListShouldIncludeChildrenByDefault() - throws Exception - { - final File testDir = ResourceExtractor.simpleExtractResources( getClass(), RESOURCE_PATH ); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); + public void testProjectListShouldIncludeChildrenByDefault() throws Exception { + final File testDir = ResourceExtractor.simpleExtractResources(getClass(), RESOURCE_PATH); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); - verifier.addCliArgument( "-pl" ); - verifier.addCliArgument( ":module-a" ); - verifier.addCliArgument( "compile" ); + verifier.addCliArgument("-pl"); + verifier.addCliArgument(":module-a"); + verifier.addCliArgument("compile"); verifier.execute(); - verifier.verifyTextInLog( "Building module-a-1 1.0" ); + verifier.verifyTextInLog("Building module-a-1 1.0"); } /** @@ -59,19 +52,17 @@ public class MavenITmng6981ProjectListShouldIncludeChildrenTest * @throws Exception in case of failure */ @Test - public void testFileSwitchAllowsExcludeOfChildren() - throws Exception - { - final File testDir = ResourceExtractor.simpleExtractResources( getClass(), RESOURCE_PATH ); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); + public void testFileSwitchAllowsExcludeOfChildren() throws Exception { + final File testDir = ResourceExtractor.simpleExtractResources(getClass(), RESOURCE_PATH); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); - verifier.addCliArgument( "-f" ); - verifier.addCliArgument( "module-a" ); - verifier.addCliArgument( "--non-recursive" ); - verifier.setLogFileName( "log-non-recursive.txt" ); - verifier.addCliArgument( "compile" ); + verifier.addCliArgument("-f"); + verifier.addCliArgument("module-a"); + verifier.addCliArgument("--non-recursive"); + verifier.setLogFileName("log-non-recursive.txt"); + verifier.addCliArgument("compile"); verifier.execute(); - verifyTextNotInLog( verifier, "Building module-a-1 1.0" ); + verifyTextNotInLog(verifier, "Building module-a-1 1.0"); } /** @@ -81,16 +72,12 @@ public class MavenITmng6981ProjectListShouldIncludeChildrenTest * @param text the text to assert present * @throws VerificationException if text is not found in log */ - private void verifyTextNotInLog( Verifier verifier, String text ) - throws VerificationException - { - List lines = verifier.loadFile( verifier.getBasedir(), verifier.getLogFileName(), false ); + private void verifyTextNotInLog(Verifier verifier, String text) throws VerificationException { + List lines = verifier.loadFile(verifier.getBasedir(), verifier.getLogFileName(), false); - for ( String line : lines ) - { - if ( Verifier.stripAnsi( line ).contains( text ) ) - { - throw new VerificationException( "Text found in log: " + text ); + for (String line : lines) { + if (Verifier.stripAnsi(line).contains(text)) { + throw new VerificationException("Text found in log: " + text); } } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7038RootdirTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7038RootdirTest.java index caec6e2e27..1808651d49 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7038RootdirTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7038RootdirTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,138 +16,212 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.it; + +import java.io.File; +import java.io.IOException; +import java.util.Properties; import org.apache.maven.shared.verifier.VerificationException; import org.apache.maven.shared.verifier.Verifier; import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; -import java.io.File; -import java.io.IOException; -import java.util.Properties; +public class MavenITmng7038RootdirTest extends AbstractMavenIntegrationTestCase { -public class MavenITmng7038RootdirTest - extends AbstractMavenIntegrationTestCase -{ - - public MavenITmng7038RootdirTest() - { - super( "[4.0.0-alpha-6,)" ); + public MavenITmng7038RootdirTest() { + super("[4.0.0-alpha-6,)"); } @Test - public void testRootdir() - throws IOException, VerificationException - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-7038-rootdir" ); - Verifier verifier = newVerifier( testDir.getAbsolutePath()) ; + public void testRootdir() throws IOException, VerificationException { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-7038-rootdir"); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); - verifier.addCliArgument( "validate" ); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); Properties props; - verifier.verifyFilePresent( "target/pom.properties" ); - props = verifier.loadProperties( "target/pom.properties" ); - assertEquals( "project.properties.rootdir", testDir.getAbsolutePath(), props.getProperty( "project.properties.rootdir" ) ); - assertEquals( "project.rootDirectory", testDir.getAbsolutePath(), props.getProperty( "project.rootDirectory" ) ); - assertEquals( "session.topDirectory", testDir.getAbsolutePath(), props.getProperty( "session.topDirectory" ) ); - assertEquals( "session.rootDirectory", testDir.getAbsolutePath(), props.getProperty( "session.rootDirectory" ) ); - assertEquals( "project.properties.activated", Boolean.TRUE.toString(), props.getProperty( "project.properties.activated" ) ); + verifier.verifyFilePresent("target/pom.properties"); + props = verifier.loadProperties("target/pom.properties"); + assertEquals( + "project.properties.rootdir", + testDir.getAbsolutePath(), + props.getProperty("project.properties.rootdir")); + assertEquals("project.rootDirectory", testDir.getAbsolutePath(), props.getProperty("project.rootDirectory")); + assertEquals("session.topDirectory", testDir.getAbsolutePath(), props.getProperty("session.topDirectory")); + assertEquals("session.rootDirectory", testDir.getAbsolutePath(), props.getProperty("session.rootDirectory")); + assertEquals( + "project.properties.activated", + Boolean.TRUE.toString(), + props.getProperty("project.properties.activated")); - verifier.verifyFilePresent( "module-a/target/pom.properties" ); - props = verifier.loadProperties( "module-a/target/pom.properties" ); - assertEquals( "project.properties.rootdir", new File(testDir, "module-a").getAbsolutePath(), props.getProperty( "project.properties.rootdir" ) ); - assertEquals( "project.rootDirectory", new File(testDir, "module-a").getAbsolutePath(), props.getProperty( "project.rootDirectory" ) ); - assertEquals( "session.topDirectory", testDir.getAbsolutePath(), props.getProperty( "session.topDirectory" ) ); - assertEquals( "session.rootDirectory", testDir.getAbsolutePath(), props.getProperty( "session.rootDirectory" ) ); - assertEquals( "project.properties.activated", Boolean.FALSE.toString(), props.getProperty( "project.properties.activated" ) ); + verifier.verifyFilePresent("module-a/target/pom.properties"); + props = verifier.loadProperties("module-a/target/pom.properties"); + assertEquals( + "project.properties.rootdir", + new File(testDir, "module-a").getAbsolutePath(), + props.getProperty("project.properties.rootdir")); + assertEquals( + "project.rootDirectory", + new File(testDir, "module-a").getAbsolutePath(), + props.getProperty("project.rootDirectory")); + assertEquals("session.topDirectory", testDir.getAbsolutePath(), props.getProperty("session.topDirectory")); + assertEquals("session.rootDirectory", testDir.getAbsolutePath(), props.getProperty("session.rootDirectory")); + assertEquals( + "project.properties.activated", + Boolean.FALSE.toString(), + props.getProperty("project.properties.activated")); - verifier.verifyFilePresent( "module-a/module-a-1/target/pom.properties" ); - props = verifier.loadProperties( "module-a/module-a-1/target/pom.properties" ); - assertEquals( "project.properties.rootdir", new File(testDir, "module-a").getAbsolutePath(), props.getProperty( "project.properties.rootdir" ) ); - assertEquals( "project.rootDirectory", new File(testDir, "module-a").getAbsolutePath(), props.getProperty( "project.rootDirectory" ) ); - assertEquals( "session.topDirectory", testDir.getAbsolutePath(), props.getProperty( "session.topDirectory" ) ); - assertEquals( "session.rootDirectory", testDir.getAbsolutePath(), props.getProperty( "session.rootDirectory" ) ); - assertEquals( "project.properties.activated", Boolean.FALSE.toString(), props.getProperty( "project.properties.activated" ) ); + verifier.verifyFilePresent("module-a/module-a-1/target/pom.properties"); + props = verifier.loadProperties("module-a/module-a-1/target/pom.properties"); + assertEquals( + "project.properties.rootdir", + new File(testDir, "module-a").getAbsolutePath(), + props.getProperty("project.properties.rootdir")); + assertEquals( + "project.rootDirectory", + new File(testDir, "module-a").getAbsolutePath(), + props.getProperty("project.rootDirectory")); + assertEquals("session.topDirectory", testDir.getAbsolutePath(), props.getProperty("session.topDirectory")); + assertEquals("session.rootDirectory", testDir.getAbsolutePath(), props.getProperty("session.rootDirectory")); + assertEquals( + "project.properties.activated", + Boolean.FALSE.toString(), + props.getProperty("project.properties.activated")); - verifier.verifyFilePresent( "module-b/target/pom.properties" ); - props = verifier.loadProperties( "module-b/target/pom.properties" ); - assertEquals( "project.properties.rootdir", testDir.getAbsolutePath(), props.getProperty( "project.properties.rootdir" ) ); - assertEquals( "project.rootDirectory", testDir.getAbsolutePath(), props.getProperty( "project.rootDirectory" ) ); - assertEquals( "session.topDirectory", testDir.getAbsolutePath(), props.getProperty( "session.topDirectory" ) ); - assertEquals( "session.rootDirectory", testDir.getAbsolutePath(), props.getProperty( "session.rootDirectory" ) ); - assertEquals( "project.properties.activated", Boolean.TRUE.toString(), props.getProperty( "project.properties.activated" ) ); + verifier.verifyFilePresent("module-b/target/pom.properties"); + props = verifier.loadProperties("module-b/target/pom.properties"); + assertEquals( + "project.properties.rootdir", + testDir.getAbsolutePath(), + props.getProperty("project.properties.rootdir")); + assertEquals("project.rootDirectory", testDir.getAbsolutePath(), props.getProperty("project.rootDirectory")); + assertEquals("session.topDirectory", testDir.getAbsolutePath(), props.getProperty("session.topDirectory")); + assertEquals("session.rootDirectory", testDir.getAbsolutePath(), props.getProperty("session.rootDirectory")); + assertEquals( + "project.properties.activated", + Boolean.TRUE.toString(), + props.getProperty("project.properties.activated")); - verifier.verifyFilePresent( "module-b/module-b-1/target/pom.properties" ); - props = verifier.loadProperties( "module-b/module-b-1/target/pom.properties" ); - assertEquals( "project.properties.rootdir", testDir.getAbsolutePath(), props.getProperty( "project.properties.rootdir" ) ); - assertEquals( "project.rootDirectory", testDir.getAbsolutePath(), props.getProperty( "project.rootDirectory" ) ); - assertEquals( "session.topDirectory", testDir.getAbsolutePath(), props.getProperty( "session.topDirectory" ) ); - assertEquals( "session.rootDirectory", testDir.getAbsolutePath(), props.getProperty( "session.rootDirectory" ) ); - assertEquals( "project.properties.activated", Boolean.TRUE.toString(), props.getProperty( "project.properties.activated" ) ); + verifier.verifyFilePresent("module-b/module-b-1/target/pom.properties"); + props = verifier.loadProperties("module-b/module-b-1/target/pom.properties"); + assertEquals( + "project.properties.rootdir", + testDir.getAbsolutePath(), + props.getProperty("project.properties.rootdir")); + assertEquals("project.rootDirectory", testDir.getAbsolutePath(), props.getProperty("project.rootDirectory")); + assertEquals("session.topDirectory", testDir.getAbsolutePath(), props.getProperty("session.topDirectory")); + assertEquals("session.rootDirectory", testDir.getAbsolutePath(), props.getProperty("session.rootDirectory")); + assertEquals( + "project.properties.activated", + Boolean.TRUE.toString(), + props.getProperty("project.properties.activated")); } @Test - public void testRootdirWithTopdirAndRoot() - throws IOException, VerificationException - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-7038-rootdir" ); - Verifier verifier = newVerifier( new File(testDir, "module-a").getAbsolutePath()) ; + public void testRootdirWithTopdirAndRoot() throws IOException, VerificationException { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-7038-rootdir"); + Verifier verifier = newVerifier(new File(testDir, "module-a").getAbsolutePath()); - verifier.addCliArgument( "validate" ); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); Properties props; - verifier.verifyFilePresent( "target/pom.properties" ); - props = verifier.loadProperties( "target/pom.properties" ); - assertEquals( "project.properties.rootdir", new File(testDir, "module-a").getAbsolutePath(), props.getProperty( "project.properties.rootdir" ) ); - assertEquals( "project.rootDirectory", new File(testDir, "module-a").getAbsolutePath(), props.getProperty( "project.rootDirectory" ) ); - assertEquals( "session.topDirectory", new File(testDir, "module-a").getAbsolutePath(), props.getProperty( "session.topDirectory" ) ); - assertEquals( "session.rootDirectory", new File(testDir, "module-a").getAbsolutePath(), props.getProperty( "session.rootDirectory" ) ); - assertEquals( "project.properties.activated", Boolean.FALSE.toString(), props.getProperty( "project.properties.activated" ) ); + verifier.verifyFilePresent("target/pom.properties"); + props = verifier.loadProperties("target/pom.properties"); + assertEquals( + "project.properties.rootdir", + new File(testDir, "module-a").getAbsolutePath(), + props.getProperty("project.properties.rootdir")); + assertEquals( + "project.rootDirectory", + new File(testDir, "module-a").getAbsolutePath(), + props.getProperty("project.rootDirectory")); + assertEquals( + "session.topDirectory", + new File(testDir, "module-a").getAbsolutePath(), + props.getProperty("session.topDirectory")); + assertEquals( + "session.rootDirectory", + new File(testDir, "module-a").getAbsolutePath(), + props.getProperty("session.rootDirectory")); + assertEquals( + "project.properties.activated", + Boolean.FALSE.toString(), + props.getProperty("project.properties.activated")); - verifier.verifyFilePresent( "module-a-1/target/pom.properties" ); - props = verifier.loadProperties( "module-a-1/target/pom.properties" ); - assertEquals( "project.properties.rootdir", new File(testDir, "module-a").getAbsolutePath(), props.getProperty( "project.properties.rootdir" ) ); - assertEquals( "project.rootDirectory", new File(testDir, "module-a").getAbsolutePath(), props.getProperty( "project.rootDirectory" ) ); - assertEquals( "session.topDirectory", new File(testDir, "module-a").getAbsolutePath(), props.getProperty( "session.topDirectory" ) ); - assertEquals( "session.rootDirectory", new File(testDir, "module-a").getAbsolutePath(), props.getProperty( "session.rootDirectory" ) ); - assertEquals( "project.properties.activated", Boolean.FALSE.toString(), props.getProperty( "project.properties.activated" ) ); + verifier.verifyFilePresent("module-a-1/target/pom.properties"); + props = verifier.loadProperties("module-a-1/target/pom.properties"); + assertEquals( + "project.properties.rootdir", + new File(testDir, "module-a").getAbsolutePath(), + props.getProperty("project.properties.rootdir")); + assertEquals( + "project.rootDirectory", + new File(testDir, "module-a").getAbsolutePath(), + props.getProperty("project.rootDirectory")); + assertEquals( + "session.topDirectory", + new File(testDir, "module-a").getAbsolutePath(), + props.getProperty("session.topDirectory")); + assertEquals( + "session.rootDirectory", + new File(testDir, "module-a").getAbsolutePath(), + props.getProperty("session.rootDirectory")); + assertEquals( + "project.properties.activated", + Boolean.FALSE.toString(), + props.getProperty("project.properties.activated")); } - @Test - public void testRootdirWithTopdirAndNoRoot() - throws IOException, VerificationException - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-7038-rootdir" ); - Verifier verifier = newVerifier( new File(testDir, "module-b").getAbsolutePath()) ; + public void testRootdirWithTopdirAndNoRoot() throws IOException, VerificationException { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-7038-rootdir"); + Verifier verifier = newVerifier(new File(testDir, "module-b").getAbsolutePath()); - verifier.addCliArgument( "validate" ); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); Properties props; - verifier.verifyFilePresent( "target/pom.properties" ); - props = verifier.loadProperties( "target/pom.properties" ); - assertEquals( "project.properties.rootdir", testDir.getAbsolutePath(), props.getProperty( "project.properties.rootdir" ) ); - assertEquals( "project.rootDirectory", testDir.getAbsolutePath(), props.getProperty( "project.rootDirectory" ) ); - assertEquals( "session.topDirectory", new File(testDir, "module-b").getAbsolutePath(), props.getProperty( "session.topDirectory" ) ); - assertEquals( "session.rootDirectory", testDir.getAbsolutePath(), props.getProperty( "session.rootDirectory" ) ); - assertEquals( "project.properties.activated", Boolean.TRUE.toString(), props.getProperty( "project.properties.activated" ) ); + verifier.verifyFilePresent("target/pom.properties"); + props = verifier.loadProperties("target/pom.properties"); + assertEquals( + "project.properties.rootdir", + testDir.getAbsolutePath(), + props.getProperty("project.properties.rootdir")); + assertEquals("project.rootDirectory", testDir.getAbsolutePath(), props.getProperty("project.rootDirectory")); + assertEquals( + "session.topDirectory", + new File(testDir, "module-b").getAbsolutePath(), + props.getProperty("session.topDirectory")); + assertEquals("session.rootDirectory", testDir.getAbsolutePath(), props.getProperty("session.rootDirectory")); + assertEquals( + "project.properties.activated", + Boolean.TRUE.toString(), + props.getProperty("project.properties.activated")); - verifier.verifyFilePresent( "module-b-1/target/pom.properties" ); - props = verifier.loadProperties( "module-b-1/target/pom.properties" ); - assertEquals( "project.properties.rootdir", testDir.getAbsolutePath(), props.getProperty( "project.properties.rootdir" ) ); - assertEquals( "project.rootDirectory", testDir.getAbsolutePath(), props.getProperty( "project.rootDirectory" ) ); - assertEquals( "session.topDirectory", new File(testDir, "module-b").getAbsolutePath(), props.getProperty( "session.topDirectory" ) ); - assertEquals( "session.rootDirectory", testDir.getAbsolutePath(), props.getProperty( "session.rootDirectory" ) ); - assertEquals( "project.properties.activated", Boolean.TRUE.toString(), props.getProperty( "project.properties.activated" ) ); + verifier.verifyFilePresent("module-b-1/target/pom.properties"); + props = verifier.loadProperties("module-b-1/target/pom.properties"); + assertEquals( + "project.properties.rootdir", + testDir.getAbsolutePath(), + props.getProperty("project.properties.rootdir")); + assertEquals("project.rootDirectory", testDir.getAbsolutePath(), props.getProperty("project.rootDirectory")); + assertEquals( + "session.topDirectory", + new File(testDir, "module-b").getAbsolutePath(), + props.getProperty("session.topDirectory")); + assertEquals("session.rootDirectory", testDir.getAbsolutePath(), props.getProperty("session.rootDirectory")); + assertEquals( + "project.properties.activated", + Boolean.TRUE.toString(), + props.getProperty("project.properties.activated")); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7045DropUselessAndOutdatedCdiApiTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7045DropUselessAndOutdatedCdiApiTest.java index 63fe0fdee1..6f64a22157 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7045DropUselessAndOutdatedCdiApiTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7045DropUselessAndOutdatedCdiApiTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,38 +16,32 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; import java.io.IOException; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; -public class MavenITmng7045DropUselessAndOutdatedCdiApiTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng7045DropUselessAndOutdatedCdiApiTest extends AbstractMavenIntegrationTestCase { - public MavenITmng7045DropUselessAndOutdatedCdiApiTest() - { - super( "[3.8.3,)" ); + public MavenITmng7045DropUselessAndOutdatedCdiApiTest() { + super("[3.8.3,)"); } @Test - public void testShouldNotLeakCdiApi() - throws IOException, VerificationException - { + public void testShouldNotLeakCdiApi() throws IOException, VerificationException { // in test Groovy 4.x is used which requires JDK 1.8, so simply skip it for older JDKs - requiresJavaVersion( "[1.8,)" ); + requiresJavaVersion("[1.8,)"); - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-7045" ); - Verifier verifier = newVerifier( testDir.getAbsolutePath()) ; + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-7045"); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); - verifier.addCliArgument( "process-classes" ); + verifier.addCliArgument("process-classes"); verifier.execute(); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7051OptionalProfileActivationTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7051OptionalProfileActivationTest.java index 1368f8e4d0..7648d4e15f 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7051OptionalProfileActivationTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7051OptionalProfileActivationTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,23 +16,20 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; -public class MavenITmng7051OptionalProfileActivationTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng7051OptionalProfileActivationTest extends AbstractMavenIntegrationTestCase { private static final String PROJECT_PATH = "/mng-7051-optional-profile-activation"; - public MavenITmng7051OptionalProfileActivationTest() - { - super( "[4.0.0-alpha-1,)" ); + public MavenITmng7051OptionalProfileActivationTest() { + super("[4.0.0-alpha-1,)"); } /** @@ -43,25 +38,22 @@ public class MavenITmng7051OptionalProfileActivationTest * @throws Exception in case of failure */ @Test - public void testActivatingNonExistingProfileBreaks() throws Exception - { - final File projectDir = ResourceExtractor.simpleExtractResources( getClass(), PROJECT_PATH ); - final Verifier verifier = newVerifier( projectDir.getAbsolutePath() ); + public void testActivatingNonExistingProfileBreaks() throws Exception { + final File projectDir = ResourceExtractor.simpleExtractResources(getClass(), PROJECT_PATH); + final Verifier verifier = newVerifier(projectDir.getAbsolutePath()); - verifier.addCliArgument( "-P" ); - verifier.addCliArgument( "non-existing-profile" ); - verifier.setLogFileName( "test-breaking.txt" ); + verifier.addCliArgument("-P"); + verifier.addCliArgument("non-existing-profile"); + verifier.setLogFileName("test-breaking.txt"); - try - { - verifier.addCliArgument( "validate" ); + try { + verifier.addCliArgument("validate"); verifier.execute(); - fail( "Activated a non-existing profile without ? prefix should break the build, but it didn't." ); - } - catch ( VerificationException ve ) - { + fail("Activated a non-existing profile without ? prefix should break the build, but it didn't."); + } catch (VerificationException ve) { // Inspect the reason why the build broke. - verifier.verifyTextInLog( "[ERROR] The requested profiles [non-existing-profile] could not be activated or deactivated because they do not exist." ); + verifier.verifyTextInLog( + "[ERROR] The requested profiles [non-existing-profile] could not be activated or deactivated because they do not exist."); } } @@ -71,19 +63,19 @@ public class MavenITmng7051OptionalProfileActivationTest * @throws Exception in case of failure */ @Test - public void testActivatingNonExistingProfileWithQuestionMarkDoesNotBreak() throws Exception - { - final File projectDir = ResourceExtractor.simpleExtractResources( getClass(), PROJECT_PATH ); - final Verifier verifier = newVerifier( projectDir.getAbsolutePath() ); + public void testActivatingNonExistingProfileWithQuestionMarkDoesNotBreak() throws Exception { + final File projectDir = ResourceExtractor.simpleExtractResources(getClass(), PROJECT_PATH); + final Verifier verifier = newVerifier(projectDir.getAbsolutePath()); - verifier.addCliArgument( "-P" ); - verifier.addCliArgument( "?non-existing-profile" ); - verifier.setLogFileName( "test-non-breaking.txt" ); + verifier.addCliArgument("-P"); + verifier.addCliArgument("?non-existing-profile"); + verifier.setLogFileName("test-non-breaking.txt"); - verifier.addCliArgument( "validate" ); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyTextInLog( "[INFO] The requested optional profiles [non-existing-profile] could not be activated or deactivated because they do not exist." ); + verifier.verifyTextInLog( + "[INFO] The requested optional profiles [non-existing-profile] could not be activated or deactivated because they do not exist."); } /** @@ -92,19 +84,19 @@ public class MavenITmng7051OptionalProfileActivationTest * @throws Exception in case of failure */ @Test - public void testActivatingExistingAndNonExistingProfiles() throws Exception - { - final File projectDir = ResourceExtractor.simpleExtractResources( getClass(), PROJECT_PATH ); - final Verifier verifier = newVerifier( projectDir.getAbsolutePath() ); + public void testActivatingExistingAndNonExistingProfiles() throws Exception { + final File projectDir = ResourceExtractor.simpleExtractResources(getClass(), PROJECT_PATH); + final Verifier verifier = newVerifier(projectDir.getAbsolutePath()); - verifier.addCliArgument( "-P" ); - verifier.addCliArgument( "?non-existing-profile,existing" ); - verifier.setLogFileName( "test-non-breaking-mixed.txt" ); + verifier.addCliArgument("-P"); + verifier.addCliArgument("?non-existing-profile,existing"); + verifier.setLogFileName("test-non-breaking-mixed.txt"); - verifier.addCliArgument( "validate" ); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyTextInLog( "[INFO] The requested optional profiles [non-existing-profile] could not be activated or deactivated because they do not exist." ); + verifier.verifyTextInLog( + "[INFO] The requested optional profiles [non-existing-profile] could not be activated or deactivated because they do not exist."); } /** @@ -113,19 +105,19 @@ public class MavenITmng7051OptionalProfileActivationTest * @throws Exception in case of failure */ @Test - public void testDeactivatingNonExistingProfileWithQuestionMarkDoesNotBreak() throws Exception - { - final File projectDir = ResourceExtractor.simpleExtractResources( getClass(), PROJECT_PATH ); - final Verifier verifier = newVerifier( projectDir.getAbsolutePath() ); + public void testDeactivatingNonExistingProfileWithQuestionMarkDoesNotBreak() throws Exception { + final File projectDir = ResourceExtractor.simpleExtractResources(getClass(), PROJECT_PATH); + final Verifier verifier = newVerifier(projectDir.getAbsolutePath()); - verifier.addCliArgument( "-P" ); - verifier.addCliArgument( "!?non-existing-profile" ); - verifier.setLogFileName( "test-deactivating-non-breaking.txt" ); + verifier.addCliArgument("-P"); + verifier.addCliArgument("!?non-existing-profile"); + verifier.setLogFileName("test-deactivating-non-breaking.txt"); - verifier.addCliArgument( "validate" ); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyTextInLog( "[INFO] The requested optional profiles [non-existing-profile] could not be activated or deactivated because they do not exist." ); + verifier.verifyTextInLog( + "[INFO] The requested optional profiles [non-existing-profile] could not be activated or deactivated because they do not exist."); } /** @@ -134,18 +126,18 @@ public class MavenITmng7051OptionalProfileActivationTest * @throws Exception in case of failure */ @Test - public void testDeactivatingExistingAndNonExistingProfiles() throws Exception - { - final File projectDir = ResourceExtractor.simpleExtractResources( getClass(), PROJECT_PATH ); - final Verifier verifier = newVerifier( projectDir.getAbsolutePath() ); + public void testDeactivatingExistingAndNonExistingProfiles() throws Exception { + final File projectDir = ResourceExtractor.simpleExtractResources(getClass(), PROJECT_PATH); + final Verifier verifier = newVerifier(projectDir.getAbsolutePath()); - verifier.addCliArgument( "-P" ); - verifier.addCliArgument( "!?non-existing-profile,!existing" ); - verifier.setLogFileName( "test-deactivating-non-breaking-mixed.txt" ); + verifier.addCliArgument("-P"); + verifier.addCliArgument("!?non-existing-profile,!existing"); + verifier.setLogFileName("test-deactivating-non-breaking-mixed.txt"); - verifier.addCliArgument( "validate" ); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyTextInLog( "[INFO] The requested optional profiles [non-existing-profile] could not be activated or deactivated because they do not exist." ); + verifier.verifyTextInLog( + "[INFO] The requested optional profiles [non-existing-profile] could not be activated or deactivated because they do not exist."); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7110ExtensionClassloader.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7110ExtensionClassloader.java index 2395300952..974d33e941 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7110ExtensionClassloader.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7110ExtensionClassloader.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,10 +16,7 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; import java.io.FileReader; @@ -29,47 +24,45 @@ import java.io.IOException; import java.io.Reader; import java.util.Properties; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; -public class MavenITmng7110ExtensionClassloader - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng7110ExtensionClassloader() - { - super( ALL_MAVEN_VERSIONS ); +public class MavenITmng7110ExtensionClassloader extends AbstractMavenIntegrationTestCase { + public MavenITmng7110ExtensionClassloader() { + super(ALL_MAVEN_VERSIONS); } @Test - public void testVerifyResourceOfExtensionAndDependency() throws IOException, VerificationException - { - final File projectDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-7110-extensionclassloader" ); - - final Verifier extensionVerifier = newVerifier( new File( projectDir, "extension" ).getAbsolutePath() ); - extensionVerifier.addCliArgument( "install" ); + public void testVerifyResourceOfExtensionAndDependency() throws IOException, VerificationException { + final File projectDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-7110-extensionclassloader"); + + final Verifier extensionVerifier = newVerifier(new File(projectDir, "extension").getAbsolutePath()); + extensionVerifier.addCliArgument("install"); extensionVerifier.execute(); extensionVerifier.verifyErrorFreeLog(); - final Verifier libVerifier = newVerifier( new File( projectDir, "lib" ).getAbsolutePath() ); - libVerifier.addCliArgument( "install" ); + final Verifier libVerifier = newVerifier(new File(projectDir, "lib").getAbsolutePath()); + libVerifier.addCliArgument("install"); libVerifier.execute(); libVerifier.verifyErrorFreeLog(); - final Verifier bomVerifier = newVerifier( new File( projectDir, "bom" ).getAbsolutePath() ); - bomVerifier.addCliArgument( "install" ); + final Verifier bomVerifier = newVerifier(new File(projectDir, "bom").getAbsolutePath()); + bomVerifier.addCliArgument("install"); bomVerifier.execute(); bomVerifier.verifyErrorFreeLog(); - - final Verifier projectVerifier = newVerifier( new File( projectDir, "module" ).getAbsolutePath() ); - projectVerifier.addCliArgument( "verify" ); + + final Verifier projectVerifier = newVerifier(new File(projectDir, "module").getAbsolutePath()); + projectVerifier.addCliArgument("verify"); projectVerifier.execute(); projectVerifier.verifyErrorFreeLog(); - - Properties properties = new Properties(); - Reader fileReader = new FileReader( new File( projectDir, "module/out.txt" ) ); - properties.load( fileReader ); - - assertEquals( "1", properties.getProperty( "extension.txt.count", "-1" ) ); - assertEquals( "1", properties.getProperty( "lib.txt.count", "-1" ) ); - } + Properties properties = new Properties(); + Reader fileReader = new FileReader(new File(projectDir, "module/out.txt")); + properties.load(fileReader); + + assertEquals("1", properties.getProperty("extension.txt.count", "-1")); + assertEquals("1", properties.getProperty("lib.txt.count", "-1")); + } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7112ProjectsWithNonRecursiveTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7112ProjectsWithNonRecursiveTest.java index 5b2af8f747..077a775112 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7112ProjectsWithNonRecursiveTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7112ProjectsWithNonRecursiveTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,73 +16,66 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; import java.io.IOException; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; -public class MavenITmng7112ProjectsWithNonRecursiveTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng7112ProjectsWithNonRecursiveTest extends AbstractMavenIntegrationTestCase { private static final String PROJECT_PATH = "/mng-7112-projects-with-non-recursive"; - public MavenITmng7112ProjectsWithNonRecursiveTest() - { - super( "[4.0.0-alpha-1,)" ); + public MavenITmng7112ProjectsWithNonRecursiveTest() { + super("[4.0.0-alpha-1,)"); } @Test - public void testAggregatesCanBeBuiltNonRecursively() - throws IOException, VerificationException - { - final File projectDir = ResourceExtractor.simpleExtractResources( getClass(), PROJECT_PATH ); - Verifier cleaner = newVerifier( projectDir.getAbsolutePath() ); - cleaner.addCliArgument( "clean" ); + public void testAggregatesCanBeBuiltNonRecursively() throws IOException, VerificationException { + final File projectDir = ResourceExtractor.simpleExtractResources(getClass(), PROJECT_PATH); + Verifier cleaner = newVerifier(projectDir.getAbsolutePath()); + cleaner.addCliArgument("clean"); cleaner.execute(); - final Verifier verifier = newVerifier( projectDir.getAbsolutePath() ); + final Verifier verifier = newVerifier(projectDir.getAbsolutePath()); - verifier.addCliArgument( "-pl" ); - verifier.addCliArgument( ":aggregator-a,:aggregator-b" ); - verifier.addCliArgument( "-N" ); - verifier.setLogFileName( "selected-non-recursive.txt" ); - verifier.addCliArgument( "validate" ); + verifier.addCliArgument("-pl"); + verifier.addCliArgument(":aggregator-a,:aggregator-b"); + verifier.addCliArgument("-N"); + verifier.setLogFileName("selected-non-recursive.txt"); + verifier.addCliArgument("validate"); verifier.execute(); - verifier.verifyFileNotPresent( "target/touch.txt" ); - verifier.verifyFilePresent( "aggregator-a/target/touch.txt" ); - verifier.verifyFileNotPresent( "aggregator-a/module-a/target/touch.txt" ); - verifier.verifyFilePresent( "aggregator-b/target/touch.txt" ); - verifier.verifyFileNotPresent( "aggregator-b/module-b/target/touch.txt" ); + verifier.verifyFileNotPresent("target/touch.txt"); + verifier.verifyFilePresent("aggregator-a/target/touch.txt"); + verifier.verifyFileNotPresent("aggregator-a/module-a/target/touch.txt"); + verifier.verifyFilePresent("aggregator-b/target/touch.txt"); + verifier.verifyFileNotPresent("aggregator-b/module-b/target/touch.txt"); } @Test - public void testAggregatesCanBeDeselectedNonRecursively() - throws IOException, VerificationException - { - final File projectDir = ResourceExtractor.simpleExtractResources( getClass(), PROJECT_PATH ); - Verifier cleaner = newVerifier( projectDir.getAbsolutePath() ); - cleaner.addCliArgument( "clean" ); + public void testAggregatesCanBeDeselectedNonRecursively() throws IOException, VerificationException { + final File projectDir = ResourceExtractor.simpleExtractResources(getClass(), PROJECT_PATH); + Verifier cleaner = newVerifier(projectDir.getAbsolutePath()); + cleaner.addCliArgument("clean"); cleaner.execute(); - final Verifier verifier = newVerifier( projectDir.getAbsolutePath() ); + final Verifier verifier = newVerifier(projectDir.getAbsolutePath()); - verifier.addCliArgument( "-pl" ); - verifier.addCliArgument( "!:aggregator-a,!:aggregator-b" ); - verifier.addCliArgument( "-N" ); - verifier.setLogFileName( "excluded-non-recursive.txt" ); - verifier.addCliArgument( "validate" ); + verifier.addCliArgument("-pl"); + verifier.addCliArgument("!:aggregator-a,!:aggregator-b"); + verifier.addCliArgument("-N"); + verifier.setLogFileName("excluded-non-recursive.txt"); + verifier.addCliArgument("validate"); verifier.execute(); - verifier.verifyFilePresent( "target/touch.txt" ); - verifier.verifyFileNotPresent( "aggregator-a/target/touch.txt" ); - verifier.verifyFilePresent( "aggregator-a/module-a/target/touch.txt" ); - verifier.verifyFileNotPresent( "aggregator-b/target/touch.txt" ); - verifier.verifyFilePresent( "aggregator-b/module-b/target/touch.txt" ); + verifier.verifyFilePresent("target/touch.txt"); + verifier.verifyFileNotPresent("aggregator-a/target/touch.txt"); + verifier.verifyFilePresent("aggregator-a/module-a/target/touch.txt"); + verifier.verifyFileNotPresent("aggregator-b/target/touch.txt"); + verifier.verifyFilePresent("aggregator-b/module-b/target/touch.txt"); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7128BlockExternalHttpReactorTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7128BlockExternalHttpReactorTest.java index 10b47fd15e..449c30a687 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7128BlockExternalHttpReactorTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7128BlockExternalHttpReactorTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,23 +16,20 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; -public class MavenITmng7128BlockExternalHttpReactorTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng7128BlockExternalHttpReactorTest extends AbstractMavenIntegrationTestCase { private static final String PROJECT_PATH = "/mng-7128-block-external-http-reactor"; - public MavenITmng7128BlockExternalHttpReactorTest() - { - super( "[3.8.1,)" ); + public MavenITmng7128BlockExternalHttpReactorTest() { + super("[3.8.1,)"); } /** @@ -43,26 +38,25 @@ public class MavenITmng7128BlockExternalHttpReactorTest * @throws Exception in case of failure */ @Test - public void testBlockedHttpRepositoryInPom() throws Exception - { - final File projectDir = ResourceExtractor.simpleExtractResources( getClass(), PROJECT_PATH ); - final Verifier verifier = newVerifier( projectDir.getAbsolutePath() ); + public void testBlockedHttpRepositoryInPom() throws Exception { + final File projectDir = ResourceExtractor.simpleExtractResources(getClass(), PROJECT_PATH); + final Verifier verifier = newVerifier(projectDir.getAbsolutePath()); // ITs override global settings that provide blocked mirror: need to define the mirror in dedicated settings - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); - try - { - verifier.addCliArgument( "compiler:compile" ); + try { + verifier.addCliArgument("compiler:compile"); verifier.execute(); - fail( "HTTP repository defined in pom.xml should have failed the build but did not." ); - } - catch ( VerificationException ve ) - { + fail("HTTP repository defined in pom.xml should have failed the build but did not."); + } catch (VerificationException ve) { // Inspect the reason why the build broke. - verifier.verifyTextInLog( "[ERROR] Failed to execute goal on project http-repository-in-pom: " ); // project failed - verifier.verifyTextInLog( "Could not transfer artifact junit:junit:pom:1.3 from/to maven-default-http-blocker (http://0.0.0.0/): " ); // mirror introduced in MNG-7118 - verifier.verifyTextInLog( "Blocked mirror for repositories: [insecure-http-repo (http://repo.maven.apache.org/, default, releases+snapshots)]" ); // blocked mirror text present + verifier.verifyTextInLog( + "[ERROR] Failed to execute goal on project http-repository-in-pom: "); // project failed + verifier.verifyTextInLog( + "Could not transfer artifact junit:junit:pom:1.3 from/to maven-default-http-blocker (http://0.0.0.0/): "); // mirror introduced in MNG-7118 + verifier.verifyTextInLog( + "Blocked mirror for repositories: [insecure-http-repo (http://repo.maven.apache.org/, default, releases+snapshots)]"); // blocked mirror text present } } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7160ExtensionClassloader.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7160ExtensionClassloader.java index d87f22bc14..5310228d19 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7160ExtensionClassloader.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7160ExtensionClassloader.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,61 +16,56 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; import java.io.IOException; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; -public class MavenITmng7160ExtensionClassloader - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng7160ExtensionClassloader() - { - super( "[3.9.0,)" ); +public class MavenITmng7160ExtensionClassloader extends AbstractMavenIntegrationTestCase { + public MavenITmng7160ExtensionClassloader() { + super("[3.9.0,)"); } @Test - public void testVerify() throws IOException, VerificationException - { - final File projectDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-7160-extensionclassloader" ); + public void testVerify() throws IOException, VerificationException { + final File projectDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-7160-extensionclassloader"); - final Verifier extensionVerifier = newVerifier( new File( projectDir, "extension" ).getAbsolutePath() ); - extensionVerifier.addCliArgument( "install" ); + final Verifier extensionVerifier = newVerifier(new File(projectDir, "extension").getAbsolutePath()); + extensionVerifier.addCliArgument("install"); extensionVerifier.execute(); extensionVerifier.verifyErrorFreeLog(); - final Verifier verifier1 = newVerifier( new File( projectDir, "project-build" ).getAbsolutePath() ); - verifier1.addCliArgument( "install" ); + final Verifier verifier1 = newVerifier(new File(projectDir, "project-build").getAbsolutePath()); + verifier1.addCliArgument("install"); verifier1.execute(); verifier1.verifyErrorFreeLog(); - verifier1.verifyTextInLog( "xpp3 -> mvn" ); - verifier1.verifyTextInLog( "base64 -> ext" ); + verifier1.verifyTextInLog("xpp3 -> mvn"); + verifier1.verifyTextInLog("base64 -> ext"); - final Verifier verifier2 = newVerifier( new File( projectDir, "project-core-parent-first" ).getAbsolutePath() ); - verifier2.addCliArgument( "install" ); + final Verifier verifier2 = newVerifier(new File(projectDir, "project-core-parent-first").getAbsolutePath()); + verifier2.addCliArgument("install"); verifier2.execute(); verifier2.verifyErrorFreeLog(); - verifier2.verifyTextInLog( "xpp3 -> mvn" ); - verifier2.verifyTextInLog( "base64 -> mvn" ); + verifier2.verifyTextInLog("xpp3 -> mvn"); + verifier2.verifyTextInLog("base64 -> mvn"); - final Verifier verifier3 = newVerifier( new File( projectDir, "project-core-plugin" ).getAbsolutePath() ); - verifier3.addCliArgument( "verify" ); + final Verifier verifier3 = newVerifier(new File(projectDir, "project-core-plugin").getAbsolutePath()); + verifier3.addCliArgument("verify"); verifier3.execute(); verifier3.verifyErrorFreeLog(); - verifier3.verifyTextInLog( "xpp3 -> mvn" ); - verifier3.verifyTextInLog( "base64 -> ext" ); + verifier3.verifyTextInLog("xpp3 -> mvn"); + verifier3.verifyTextInLog("base64 -> ext"); - final Verifier verifier4 = newVerifier( new File( projectDir, "project-core-self-first" ).getAbsolutePath() ); - verifier4.addCliArgument( "verify" ); + final Verifier verifier4 = newVerifier(new File(projectDir, "project-core-self-first").getAbsolutePath()); + verifier4.addCliArgument("verify"); verifier4.execute(); verifier4.verifyErrorFreeLog(); - verifier4.verifyTextInLog( "xpp3 -> ext" ); - verifier4.verifyTextInLog( "base64 -> ext" ); + verifier4.verifyTextInLog("xpp3 -> ext"); + verifier4.verifyTextInLog("base64 -> ext"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7244IgnorePomPrefixInExpressions.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7244IgnorePomPrefixInExpressions.java index 575f5383d4..9764edbd9f 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7244IgnorePomPrefixInExpressions.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7244IgnorePomPrefixInExpressions.java @@ -18,45 +18,38 @@ */ package org.apache.maven.it; -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; - import java.io.File; import java.io.IOException; import java.util.List; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; -public class MavenITmng7244IgnorePomPrefixInExpressions extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng7244IgnorePomPrefixInExpressions extends AbstractMavenIntegrationTestCase { private static final String PROJECT_PATH = "/mng-7244-ignore-pom-prefix-in-expressions"; - public MavenITmng7244IgnorePomPrefixInExpressions() - { - super( "[4.0.0-alpha-1,)" ); + public MavenITmng7244IgnorePomPrefixInExpressions() { + super("[4.0.0-alpha-1,)"); } @Test - public void testIgnorePomPrefixInExpressions() throws IOException, VerificationException - { - final File projectDir = ResourceExtractor.simpleExtractResources( getClass(), PROJECT_PATH ); - final Verifier verifier = newVerifier( projectDir.getAbsolutePath() ); + public void testIgnorePomPrefixInExpressions() throws IOException, VerificationException { + final File projectDir = ResourceExtractor.simpleExtractResources(getClass(), PROJECT_PATH); + final Verifier verifier = newVerifier(projectDir.getAbsolutePath()); - verifier.addCliArgument( "validate" ); + verifier.addCliArgument("validate"); verifier.execute(); - verifyLogDoesNotContainUnexpectedWarning( verifier ); + verifyLogDoesNotContainUnexpectedWarning(verifier); } - private void verifyLogDoesNotContainUnexpectedWarning( Verifier verifier ) throws IOException - { - List loadedLines = verifier.loadLines( "log.txt", "UTF-8" ); - for ( String line : loadedLines ) - { - if ( line.startsWith( "[WARNING]" ) && line.contains( "The expression ${pom.version} is deprecated." ) ) - { - fail( "Log contained unexpected deprecation warning" ); + private void verifyLogDoesNotContainUnexpectedWarning(Verifier verifier) throws IOException { + List loadedLines = verifier.loadLines("log.txt", "UTF-8"); + for (String line : loadedLines) { + if (line.startsWith("[WARNING]") && line.contains("The expression ${pom.version} is deprecated.")) { + fail("Log contained unexpected deprecation warning"); } } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7310LifecycleActivatedInSpecifiedModuleTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7310LifecycleActivatedInSpecifiedModuleTest.java index 0cfe502107..1a689281e8 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7310LifecycleActivatedInSpecifiedModuleTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7310LifecycleActivatedInSpecifiedModuleTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; + /** * An integration test which proves that the bug of MNG-7310 is fixed. * The bug is about loading an extension in a sibling submodule, which ends up failing the build. @@ -31,29 +30,24 @@ import java.io.File; * MNG-7310. * */ -public class MavenITmng7310LifecycleActivatedInSpecifiedModuleTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng7310LifecycleActivatedInSpecifiedModuleTest extends AbstractMavenIntegrationTestCase { public static final String BASE_TEST_DIR = "/mng-7310-lifecycle-activated-in-specified-module"; - public MavenITmng7310LifecycleActivatedInSpecifiedModuleTest() - { - super( "[4.0.0-alpha-1,)" ); + public MavenITmng7310LifecycleActivatedInSpecifiedModuleTest() { + super("[4.0.0-alpha-1,)"); } - public void testItShouldNotLoadAnExtensionInASiblingSubmodule() - throws Exception - { - File extensionTestDir = ResourceExtractor.simpleExtractResources( getClass(), BASE_TEST_DIR + "/extension" ); - File projectTestDir = ResourceExtractor.simpleExtractResources( getClass(), BASE_TEST_DIR + "/project" ); + public void testItShouldNotLoadAnExtensionInASiblingSubmodule() throws Exception { + File extensionTestDir = ResourceExtractor.simpleExtractResources(getClass(), BASE_TEST_DIR + "/extension"); + File projectTestDir = ResourceExtractor.simpleExtractResources(getClass(), BASE_TEST_DIR + "/project"); - Verifier verifier = newVerifier( extensionTestDir.getAbsolutePath(), "remote" ); - verifier.addCliArgument( "install" ); + Verifier verifier = newVerifier(extensionTestDir.getAbsolutePath(), "remote"); + verifier.addCliArgument("install"); verifier.execute(); - Verifier verifier2 = newVerifier( projectTestDir.getAbsolutePath() ); - verifier2.addCliArgument( "compile" ); + Verifier verifier2 = newVerifier(projectTestDir.getAbsolutePath()); + verifier2.addCliArgument("compile"); verifier2.execute(); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7335MissingJarInParallelBuild.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7335MissingJarInParallelBuild.java index 583cba5914..3c275472d9 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7335MissingJarInParallelBuild.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7335MissingJarInParallelBuild.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,33 +16,29 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; import java.io.IOException; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; -public class MavenITmng7335MissingJarInParallelBuild - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng7335MissingJarInParallelBuild extends AbstractMavenIntegrationTestCase { private static final String PROJECT_PATH = "/mng-7335-missing-jar-in-parallel-build"; - public MavenITmng7335MissingJarInParallelBuild() - { - super( "[3.8.1,)" ); + public MavenITmng7335MissingJarInParallelBuild() { + super("[3.8.1,)"); } @Test - public void testMissingJarInParallelBuild() throws IOException, VerificationException - { - final File projectDir = ResourceExtractor.simpleExtractResources( getClass(), PROJECT_PATH ); - final Verifier verifier = newVerifier( projectDir.getAbsolutePath() ); - verifier.addCliArgument( "-T1C" ); - verifier.addCliArguments( "clean", "package" ); + public void testMissingJarInParallelBuild() throws IOException, VerificationException { + final File projectDir = ResourceExtractor.simpleExtractResources(getClass(), PROJECT_PATH); + final Verifier verifier = newVerifier(projectDir.getAbsolutePath()); + verifier.addCliArgument("-T1C"); + verifier.addCliArguments("clean", "package"); verifier.execute(); verifier.verifyErrorFreeLog(); } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7349RelocationWarningTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7349RelocationWarningTest.java index 608143bfc7..fb8bbc6eb3 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7349RelocationWarningTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7349RelocationWarningTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,57 +16,52 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.ArrayList; import java.util.List; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; -public class MavenITmng7349RelocationWarningTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng7349RelocationWarningTest extends AbstractMavenIntegrationTestCase { - public MavenITmng7349RelocationWarningTest() - { - super( "[3.8.5,)" ); + public MavenITmng7349RelocationWarningTest() { + super("[3.8.5,)"); } @Test - public void testit() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), - "/mng-7349-relocation-warning" ); - File artifactsDir = new File( testDir, "artifacts" ); - File projectDir = new File( testDir, "project" ); + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-7349-relocation-warning"); + File artifactsDir = new File(testDir, "artifacts"); + File projectDir = new File(testDir, "project"); Verifier verifier; - verifier = newVerifier( artifactsDir.getAbsolutePath() ); - verifier.addCliArgument( "install" ); + verifier = newVerifier(artifactsDir.getAbsolutePath()); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier = newVerifier( projectDir.getAbsolutePath() ); - verifier.addCliArgument( "verify" ); + verifier = newVerifier(projectDir.getAbsolutePath()); + verifier.addCliArgument("verify"); verifier.execute(); verifier.verifyErrorFreeLog(); - List lines = verifier.loadLines( verifier.getLogFileName(), "UTF-8" ); + List lines = verifier.loadLines(verifier.getLogFileName(), "UTF-8"); List relocated = new ArrayList<>(); for (String line : lines) { if (line.contains("has been relocated")) { relocated.add(line); } } - assertEquals("Expected 2 relocations, but found multiple", - 2, relocated.size()); - assertTrue("Expected the relocation messages to be logged", - relocated.get(0).contains("Test relocation reason for old-plugin")); - assertTrue("Expected the relocation messages to be logged", - relocated.get(1).contains("Test relocation reason for old-dep")); + assertEquals("Expected 2 relocations, but found multiple", 2, relocated.size()); + assertTrue( + "Expected the relocation messages to be logged", + relocated.get(0).contains("Test relocation reason for old-plugin")); + assertTrue( + "Expected the relocation messages to be logged", + relocated.get(1).contains("Test relocation reason for old-dep")); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7353CliGoalInvocationTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7353CliGoalInvocationTest.java index 01fb201418..8aec3e069c 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7353CliGoalInvocationTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7353CliGoalInvocationTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,96 +16,87 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** * Tests new mvn prefix:version:goal, * MNG-7353. */ -public class MavenITmng7353CliGoalInvocationTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng7353CliGoalInvocationTest() - { - super( "[3.9.0,)" ); +public class MavenITmng7353CliGoalInvocationTest extends AbstractMavenIntegrationTestCase { + public MavenITmng7353CliGoalInvocationTest() { + super("[3.9.0,)"); } - private void run( String id, String goal, String expectedInvocation ) - throws Exception - { - File basedir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-7353-cli-goal-invocation" ); - Verifier verifier = newVerifier( basedir.getAbsolutePath() ); - verifier.setLogFileName( id + ".txt" ); - verifier.addCliArgument( goal ); + private void run(String id, String goal, String expectedInvocation) throws Exception { + File basedir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-7353-cli-goal-invocation"); + Verifier verifier = newVerifier(basedir.getAbsolutePath()); + verifier.setLogFileName(id + ".txt"); + verifier.addCliArgument(goal); verifier.execute(); - verifier.verifyTextInLog( "[INFO] --- " + expectedInvocation ); + verifier.verifyTextInLog("[INFO] --- " + expectedInvocation); } @Test - public void testPrefixGoal() - throws Exception - { - run( "pluginPrefix-goal", "dependency:list", "dependency:3.3.0:list (default-cli)" ); + public void testPrefixGoal() throws Exception { + run("pluginPrefix-goal", "dependency:list", "dependency:3.3.0:list (default-cli)"); } @Test - public void testPrefixGoalAtId() - throws Exception - { - run( "pluginPrefix-goal@id", "dependency:list@id", "dependency:3.3.0:list (id)" ); + public void testPrefixGoalAtId() throws Exception { + run("pluginPrefix-goal@id", "dependency:list@id", "dependency:3.3.0:list (id)"); } /** * new pluginPrefix:version:goal in Maven 3.9.0 */ @Test - public void testPrefixVersionGoal() - throws Exception - { - run( "pluginPrefix-version-goal", "dependency:3.1.1:list", "dependency:3.1.1:list (default-cli)" ); + public void testPrefixVersionGoal() throws Exception { + run("pluginPrefix-version-goal", "dependency:3.1.1:list", "dependency:3.1.1:list (default-cli)"); } /** * new pluginPrefix:version:goal in Maven 3.9.0 */ @Test - public void testPrefixVersionGoalAtId() - throws Exception - { - run( "pluginPrefix-goal@id", "dependency:3.1.1:list@id", "dependency:3.1.1:list (id)" ); + public void testPrefixVersionGoalAtId() throws Exception { + run("pluginPrefix-goal@id", "dependency:3.1.1:list@id", "dependency:3.1.1:list (id)"); } @Test - public void testGroupIdArtifactIdGoal() - throws Exception - { - run( "groupId-artifactId-goal", "org.apache.maven.plugins:maven-dependency-plugin:list", "dependency:3.3.0:list (default-cli)" ); + public void testGroupIdArtifactIdGoal() throws Exception { + run( + "groupId-artifactId-goal", + "org.apache.maven.plugins:maven-dependency-plugin:list", + "dependency:3.3.0:list (default-cli)"); } @Test - public void testGroupIdArtifactIdGoalAtId() - throws Exception - { - run( "groupId-artifactId-goal@id", "org.apache.maven.plugins:maven-dependency-plugin:list@id", "dependency:3.3.0:list (id)" ); + public void testGroupIdArtifactIdGoalAtId() throws Exception { + run( + "groupId-artifactId-goal@id", + "org.apache.maven.plugins:maven-dependency-plugin:list@id", + "dependency:3.3.0:list (id)"); } @Test - public void testGroupIdArtifactIdVersionGoal() - throws Exception - { - run( "groupId-artifactId-version-goal", "org.apache.maven.plugins:maven-dependency-plugin:3.1.1:list", "dependency:3.1.1:list (default-cli)" ); + public void testGroupIdArtifactIdVersionGoal() throws Exception { + run( + "groupId-artifactId-version-goal", + "org.apache.maven.plugins:maven-dependency-plugin:3.1.1:list", + "dependency:3.1.1:list (default-cli)"); } @Test - public void testGroupIdArtifactIdVersionGoalAtId() - throws Exception - { - run( "groupId-artifactId-version-goal@id", "org.apache.maven.plugins:maven-dependency-plugin:3.1.1:list@id", "dependency:3.1.1:list (id)" ); + public void testGroupIdArtifactIdVersionGoalAtId() throws Exception { + run( + "groupId-artifactId-version-goal@id", + "org.apache.maven.plugins:maven-dependency-plugin:3.1.1:list@id", + "dependency:3.1.1:list (id)"); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7360BuildConsumer.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7360BuildConsumer.java index d088e157c2..5b71e7d9f1 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7360BuildConsumer.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7360BuildConsumer.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,39 +16,35 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** - * This test suite tests whether the consumer pom feature can load a project with a {@code parent} tag + * This test suite tests whether the consumer pom feature can load a project with a {@code parent} tag * inside the plugin configuration. * Related JIRA issue: MNG-7360. * * @author Guillaume Nodet */ -public class MavenITmng7360BuildConsumer extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng7360BuildConsumer extends AbstractMavenIntegrationTestCase { private static final String PROJECT_PATH = "/mng-7360-build-consumer"; - public MavenITmng7360BuildConsumer() - { - super( "[4.0.0-alpha-1,)" ); + public MavenITmng7360BuildConsumer() { + super("[4.0.0-alpha-1,)"); } @Test - public void testSelectModuleByCoordinate() throws Exception - { - final File projectDir = ResourceExtractor.simpleExtractResources( getClass(), PROJECT_PATH ); - final Verifier verifier = newVerifier( projectDir.getAbsolutePath() ); - verifier.addCliArgument( "validate" ); + public void testSelectModuleByCoordinate() throws Exception { + final File projectDir = ResourceExtractor.simpleExtractResources(getClass(), PROJECT_PATH); + final Verifier verifier = newVerifier(projectDir.getAbsolutePath()); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7390SelectModuleOutsideCwdTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7390SelectModuleOutsideCwdTest.java index d4b704371f..66d5169ba0 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7390SelectModuleOutsideCwdTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7390SelectModuleOutsideCwdTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,13 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -34,114 +32,103 @@ import org.junit.jupiter.api.Test; * * @author Martin Kanters */ -public class MavenITmng7390SelectModuleOutsideCwdTest extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng7390SelectModuleOutsideCwdTest extends AbstractMavenIntegrationTestCase { private File moduleADir; - public MavenITmng7390SelectModuleOutsideCwdTest() - { - super( "[4.0.0-alpha-1,)" ); + public MavenITmng7390SelectModuleOutsideCwdTest() { + super("[4.0.0-alpha-1,)"); } @BeforeEach - protected void setUp() throws Exception - { - moduleADir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-7390-pl-outside-cwd/module-a" ); + protected void setUp() throws Exception { + moduleADir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-7390-pl-outside-cwd/module-a"); // Clean up target files from earlier runs (verifier.setAutoClean does not work, as we are reducing the reactor) - final Verifier verifier = newVerifier( moduleADir.getAbsolutePath() ); - verifier.addCliArgument( "-f" ); - verifier.addCliArgument( ".." ); - verifier.addCliArgument( "clean" ); + final Verifier verifier = newVerifier(moduleADir.getAbsolutePath()); + verifier.addCliArgument("-f"); + verifier.addCliArgument(".."); + verifier.addCliArgument("clean"); verifier.execute(); } @Test - public void testSelectModuleByCoordinate() throws Exception - { - final Verifier verifier = newVerifier( moduleADir.getAbsolutePath() ); + public void testSelectModuleByCoordinate() throws Exception { + final Verifier verifier = newVerifier(moduleADir.getAbsolutePath()); - verifier.addCliArgument( "-pl" ); - verifier.addCliArgument( ":module-b" ); - verifier.setLogFileName( "log-module-by-coordinate.txt" ); - verifier.addCliArgument( "validate" ); + verifier.addCliArgument("-pl"); + verifier.addCliArgument(":module-b"); + verifier.setLogFileName("log-module-by-coordinate.txt"); + verifier.addCliArgument("validate"); verifier.execute(); - verifier.verifyFileNotPresent( "target/touch.txt" ); - verifier.verifyFileNotPresent( "../target/touch.txt" ); - verifier.verifyFilePresent( "../module-b/target/touch.txt" ); + verifier.verifyFileNotPresent("target/touch.txt"); + verifier.verifyFileNotPresent("../target/touch.txt"); + verifier.verifyFilePresent("../module-b/target/touch.txt"); } @Test - public void testSelectMultipleModulesByCoordinate() throws Exception - { - final Verifier verifier = newVerifier( moduleADir.getAbsolutePath() ); + public void testSelectMultipleModulesByCoordinate() throws Exception { + final Verifier verifier = newVerifier(moduleADir.getAbsolutePath()); - verifier.addCliArgument( "-pl" ); - verifier.addCliArgument( ":module-b,:module-a" ); - verifier.setLogFileName( "log-modules-by-coordinate.txt" ); - verifier.addCliArgument( "validate" ); + verifier.addCliArgument("-pl"); + verifier.addCliArgument(":module-b,:module-a"); + verifier.setLogFileName("log-modules-by-coordinate.txt"); + verifier.addCliArgument("validate"); verifier.execute(); - verifier.verifyFilePresent( "target/touch.txt" ); - verifier.verifyFileNotPresent( "../target/touch.txt" ); - verifier.verifyFilePresent( "../module-b/target/touch.txt" ); + verifier.verifyFilePresent("target/touch.txt"); + verifier.verifyFileNotPresent("../target/touch.txt"); + verifier.verifyFilePresent("../module-b/target/touch.txt"); } @Test - public void testSelectModuleByRelativePath() throws Exception - { - final Verifier verifier = newVerifier( moduleADir.getAbsolutePath() ); + public void testSelectModuleByRelativePath() throws Exception { + final Verifier verifier = newVerifier(moduleADir.getAbsolutePath()); - verifier.addCliArgument( "-pl" ); - verifier.addCliArgument( "../module-b" ); - verifier.setLogFileName( "log-module-by-relative-path.txt" ); - verifier.addCliArgument( "validate" ); + verifier.addCliArgument("-pl"); + verifier.addCliArgument("../module-b"); + verifier.setLogFileName("log-module-by-relative-path.txt"); + verifier.addCliArgument("validate"); verifier.execute(); - verifier.verifyFileNotPresent( "target/touch.txt" ); - verifier.verifyFileNotPresent( "../target/touch.txt" ); - verifier.verifyFilePresent( "../module-b/target/touch.txt" ); + verifier.verifyFileNotPresent("target/touch.txt"); + verifier.verifyFileNotPresent("../target/touch.txt"); + verifier.verifyFilePresent("../module-b/target/touch.txt"); } @Test - public void testSelectModulesByRelativePath() throws Exception - { - final Verifier verifier = newVerifier( moduleADir.getAbsolutePath() ); + public void testSelectModulesByRelativePath() throws Exception { + final Verifier verifier = newVerifier(moduleADir.getAbsolutePath()); - verifier.addCliArgument( "-pl" ); - verifier.addCliArgument( "../module-b,." ); - verifier.setLogFileName( "log-modules-by-relative-path.txt" ); - verifier.addCliArgument( "validate" ); + verifier.addCliArgument("-pl"); + verifier.addCliArgument("../module-b,."); + verifier.setLogFileName("log-modules-by-relative-path.txt"); + verifier.addCliArgument("validate"); verifier.execute(); - verifier.verifyFilePresent( "target/touch.txt" ); - verifier.verifyFileNotPresent( "../target/touch.txt" ); - verifier.verifyFilePresent( "../module-b/target/touch.txt" ); + verifier.verifyFilePresent("target/touch.txt"); + verifier.verifyFileNotPresent("../target/touch.txt"); + verifier.verifyFilePresent("../module-b/target/touch.txt"); } /** - Maven determines whether the target module is in a multi-module project based on the presence of a .mvn directory in root. - This test verifies that when that directory is missing, the module cannot be found. + * Maven determines whether the target module is in a multi-module project based on the presence of a .mvn directory in root. + * This test verifies that when that directory is missing, the module cannot be found. */ @Test - public void testSelectModulesOutsideCwdDoesNotWorkWhenDotMvnIsNotPresent() throws Exception - { + public void testSelectModulesOutsideCwdDoesNotWorkWhenDotMvnIsNotPresent() throws Exception { final String noDotMvnPath = "/mng-7390-pl-outside-cwd-no-dotmvn/module-a"; - final File noDotMvnDir = ResourceExtractor.simpleExtractResources( getClass(), noDotMvnPath ); - final Verifier verifier = newVerifier( noDotMvnDir.getAbsolutePath() ); + final File noDotMvnDir = ResourceExtractor.simpleExtractResources(getClass(), noDotMvnPath); + final Verifier verifier = newVerifier(noDotMvnDir.getAbsolutePath()); - verifier.addCliArgument( "-pl" ); - verifier.addCliArgument( "../module-b" ); - verifier.setLogFileName( "log-modules-by-relative-path-no-dotmvn.txt" ); - try - { - verifier.addCliArgument( "validate" ); + verifier.addCliArgument("-pl"); + verifier.addCliArgument("../module-b"); + verifier.setLogFileName("log-modules-by-relative-path-no-dotmvn.txt"); + try { + verifier.addCliArgument("validate"); verifier.execute(); - fail( "Expected goal to fail" ); - } - catch ( VerificationException e ) - { - verifier.verifyFileNotPresent( "target/touch.txt" ); - verifier.verifyFileNotPresent( "../target/touch.txt" ); - verifier.verifyFileNotPresent( "../module-b/target/touch.txt" ); + fail("Expected goal to fail"); + } catch (VerificationException e) { + verifier.verifyFileNotPresent("target/touch.txt"); + verifier.verifyFileNotPresent("../target/touch.txt"); + verifier.verifyFileNotPresent("../module-b/target/touch.txt"); } } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7404IgnorePrefixlessExpressionsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7404IgnorePrefixlessExpressionsTest.java index cd94c10aec..0ebd093985 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7404IgnorePrefixlessExpressionsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7404IgnorePrefixlessExpressionsTest.java @@ -18,45 +18,38 @@ */ package org.apache.maven.it; -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; - import java.io.File; import java.io.IOException; import java.util.List; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; -public class MavenITmng7404IgnorePrefixlessExpressionsTest extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng7404IgnorePrefixlessExpressionsTest extends AbstractMavenIntegrationTestCase { private static final String PROJECT_PATH = "/mng-7404-ignore-prefixless-expressions"; - public MavenITmng7404IgnorePrefixlessExpressionsTest() - { - super( "[4.0.0-alpha-1,)" ); + public MavenITmng7404IgnorePrefixlessExpressionsTest() { + super("[4.0.0-alpha-1,)"); } @Test - public void testIgnorePrefixlessExpressions() throws IOException, VerificationException - { - final File projectDir = ResourceExtractor.simpleExtractResources( getClass(), PROJECT_PATH ); - final Verifier verifier = newVerifier( projectDir.getAbsolutePath() ); + public void testIgnorePrefixlessExpressions() throws IOException, VerificationException { + final File projectDir = ResourceExtractor.simpleExtractResources(getClass(), PROJECT_PATH); + final Verifier verifier = newVerifier(projectDir.getAbsolutePath()); - verifier.addCliArgument( "validate" ); + verifier.addCliArgument("validate"); verifier.execute(); - verifyLogDoesNotContainUnexpectedWarning( verifier ); + verifyLogDoesNotContainUnexpectedWarning(verifier); } - private void verifyLogDoesNotContainUnexpectedWarning( Verifier verifier ) throws IOException - { - List loadedLines = verifier.loadLines( "log.txt", "UTF-8" ); - for ( String line : loadedLines ) - { - if ( line.startsWith( "[WARNING]" ) && line.contains( "The expression ${version} is deprecated." ) ) - { - fail( "Log contained unexpected deprecation warning" ); + private void verifyLogDoesNotContainUnexpectedWarning(Verifier verifier) throws IOException { + List loadedLines = verifier.loadLines("log.txt", "UTF-8"); + for (String line : loadedLines) { + if (line.startsWith("[WARNING]") && line.contains("The expression ${version} is deprecated.")) { + fail("Log contained unexpected deprecation warning"); } } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7443ConsistencyOfOptionalProjectsAndProfilesTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7443ConsistencyOfOptionalProjectsAndProfilesTest.java index 6d687e46f4..b762b7a828 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7443ConsistencyOfOptionalProjectsAndProfilesTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7443ConsistencyOfOptionalProjectsAndProfilesTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,62 +16,55 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; +package org.apache.maven.it; import java.io.File; import java.io.IOException; -import java.util.Arrays; import java.util.List; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; -public class MavenITmng7443ConsistencyOfOptionalProjectsAndProfilesTest extends AbstractMavenIntegrationTestCase -{ - public MavenITmng7443ConsistencyOfOptionalProjectsAndProfilesTest() - { - super( "[4.0.0-alpha-1,)" ); +public class MavenITmng7443ConsistencyOfOptionalProjectsAndProfilesTest extends AbstractMavenIntegrationTestCase { + public MavenITmng7443ConsistencyOfOptionalProjectsAndProfilesTest() { + super("[4.0.0-alpha-1,)"); } @Test - public void testConsistentLoggingOfOptionalProfilesAndProjects() throws IOException, VerificationException - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), - "/mng-7443-consistency-of-optional-profiles-and-projects" ); + public void testConsistentLoggingOfOptionalProfilesAndProjects() throws IOException, VerificationException { + File testDir = ResourceExtractor.simpleExtractResources( + getClass(), "/mng-7443-consistency-of-optional-profiles-and-projects"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.addCliArgument( "-pl" ); - verifier.addCliArgument( "?:does-not-exist" ); - verifier.addCliArgument( "-P" ); - verifier.addCliArgument( "?does-not-exist-either" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.addCliArgument("-pl"); + verifier.addCliArgument("?:does-not-exist"); + verifier.addCliArgument("-P"); + verifier.addCliArgument("?does-not-exist-either"); - verifier.addCliArguments( "clean", "verify" ); + verifier.addCliArguments("clean", "verify"); verifier.execute(); - final List logLines = verifier.loadFile( verifier.getBasedir(), verifier.getLogFileName(), false ); + final List logLines = verifier.loadFile(verifier.getBasedir(), verifier.getLogFileName(), false); int projectSelectorMissingCounter = 0; int profileSelectorMissingCounter = 0; - for ( String logLine : logLines ) - { - if ( logLine.contains( "The requested optional projects" ) - && logLine.contains( ":does-not-exist" ) - && logLine.contains( "do not exist" ) ) - { + for (String logLine : logLines) { + if (logLine.contains("The requested optional projects") + && logLine.contains(":does-not-exist") + && logLine.contains("do not exist")) { projectSelectorMissingCounter++; } - if ( logLine.contains( "The requested optional profiles" ) - && logLine.contains( "does-not-exist-either" ) - && logLine.contains( "do not exist" ) ) - { + if (logLine.contains("The requested optional profiles") + && logLine.contains("does-not-exist-either") + && logLine.contains("do not exist")) { profileSelectorMissingCounter++; } } - assertEquals( 2, profileSelectorMissingCounter ); - assertEquals( 2, projectSelectorMissingCounter ); + assertEquals(2, profileSelectorMissingCounter); + assertEquals(2, projectSelectorMissingCounter); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7464ReadOnlyMojoParametersWarningTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7464ReadOnlyMojoParametersWarningTest.java index f4676dc442..94b0b4e8dc 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7464ReadOnlyMojoParametersWarningTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7464ReadOnlyMojoParametersWarningTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,15 +16,15 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.ArrayList; import java.util.List; import java.util.regex.Pattern; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -35,108 +33,109 @@ import org.junit.jupiter.api.Test; * * @author Slawomir Jaranowski */ -public class MavenITmng7464ReadOnlyMojoParametersWarningTest extends AbstractMavenIntegrationTestCase -{ - public MavenITmng7464ReadOnlyMojoParametersWarningTest() - { - super( "[3.9.0,)" ); +public class MavenITmng7464ReadOnlyMojoParametersWarningTest extends AbstractMavenIntegrationTestCase { + public MavenITmng7464ReadOnlyMojoParametersWarningTest() { + super("[3.9.0,)"); } /** * Test that ensures that warning is not printed for empty and default value */ @Test - public void testEmptyConfiguration() throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-7464-mojo-read-only-params" ); + public void testEmptyConfiguration() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-7464-mojo-read-only-params"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.setLogFileName( "log-empty-configuration.txt" ); - verifier.addCliArgument( "-Dmaven.plugin.validation=verbose" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.setLogFileName("log-empty-configuration.txt"); + verifier.addCliArgument("-Dmaven.plugin.validation=verbose"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List logLines = verifier.loadFile( verifier.getBasedir(), verifier.getLogFileName(), false ); - List warnLines = findReadOnlyWarning( logLines ); + List logLines = verifier.loadFile(verifier.getBasedir(), verifier.getLogFileName(), false); + List warnLines = findReadOnlyWarning(logLines); - assertTrue( "Unwanted warnings: " + warnLines, warnLines.isEmpty() ); + assertTrue("Unwanted warnings: " + warnLines, warnLines.isEmpty()); } /** * Test that ensures that warning is printed for read-only parameter set by property */ @Test - public void testReadOnlyProperty() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-7464-mojo-read-only-params" ); + public void testReadOnlyProperty() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-7464-mojo-read-only-params"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.addCliArgument( "-Duser.property=value" ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.setLogFileName( "log-read-only-property.txt" ); - verifier.addCliArgument( "-Dmaven.plugin.validation=verbose" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.addCliArgument("-Duser.property=value"); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.setLogFileName("log-read-only-property.txt"); + verifier.addCliArgument("-Dmaven.plugin.validation=verbose"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List logLines = verifier.loadFile( verifier.getBasedir(), verifier.getLogFileName(), false ); - List warnLines = findReadOnlyWarning( logLines ); + List logLines = verifier.loadFile(verifier.getBasedir(), verifier.getLogFileName(), false); + List warnLines = findReadOnlyWarning(logLines); - assertTrue( warnLines.stream().anyMatch( s -> s.contains( - "Parameter 'readOnlyWithUserProperty' (user property 'user.property') is read-only, must not be used in configuration" ) ) ); + assertTrue( + warnLines.stream() + .anyMatch( + s -> s.contains( + "Parameter 'readOnlyWithUserProperty' (user property 'user.property') is read-only, must not be used in configuration"))); } /** * Test that ensures that warning is printed for read-only parameter set by plugin configuration. */ @Test - public void testReadOnlyConfig() throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-7464-mojo-read-only-params" ); + public void testReadOnlyConfig() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-7464-mojo-read-only-params"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.setLogFileName( "log-read-only-configuration.txt" ); - verifier.addCliArgument( "-Pconfig-values" ); - verifier.addCliArgument( "-Dmaven.plugin.validation=verbose" ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.setLogFileName("log-read-only-configuration.txt"); + verifier.addCliArgument("-Pconfig-values"); + verifier.addCliArgument("-Dmaven.plugin.validation=verbose"); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List logLines = verifier.loadFile( verifier.getBasedir(), verifier.getLogFileName(), false ); - List warnLines = findReadOnlyWarning( logLines ); + List logLines = verifier.loadFile(verifier.getBasedir(), verifier.getLogFileName(), false); + List warnLines = findReadOnlyWarning(logLines); - assertTrue( warnLines.stream().anyMatch( s -> s.contains( - "Parameter 'readOnlyWithDefault' is read-only, must not be used in configuration" ) ) ); + assertTrue(warnLines.stream() + .anyMatch(s -> + s.contains("Parameter 'readOnlyWithDefault' is read-only, must not be used in configuration"))); - assertTrue( warnLines.stream().anyMatch( s -> s.contains( - "Parameter 'readOnlyWithOutDefaults' is read-only, must not be used in configuration" ) ) ); + assertTrue(warnLines.stream() + .anyMatch(s -> s.contains( + "Parameter 'readOnlyWithOutDefaults' is read-only, must not be used in configuration"))); - assertTrue( warnLines.stream().anyMatch( s -> s.contains( - "Parameter 'readOnlyWithProperty' (user property 'project.version') is read-only, must not be used in configuration" ) ) ); + assertTrue( + warnLines.stream() + .anyMatch( + s -> s.contains( + "Parameter 'readOnlyWithProperty' (user property 'project.version') is read-only, must not be used in configuration"))); - assertTrue( warnLines.stream().anyMatch( s -> s.contains( - "Parameter 'readOnlyWithUserProperty' (user property 'user.property') is read-only, must not be used in configuration" ) ) ); + assertTrue( + warnLines.stream() + .anyMatch( + s -> s.contains( + "Parameter 'readOnlyWithUserProperty' (user property 'user.property') is read-only, must not be used in configuration"))); } - private List findReadOnlyWarning( List logLines ) - { - Pattern pattern = Pattern.compile( ".* Parameter .* is read-only.*" ); + private List findReadOnlyWarning(List logLines) { + Pattern pattern = Pattern.compile(".* Parameter .* is read-only.*"); List result = new ArrayList<>(); - for ( String line : logLines ) - { - if ( pattern.matcher( line ).matches() ) - { - result.add( line ); + for (String line : logLines) { + if (pattern.matcher(line).matches()) { + result.add(line); } } return result; } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7468UnsupportedPluginsParametersTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7468UnsupportedPluginsParametersTest.java index ffced2f347..d1a320fc05 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7468UnsupportedPluginsParametersTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7468UnsupportedPluginsParametersTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,15 +16,15 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; import java.util.ArrayList; import java.util.List; import java.util.regex.Pattern; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -35,159 +33,148 @@ import org.junit.jupiter.api.Test; * * @author Slawomir Jaranowski */ -public class MavenITmng7468UnsupportedPluginsParametersTest extends AbstractMavenIntegrationTestCase -{ - public MavenITmng7468UnsupportedPluginsParametersTest() - { - super( "[3.9.0,)" ); +public class MavenITmng7468UnsupportedPluginsParametersTest extends AbstractMavenIntegrationTestCase { + public MavenITmng7468UnsupportedPluginsParametersTest() { + super("[3.9.0,)"); } /** * Test that ensures that warning is not printed for empty configuration */ @Test - public void testNoConfiguration() throws Exception - { - List warnLines = performTest( "no-config" ); - assertTrue( "Unwanted warnings: " + warnLines, warnLines.isEmpty() ); + public void testNoConfiguration() throws Exception { + List warnLines = performTest("no-config"); + assertTrue("Unwanted warnings: " + warnLines, warnLines.isEmpty()); } /** * Test that ensures that warning is not printed for valid parameters */ @Test - public void testValidParameter() throws Exception - { - List warnLines = performTest( "valid-parameter" ); - assertTrue( "Unwanted warnings: " + warnLines, warnLines.isEmpty() ); + public void testValidParameter() throws Exception { + List warnLines = performTest("valid-parameter"); + assertTrue("Unwanted warnings: " + warnLines, warnLines.isEmpty()); } /** * Test that ensures that warning is not printed for valid parameters */ @Test - public void testValidParameterAlias() throws Exception - { - List warnLines = performTest( "valid-parameter-alias" ); - assertTrue( "Unwanted warnings: " + warnLines, warnLines.isEmpty() ); + public void testValidParameterAlias() throws Exception { + List warnLines = performTest("valid-parameter-alias"); + assertTrue("Unwanted warnings: " + warnLines, warnLines.isEmpty()); } /** * Test that ensures that warning is not printed for valid parameters */ @Test - public void testValidParameterForOtherGoal() throws Exception - { - List warnLines = performTest( "valid-parameter-other-goal" ); - assertTrue( "Unwanted warnings: " + warnLines, warnLines.isEmpty() ); + public void testValidParameterForOtherGoal() throws Exception { + List warnLines = performTest("valid-parameter-other-goal"); + assertTrue("Unwanted warnings: " + warnLines, warnLines.isEmpty()); } /** * Test that ensures that warning is printed for configuration */ @Test - public void testInBuildPlugin() throws Exception - { - List warnLines = performTest( "config-build-plugin" ); - assertWarningContains( warnLines ); + public void testInBuildPlugin() throws Exception { + List warnLines = performTest("config-build-plugin"); + assertWarningContains(warnLines); } /** * Test that ensures that warning is printed for configuration */ @Test - public void testInBuildExecution() throws Exception - { - List warnLines = performTest( "config-build-execution" ); - assertWarningContains( warnLines ); + public void testInBuildExecution() throws Exception { + List warnLines = performTest("config-build-execution"); + assertWarningContains(warnLines); } /** * Test that ensures that warning is printed for configuration */ @Test - public void testInBuildMixed() throws Exception - { - List warnLines = performTest( "config-build-mixed" ); - assertWarningContains( warnLines ); + public void testInBuildMixed() throws Exception { + List warnLines = performTest("config-build-mixed"); + assertWarningContains(warnLines); } /** * Test that ensures that warning is printed for configuration */ @Test - public void testInPluginManagement() throws Exception - { - List warnLines = performTest( "config-plugin-management" ); - assertWarningContains( warnLines ); + public void testInPluginManagement() throws Exception { + List warnLines = performTest("config-plugin-management"); + assertWarningContains(warnLines); } /** * Test that ensures that warning is printed for configuration */ @Test - public void testInPluginManagementParent() throws Exception - { - List warnLines = performTest( "config-plugin-management-parent" ); - assertWarningContains( warnLines ); + public void testInPluginManagementParent() throws Exception { + List warnLines = performTest("config-plugin-management-parent"); + assertWarningContains(warnLines); } /** * Test that ensures that warning is printed for configuration */ @Test - public void testWithForkedGoalExecution() throws Exception - { - List warnLines = performTest( "config-with-fork-goal" ); + public void testWithForkedGoalExecution() throws Exception { + List warnLines = performTest("config-with-fork-goal"); - assertTrue( warnLines.remove( - "[WARNING] Parameter 'invalidXml' is unknown for plugin 'maven-it-plugin-fork:2.1-SNAPSHOT:fork-goal (fork)'" ) ); + assertTrue( + warnLines.remove( + "[WARNING] Parameter 'invalidXml' is unknown for plugin 'maven-it-plugin-fork:2.1-SNAPSHOT:fork-goal (fork)'")); - assertTrue( warnLines.remove( - "[WARNING] Parameter 'invalidParam' is unknown for plugin 'maven-it-plugin-fork:2.1-SNAPSHOT:fork-goal (fork)'" ) ); + assertTrue( + warnLines.remove( + "[WARNING] Parameter 'invalidParam' is unknown for plugin 'maven-it-plugin-fork:2.1-SNAPSHOT:fork-goal (fork)'")); - assertTrue( warnLines.remove( - "[WARNING] Parameter 'invalidXml' is unknown for plugin 'maven-it-plugin-fork:2.1-SNAPSHOT:touch (touch)'" ) ); + assertTrue( + warnLines.remove( + "[WARNING] Parameter 'invalidXml' is unknown for plugin 'maven-it-plugin-fork:2.1-SNAPSHOT:touch (touch)'")); - assertTrue( warnLines.remove( - "[WARNING] Parameter 'invalidParam' is unknown for plugin 'maven-it-plugin-fork:2.1-SNAPSHOT:touch (touch)'" ) ); + assertTrue( + warnLines.remove( + "[WARNING] Parameter 'invalidParam' is unknown for plugin 'maven-it-plugin-fork:2.1-SNAPSHOT:touch (touch)'")); - assertTrue( "Not verified line: " + warnLines, warnLines.isEmpty() ); + assertTrue("Not verified line: " + warnLines, warnLines.isEmpty()); } - private List performTest( String project ) throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-7468-unsupported-params" ); + private List performTest(String project) throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-7468-unsupported-params"); - Verifier verifier = newVerifier( new File( testDir, project ).getAbsolutePath() ); - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(new File(testDir, project).getAbsolutePath()); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - List logLines = verifier.loadFile( verifier.getBasedir(), verifier.getLogFileName(), false ); - return findUnknownWarning( logLines ); + List logLines = verifier.loadFile(verifier.getBasedir(), verifier.getLogFileName(), false); + return findUnknownWarning(logLines); } - private void assertWarningContains( List warnLines ) - { - assertTrue( warnLines.remove( - "[WARNING] Parameter 'invalidParam' is unknown for plugin 'maven-it-plugin-configuration:2.1-SNAPSHOT:touch (default)'" ) ); + private void assertWarningContains(List warnLines) { + assertTrue( + warnLines.remove( + "[WARNING] Parameter 'invalidParam' is unknown for plugin 'maven-it-plugin-configuration:2.1-SNAPSHOT:touch (default)'")); - assertTrue( warnLines.remove( - "[WARNING] Parameter 'invalidXml' is unknown for plugin 'maven-it-plugin-configuration:2.1-SNAPSHOT:touch (default)'" ) ); + assertTrue( + warnLines.remove( + "[WARNING] Parameter 'invalidXml' is unknown for plugin 'maven-it-plugin-configuration:2.1-SNAPSHOT:touch (default)'")); - assertTrue( "Not verified line: " + warnLines, warnLines.isEmpty() ); + assertTrue("Not verified line: " + warnLines, warnLines.isEmpty()); } - private List findUnknownWarning( List logLines ) - { - Pattern pattern = Pattern.compile( "\\[WARNING] Parameter .* is unknown.*" ); + private List findUnknownWarning(List logLines) { + Pattern pattern = Pattern.compile("\\[WARNING] Parameter .* is unknown.*"); List result = new ArrayList<>(); - for ( String line : logLines ) - { - if ( pattern.matcher( line ).matches() ) - { - result.add( line ); + for (String line : logLines) { + if (pattern.matcher(line).matches()) { + result.add(line); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7470ResolverTransportTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7470ResolverTransportTest.java index 07c84aab97..b6fa21bba3 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7470ResolverTransportTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7470ResolverTransportTest.java @@ -1,12 +1,29 @@ +/* + * 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.it; -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; - import java.io.File; import java.util.HashMap; import java.util.Map; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -15,86 +32,69 @@ import org.junit.jupiter.api.Test; * This is a test set for MNG-7470: * check that Maven bundled transports work as expected. */ -public class MavenITmng7470ResolverTransportTest - extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng7470ResolverTransportTest extends AbstractMavenIntegrationTestCase { private File projectDir; private HttpServer server; private int port; - public MavenITmng7470ResolverTransportTest() - { - super( "[3.9.0,)" ); + public MavenITmng7470ResolverTransportTest() { + super("[3.9.0,)"); } @BeforeEach - protected void setUp() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-7470-resolver-transport" ); - projectDir = new File( testDir, "project" ); + protected void setUp() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-7470-resolver-transport"); + projectDir = new File(testDir, "project"); - server = HttpServer.builder() - .port( 0 ) - .source( new File( testDir, "repo" ) ) - .build(); + server = HttpServer.builder().port(0).source(new File(testDir, "repo")).build(); server.start(); - if ( server.isFailed() ) - { - fail( "Couldn't bind the server socket to a free port!" ); + if (server.isFailed()) { + fail("Couldn't bind the server socket to a free port!"); } port = server.port(); - System.out.println( "Bound server socket to the port " + port ); + System.out.println("Bound server socket to the port " + port); } @AfterEach - protected void tearDown() - throws Exception - { - if ( server != null ) - { + protected void tearDown() throws Exception { + if (server != null) { server.stop(); server.join(); } } - private void performTest( /* nullable */ final String transport, final String logSnippet ) throws Exception - { - Verifier verifier = newVerifier( projectDir.getAbsolutePath() ); - verifier.setForkJvm( true ); + private void performTest(/* nullable */ final String transport, final String logSnippet) throws Exception { + Verifier verifier = newVerifier(projectDir.getAbsolutePath()); + verifier.setForkJvm(true); Map properties = new HashMap<>(); - properties.put( "@port@", Integer.toString( port ) ); - verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", properties ); - if ( transport == null ) - { - verifier.setLogFileName( "default-transport.log" ); + properties.put("@port@", Integer.toString(port)); + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8", properties); + if (transport == null) { + verifier.setLogFileName("default-transport.log"); + } else { + verifier.setLogFileName(transport + "-transport.log"); } - else - { - verifier.setLogFileName( transport + "-transport.log" ); - } - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.resolver.resolver-demo-maven-plugin" ); - verifier.deleteArtifacts( "org.apache.maven.its.resolver-transport" ); - verifier.addCliArgument( "-X" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( new File( projectDir, "settings.xml" ).getAbsolutePath() ); - verifier.addCliArgument( "-Pmaven-core-it-repo" ); - if ( transport != null ) - { - verifier.addCliArgument( "-Dmaven.resolver.transport=" + transport ); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.resolver.resolver-demo-maven-plugin"); + verifier.deleteArtifacts("org.apache.maven.its.resolver-transport"); + verifier.addCliArgument("-X"); + verifier.addCliArgument("-s"); + verifier.addCliArgument(new File(projectDir, "settings.xml").getAbsolutePath()); + verifier.addCliArgument("-Pmaven-core-it-repo"); + if (transport != null) { + verifier.addCliArgument("-Dmaven.resolver.transport=" + transport); } // Maven will fail if project dependencies cannot be resolved. // As dependency exists ONLY in HTTP repo, it MUST be reached using selected transport and // successfully resolved from it. - verifier.addCliArgument( "verify" ); + verifier.addCliArgument("verify"); verifier.execute(); verifier.verifyErrorFreeLog(); // verify maven console output contains "[DEBUG] Using transporter XXXTransporter" - verifier.verifyTextInLog( logSnippet ); + verifier.verifyTextInLog(logSnippet); } private static final String WAGON_LOG_SNIPPET = "[DEBUG] Using transporter WagonTransporter"; @@ -102,23 +102,17 @@ public class MavenITmng7470ResolverTransportTest private static final String NATIVE_LOG_SNIPPET = "[DEBUG] Using transporter HttpTransporter"; @Test - public void testResolverTransportDefault() - throws Exception - { - performTest( null, NATIVE_LOG_SNIPPET ); + public void testResolverTransportDefault() throws Exception { + performTest(null, NATIVE_LOG_SNIPPET); } @Test - public void testResolverTransportWagon() - throws Exception - { - performTest( "wagon", WAGON_LOG_SNIPPET ); + public void testResolverTransportWagon() throws Exception { + performTest("wagon", WAGON_LOG_SNIPPET); } @Test - public void testResolverTransportNative() - throws Exception - { - performTest( "native", NATIVE_LOG_SNIPPET ); + public void testResolverTransportNative() throws Exception { + performTest("native", NATIVE_LOG_SNIPPET); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7474SessionScopeTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7474SessionScopeTest.java index 59dcac47bc..0e31794533 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7474SessionScopeTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7474SessionScopeTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.it; * "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 + * 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 @@ -18,41 +16,35 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** * This is a test set for MNG-7474: * check that Session scope beans are actually singletons for the session. */ -public class MavenITmng7474SessionScopeTest - extends AbstractMavenIntegrationTestCase -{ - public MavenITmng7474SessionScopeTest() - { - super( "[3.9.0,)" ); +public class MavenITmng7474SessionScopeTest extends AbstractMavenIntegrationTestCase { + public MavenITmng7474SessionScopeTest() { + super("[3.9.0,)"); } @Test - public void testSessionScope() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-7474-session-scope" ); + public void testSessionScope() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-7474-session-scope"); - Verifier verifier = newVerifier( new File( testDir, "plugin" ).getAbsolutePath() ); - verifier.addCliArgument( "install" ); + Verifier verifier = newVerifier(new File(testDir, "plugin").getAbsolutePath()); + verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier = newVerifier( new File( testDir, "project" ).getAbsolutePath() ); - verifier.addCliArgument( "validate" ); + verifier = newVerifier(new File(testDir, "project").getAbsolutePath()); + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7487DeadlockTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7487DeadlockTest.java index 4e2b0f9361..4971f6ce41 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7487DeadlockTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7487DeadlockTest.java @@ -18,42 +18,38 @@ */ package org.apache.maven.it; -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; - import java.io.File; import java.io.IOException; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; -public class MavenITmng7487DeadlockTest extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng7487DeadlockTest extends AbstractMavenIntegrationTestCase { private static final String PROJECT_PATH = "/mng-7487-deadlock"; - public MavenITmng7487DeadlockTest() - { - super( "(,3.8.4],[3.8.6,)" ); + public MavenITmng7487DeadlockTest() { + super("(,3.8.4],[3.8.6,)"); } @Test - public void testDeadlock() throws IOException, VerificationException - { - final File rootDir = ResourceExtractor.simpleExtractResources( getClass(), PROJECT_PATH ); + public void testDeadlock() throws IOException, VerificationException { + final File rootDir = ResourceExtractor.simpleExtractResources(getClass(), PROJECT_PATH); - final File pluginDir = new File( rootDir, "plugin" ); - final Verifier pluginVerifier = newVerifier( pluginDir.getAbsolutePath() ); - pluginVerifier.addCliArgument( "install" ); + final File pluginDir = new File(rootDir, "plugin"); + final Verifier pluginVerifier = newVerifier(pluginDir.getAbsolutePath()); + pluginVerifier.addCliArgument("install"); pluginVerifier.execute(); - final File consumerDir = new File( rootDir, "consumer" ); - final Verifier consumerVerifier = newVerifier( consumerDir.getAbsolutePath() ); - consumerVerifier.setForkJvm( true );; - consumerVerifier.addCliArgument( "-T2" ); - consumerVerifier.addCliArgument( "package" ); + final File consumerDir = new File(rootDir, "consumer"); + final Verifier consumerVerifier = newVerifier(consumerDir.getAbsolutePath()); + consumerVerifier.setForkJvm(true); + ; + consumerVerifier.addCliArgument("-T2"); + consumerVerifier.addCliArgument("package"); consumerVerifier.execute(); consumerVerifier.verifyErrorFreeLog(); - consumerVerifier.verifyTextInLog( "BUILD SUCCESS" ); + consumerVerifier.verifyTextInLog("BUILD SUCCESS"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7504NotWarnUnsupportedReportPluginsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7504NotWarnUnsupportedReportPluginsTest.java index 0d57f0a9d9..8e4edc22c8 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7504NotWarnUnsupportedReportPluginsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7504NotWarnUnsupportedReportPluginsTest.java @@ -18,14 +18,13 @@ */ package org.apache.maven.it; -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; -import org.apache.maven.shared.verifier.VerificationException; - import java.io.File; import java.io.IOException; import java.util.List; +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** @@ -36,31 +35,29 @@ import org.junit.jupiter.api.Test; * * @author Slawomir Jaranowski */ -public class MavenITmng7504NotWarnUnsupportedReportPluginsTest extends AbstractMavenIntegrationTestCase -{ +public class MavenITmng7504NotWarnUnsupportedReportPluginsTest extends AbstractMavenIntegrationTestCase { private static final String PROJECT_PATH = "/mng-7504-warn-unsupported-report-plugins"; - public MavenITmng7504NotWarnUnsupportedReportPluginsTest() - { - super( "[3.9.0]" ); + public MavenITmng7504NotWarnUnsupportedReportPluginsTest() { + super("[3.9.0]"); } @Test - public void testWarnNotPresent() throws IOException, VerificationException - { - File rootDir = ResourceExtractor.simpleExtractResources( getClass(), PROJECT_PATH ); + public void testWarnNotPresent() throws IOException, VerificationException { + File rootDir = ResourceExtractor.simpleExtractResources(getClass(), PROJECT_PATH); - Verifier verifier = newVerifier( rootDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.addCliArgument( "site" ); + Verifier verifier = newVerifier(rootDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.addCliArgument("site"); verifier.execute(); - List logLines = verifier.loadFile( verifier.getBasedir(), verifier.getLogFileName(), false ); + List logLines = verifier.loadFile(verifier.getBasedir(), verifier.getLogFileName(), false); - for ( String line : logLines ) - { - assertFalse( line.contains( "[WARNING] Parameter 'reportPlugins' is unknown for plugin 'maven-site-plugin:0.1-stub-SNAPSHOT:site (default-site)'" ) ); + for (String line : logLines) { + assertFalse( + line.contains( + "[WARNING] Parameter 'reportPlugins' is unknown for plugin 'maven-site-plugin:0.1-stub-SNAPSHOT:site (default-site)'")); } } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7529VersionRangeRepositorySelection.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7529VersionRangeRepositorySelection.java index 3ff0a910c6..2e6973f575 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7529VersionRangeRepositorySelection.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7529VersionRangeRepositorySelection.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,44 +16,42 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.apache.maven.shared.verifier.Verifier; +package org.apache.maven.it; import java.io.File; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; /** * This is a test set for MNG-7529. */ -public class MavenITmng7529VersionRangeRepositorySelection - extends AbstractMavenIntegrationTestCase { +public class MavenITmng7529VersionRangeRepositorySelection extends AbstractMavenIntegrationTestCase { - public MavenITmng7529VersionRangeRepositorySelection() { - super("(3.8.6,)"); - } + public MavenITmng7529VersionRangeRepositorySelection() { + super("(3.8.6,)"); + } - /** - * Test dependency resolution from a version range using multiple remote repositories - * with snapshot or release enabled. - * - * @throws Exception in case of failure - */ - @Test - public void testit() - throws Exception { - File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-7529"); - Verifier verifier = newVerifier(testDir.getAbsolutePath()); - verifier.setAutoclean(false); - verifier.deleteDirectory("target"); - verifier.deleteArtifacts("org.apache.maven.its.mng7529"); - verifier.addCliArgument("--settings"); - verifier.addCliArgument("settings.xml"); + /** + * Test dependency resolution from a version range using multiple remote repositories + * with snapshot or release enabled. + * + * @throws Exception in case of failure + */ + @Test + public void testit() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-7529"); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng7529"); + verifier.addCliArgument("--settings"); + verifier.addCliArgument("settings.xml"); - verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); - verifier.addCliArgument("validate"); - verifier.execute(); - verifier.verifyErrorFreeLog(); - } + verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("validate"); + verifier.execute(); + verifier.verifyErrorFreeLog(); + } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7566JavaPrerequisiteTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7566JavaPrerequisiteTest.java index 1f0cf8d4bc..f0f55c8037 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7566JavaPrerequisiteTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7566JavaPrerequisiteTest.java @@ -1,3 +1,21 @@ +/* + * 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.it; import java.io.File; @@ -11,13 +29,10 @@ import org.junit.jupiter.api.Test; * Similar to {@link MavenITmng4840MavenPrerequisiteTest}. * */ -class MavenITmng7566JavaPrerequisiteTest - extends AbstractMavenIntegrationTestCase -{ +class MavenITmng7566JavaPrerequisiteTest extends AbstractMavenIntegrationTestCase { - public MavenITmng7566JavaPrerequisiteTest() - { - super( "[4.0.0-alpha-3,)" ); + public MavenITmng7566JavaPrerequisiteTest() { + super("[4.0.0-alpha-3,)"); } /** @@ -26,27 +41,22 @@ class MavenITmng7566JavaPrerequisiteTest * @throws Exception in case of failure */ @Test - void testitMojoExecution() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-7566" ); + void testitMojoExecution() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-7566"); - Verifier verifier = newVerifier( new File( testDir, "test-1" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng7566" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.filterFile( "../settings-template.xml", "settings.xml", "UTF-8" ); - try - { - verifier.addCliArgument( "validate" ); + Verifier verifier = newVerifier(new File(testDir, "test-1").getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng7566"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.filterFile("../settings-template.xml", "settings.xml", "UTF-8"); + try { + verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - fail( "Build did not fail despite unsatisfied prerequisite of plugin on Maven version." ); - } - catch ( Exception e ) - { + fail("Build did not fail despite unsatisfied prerequisite of plugin on Maven version."); + } catch (Exception e) { // expected, unsolvable version conflict } } @@ -58,24 +68,21 @@ class MavenITmng7566JavaPrerequisiteTest * @throws Exception in case of failure */ @Test - void testitPluginVersionResolution() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-7566" ); + void testitPluginVersionResolution() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-7566"); - Verifier verifier = newVerifier( new File( testDir, "test-2" ).getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.deleteDirectory( "target" ); - verifier.deleteArtifacts( "org.apache.maven.its.mng7566" ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.filterFile( "../settings-template.xml", "settings.xml", "UTF-8" ); - verifier.addCliArgument( "org.apache.maven.its.mng7566:maven-mng7566-plugin:touch" ); + Verifier verifier = newVerifier(new File(testDir, "test-2").getAbsolutePath()); + verifier.setAutoclean(false); + verifier.deleteDirectory("target"); + verifier.deleteArtifacts("org.apache.maven.its.mng7566"); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.filterFile("../settings-template.xml", "settings.xml", "UTF-8"); + verifier.addCliArgument("org.apache.maven.its.mng7566:maven-mng7566-plugin:touch"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyFilePresent( "target/touch-1.txt" ); - verifier.verifyFileNotPresent( "target/touch-2.txt" ); + verifier.verifyFilePresent("target/touch-1.txt"); + verifier.verifyFileNotPresent("target/touch-2.txt"); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7587Jsr330.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7587Jsr330.java index 869dc59b91..551691579e 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7587Jsr330.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7587Jsr330.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,30 +16,26 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.it; + +import java.io.File; import org.apache.maven.shared.verifier.Verifier; import org.apache.maven.shared.verifier.util.ResourceExtractor; -import org.codehaus.plexus.util.Os; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.condition.EnabledOnJre; import org.junit.jupiter.api.condition.JRE; -import java.io.File; - /** * This is a test set for MNG-7587. * Simply verifies that plexus component using JSR330 and compiled with JDK 17 bytecode can * work on maven. */ -class MavenITmng7587Jsr330 - extends AbstractMavenIntegrationTestCase -{ +class MavenITmng7587Jsr330 extends AbstractMavenIntegrationTestCase { - public MavenITmng7587Jsr330() - { + public MavenITmng7587Jsr330() { // affected Maven versions: 3.9.2 and 4.0.0-alpha-5 - super( "(3.9.2,3.999),(4.0.0-alpha-5,)" ); + super("(3.9.2,3.999),(4.0.0-alpha-5,)"); } /** @@ -51,23 +45,22 @@ class MavenITmng7587Jsr330 */ @Test @EnabledOnJre(JRE.JAVA_17) - void testJdk17() throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-7587-jsr330").getAbsoluteFile(); + void testJdk17() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-7587-jsr330") + .getAbsoluteFile(); - final Verifier pluginVerifier = newVerifier( new File( testDir, "plugin" ).getPath() ); - pluginVerifier.addCliArgument( "clean" ); - pluginVerifier.addCliArgument( "install" ); - pluginVerifier.addCliArgument( "-V" ); + final Verifier pluginVerifier = newVerifier(new File(testDir, "plugin").getPath()); + pluginVerifier.addCliArgument("clean"); + pluginVerifier.addCliArgument("install"); + pluginVerifier.addCliArgument("-V"); pluginVerifier.execute(); pluginVerifier.verifyErrorFreeLog(); - final Verifier consumerVerifier = newVerifier( new File( testDir, "consumer" ).getPath() ); - consumerVerifier.addCliArgument( "clean" ); - consumerVerifier.addCliArgument( "verify" ); - consumerVerifier.addCliArgument( "-V" ); + final Verifier consumerVerifier = newVerifier(new File(testDir, "consumer").getPath()); + consumerVerifier.addCliArgument("clean"); + consumerVerifier.addCliArgument("verify"); + consumerVerifier.addCliArgument("-V"); consumerVerifier.execute(); consumerVerifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7606DependencyImportScopeTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7606DependencyImportScopeTest.java index 46211ca797..930697cb73 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7606DependencyImportScopeTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7606DependencyImportScopeTest.java @@ -1,3 +1,21 @@ +/* + * 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.it; import java.io.File; @@ -11,13 +29,10 @@ import org.junit.jupiter.api.Test; * It checks that "import" scope for dependencies work * */ -class MavenITmng7606DependencyImportScopeTest - extends AbstractMavenIntegrationTestCase -{ +class MavenITmng7606DependencyImportScopeTest extends AbstractMavenIntegrationTestCase { - public MavenITmng7606DependencyImportScopeTest() - { - super( ALL_MAVEN_VERSIONS ); + public MavenITmng7606DependencyImportScopeTest() { + super(ALL_MAVEN_VERSIONS); } /** @@ -26,17 +41,14 @@ class MavenITmng7606DependencyImportScopeTest * @throws Exception in case of failure */ @Test - void testDependencyResolution() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-7606" ); + void testDependencyResolution() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-7606"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( true ); - verifier.deleteArtifacts( "org.apache.maven.its.mng7606" ); - verifier.addCliArgument( "verify" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(true); + verifier.deleteArtifacts("org.apache.maven.its.mng7606"); + verifier.addCliArgument("verify"); verifier.execute(); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7629SubtreeBuildTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7629SubtreeBuildTest.java index 48b0c69aab..e9375b581e 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7629SubtreeBuildTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7629SubtreeBuildTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,25 +16,23 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.it; + +import java.io.File; import org.apache.maven.shared.verifier.Verifier; import org.apache.maven.shared.verifier.util.ResourceExtractor; import org.junit.jupiter.api.Test; -import java.io.File; - /** * This is a test set for MNG-7629. * It checks that building a subtree that consumes an attached artifact works * */ -class MavenITmng7629SubtreeBuildTest - extends AbstractMavenIntegrationTestCase -{ +class MavenITmng7629SubtreeBuildTest extends AbstractMavenIntegrationTestCase { - public MavenITmng7629SubtreeBuildTest() - { - super( "[4.0.0-alpha-4,)" ); + public MavenITmng7629SubtreeBuildTest() { + super("[4.0.0-alpha-4,)"); } /** @@ -45,22 +41,19 @@ class MavenITmng7629SubtreeBuildTest * @throws Exception in case of failure */ @Test - void testBuildSubtree() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-7629" ); + void testBuildSubtree() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-7629"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( true ); - verifier.addCliArgument( "verify" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(true); + verifier.addCliArgument("verify"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( true ); - verifier.addCliArguments( "-f", "child-2", "verify" ); + verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(true); + verifier.addCliArguments("-f", "child-2", "verify"); verifier.execute(); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7679SingleMojoNoPomTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7679SingleMojoNoPomTest.java index 3d4ee66a15..6f6d30c340 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7679SingleMojoNoPomTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7679SingleMojoNoPomTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,7 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.it; import java.io.File; @@ -30,14 +29,11 @@ import org.junit.jupiter.api.Test; * Executing single mojo without POM should not NPE. * */ -class MavenITmng7679SingleMojoNoPomTest - extends AbstractMavenIntegrationTestCase -{ +class MavenITmng7679SingleMojoNoPomTest extends AbstractMavenIntegrationTestCase { - public MavenITmng7679SingleMojoNoPomTest() - { + public MavenITmng7679SingleMojoNoPomTest() { // affected Maven versions: 3.8.7, 3.9.0, 4.0.0-alpha-4 - super( "(,3.8.7)(3.8.7,3.9.0),(3.9.0,4.0.0-alpha-4),(4.0.0-alpha-4,)" ); + super("(,3.8.7)(3.8.7,3.9.0),(3.9.0,4.0.0-alpha-4),(4.0.0-alpha-4,)"); } /** @@ -46,20 +42,17 @@ class MavenITmng7679SingleMojoNoPomTest * @throws Exception in case of failure */ @Test - void testSingleMojoNoPom() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-7679" ); + void testSingleMojoNoPom() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-7679"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.addCliArgument( "install:install-file" ); - verifier.addCliArgument( "-Dfile=mng-7679.txt" ); - verifier.addCliArgument( "-DgroupId=org.apache.maven.it.mng7679" ); - verifier.addCliArgument( "-DartifactId=artifact" ); - verifier.addCliArgument( "-Dversion=1.0.0" ); - verifier.addCliArgument( "-Dpackaging=jar" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.addCliArgument("install:install-file"); + verifier.addCliArgument("-Dfile=mng-7679.txt"); + verifier.addCliArgument("-DgroupId=org.apache.maven.it.mng7679"); + verifier.addCliArgument("-DartifactId=artifact"); + verifier.addCliArgument("-Dversion=1.0.0"); + verifier.addCliArgument("-Dpackaging=jar"); verifier.execute(); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7697PomWithEmojiTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7697PomWithEmojiTest.java index 76cdaf4885..8d3c12667d 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7697PomWithEmojiTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7697PomWithEmojiTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,7 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.it; import java.io.File; @@ -29,14 +28,11 @@ import org.junit.jupiter.api.Test; * This is a test set for MNG-7697. * Verifies if pom with emoji in comments are parsed. */ -class MavenITmng7697PomWithEmojiTest - extends AbstractMavenIntegrationTestCase -{ +class MavenITmng7697PomWithEmojiTest extends AbstractMavenIntegrationTestCase { - public MavenITmng7697PomWithEmojiTest() - { + public MavenITmng7697PomWithEmojiTest() { // affected Maven versions: 3.9.0, 4.0.0-alpha-4 - super( "(,3.9.0),(3.9.0,4.0.0-alpha-4),(4.0.0-alpha-4,)" ); + super("(,3.9.0),(3.9.0,4.0.0-alpha-4),(4.0.0-alpha-4,)"); } /** @@ -45,14 +41,12 @@ class MavenITmng7697PomWithEmojiTest * @throws Exception in case of failure */ @Test - void testPomRead() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-7697-emoji" ); + void testPomRead() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-7697-emoji"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.addCliArgument( "verify" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.setAutoclean(false); + verifier.addCliArgument("verify"); verifier.execute(); verifier.verifyErrorFreeLog(); } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7716BuildDeadlock.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7716BuildDeadlock.java index f1a4ebc7fc..2483df65fa 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7716BuildDeadlock.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7716BuildDeadlock.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,7 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.it; import java.io.File; import java.util.concurrent.TimeUnit; @@ -33,13 +32,10 @@ import org.junit.jupiter.api.Timeout; * Executing the project should not deadlock * */ -class MavenITmng7716BuildDeadlock - extends AbstractMavenIntegrationTestCase -{ +class MavenITmng7716BuildDeadlock extends AbstractMavenIntegrationTestCase { - public MavenITmng7716BuildDeadlock() - { - super( "[3.8.8,3.9.0),[3.9.1,4.0.0-alpha-1),[4.0.0-alpha-5,)" ); + public MavenITmng7716BuildDeadlock() { + super("[3.8.8,3.9.0),[3.9.1,4.0.0-alpha-1),[4.0.0-alpha-5,)"); } /** @@ -48,26 +44,23 @@ class MavenITmng7716BuildDeadlock * @throws Exception in case of failure */ @Test - @Timeout( value = 120, unit = TimeUnit.SECONDS ) - void testNoDeadlockAtVersionUpdate() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-7716" ); + @Timeout(value = 120, unit = TimeUnit.SECONDS) + void testNoDeadlockAtVersionUpdate() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-7716"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.addCliArgument( "-f" ); - verifier.addCliArgument( "settings" ); - verifier.addCliArgument( "install" ); - verifier.setLogFileName( "log-settings.txt" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.addCliArgument("-f"); + verifier.addCliArgument("settings"); + verifier.addCliArgument("install"); + verifier.setLogFileName("log-settings.txt"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.addCliArgument( "-T1C" ); - verifier.addCliArgument( "org.codehaus.mojo:versions-maven-plugin:2.15.0:set" ); - verifier.addCliArgument( "-DnewVersion=1.2.3" ); + verifier = newVerifier(testDir.getAbsolutePath()); + verifier.addCliArgument("-T1C"); + verifier.addCliArgument("org.codehaus.mojo:versions-maven-plugin:2.15.0:set"); + verifier.addCliArgument("-DnewVersion=1.2.3"); verifier.execute(); verifier.verifyErrorFreeLog(); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7737ProfileActivationTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7737ProfileActivationTest.java index f876f04fca..ac4c0f3bb2 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7737ProfileActivationTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7737ProfileActivationTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,9 +16,9 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.it; import java.io.File; -import java.util.List; import org.apache.maven.shared.verifier.Verifier; import org.apache.maven.shared.verifier.util.ResourceExtractor; @@ -32,14 +30,11 @@ import org.junit.jupiter.api.Test; * Simply verifies that various (expected) profiles are properly activated or not. * */ -class MavenITmng7737ProfileActivationTest - extends AbstractMavenIntegrationTestCase -{ +class MavenITmng7737ProfileActivationTest extends AbstractMavenIntegrationTestCase { - public MavenITmng7737ProfileActivationTest() - { + public MavenITmng7737ProfileActivationTest() { // affected Maven versions: 3.9.0 - super( "(,3.9.0),(3.9.0,)" ); + super("(,3.9.0),(3.9.0,)"); } /** @@ -48,56 +43,54 @@ class MavenITmng7737ProfileActivationTest * @throws Exception in case of failure */ @Test - void testSingleMojoNoPom() - throws Exception - { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-7737-profiles" ); + void testSingleMojoNoPom() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-7737-profiles"); - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.addCliArgument( "-s" ); - verifier.addCliArgument( "settings.xml" ); - verifier.addCliArgument( "org.apache.maven.plugins:maven-help-plugin:3.3.0:active-profiles" ); - verifier.addCliArgument( "-Dsettings-property" ); - verifier.addCliArgument( "-Dpom-property" ); + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.addCliArgument("-s"); + verifier.addCliArgument("settings.xml"); + verifier.addCliArgument("org.apache.maven.plugins:maven-help-plugin:3.3.0:active-profiles"); + verifier.addCliArgument("-Dsettings-property"); + verifier.addCliArgument("-Dpom-property"); verifier.execute(); verifier.verifyErrorFreeLog(); // Example output on my Linux Box w/ Java 17 - //The following profiles are active: + // The following profiles are active: // - //- settings-active-default (source: external) - //- settings-active (source: external) - //- settings-jdk-8 (source: external) - //- settings-jdk-11 (source: external) - //- settings-jdk-17 (source: external) - //- settings-os-unix (source: external) - //- settings-property (source: external) - //- settings-file-exists-present (source: external) - //- settings-file-missing-absent (source: external) - //- it-defaults (source: external) - //- pom-jdk-8 (source: org.apache.maven.its.mng7737:test:0.1) - //- pom-jdk-11 (source: org.apache.maven.its.mng7737:test:0.1) - //- pom-jdk-17 (source: org.apache.maven.its.mng7737:test:0.1) - //- pom-os-unix (source: org.apache.maven.its.mng7737:test:0.1) - //- pom-property (source: org.apache.maven.its.mng7737:test:0.1) - //- pom-file-exists-present (source: org.apache.maven.its.mng7737:test:0.1) - //- pom-file-missing-absent (source: org.apache.maven.its.mng7737:test:0.1) + // - settings-active-default (source: external) + // - settings-active (source: external) + // - settings-jdk-8 (source: external) + // - settings-jdk-11 (source: external) + // - settings-jdk-17 (source: external) + // - settings-os-unix (source: external) + // - settings-property (source: external) + // - settings-file-exists-present (source: external) + // - settings-file-missing-absent (source: external) + // - it-defaults (source: external) + // - pom-jdk-8 (source: org.apache.maven.its.mng7737:test:0.1) + // - pom-jdk-11 (source: org.apache.maven.its.mng7737:test:0.1) + // - pom-jdk-17 (source: org.apache.maven.its.mng7737:test:0.1) + // - pom-os-unix (source: org.apache.maven.its.mng7737:test:0.1) + // - pom-property (source: org.apache.maven.its.mng7737:test:0.1) + // - pom-file-exists-present (source: org.apache.maven.its.mng7737:test:0.1) + // - pom-file-missing-absent (source: org.apache.maven.its.mng7737:test:0.1) - verifier.verifyTextInLog( "settings-active-default" ); - verifier.verifyTextInLog( "settings-active" ); - verifier.verifyTextInLog( "settings-jdk"); // enough, as we build on 8+ at least one is present - verifier.verifyTextInLog( "settings-os-" + Os.OS_FAMILY ); - verifier.verifyTextInLog( "settings-property" ); - verifier.verifyTextInLog( "settings-file-exists-present" ); - verifier.verifyTextInLog( "settings-file-missing-absent" ); + verifier.verifyTextInLog("settings-active-default"); + verifier.verifyTextInLog("settings-active"); + verifier.verifyTextInLog("settings-jdk"); // enough, as we build on 8+ at least one is present + verifier.verifyTextInLog("settings-os-" + Os.OS_FAMILY); + verifier.verifyTextInLog("settings-property"); + verifier.verifyTextInLog("settings-file-exists-present"); + verifier.verifyTextInLog("settings-file-missing-absent"); // In case of POM, the pom-active-default documented constraint stands: // "This profile will automatically be active for all builds unless // **another profile in the same POM** is activated using one of the previously described methods." - verifier.verifyTextInLog( "pom-jdk"); // enough, as we build on 8+ at least one is present - verifier.verifyTextInLog( "pom-os-" + Os.OS_FAMILY ); - verifier.verifyTextInLog( "pom-property" ); - verifier.verifyTextInLog( "pom-file-exists-present" ); - verifier.verifyTextInLog( "pom-file-missing-absent" ); + verifier.verifyTextInLog("pom-jdk"); // enough, as we build on 8+ at least one is present + verifier.verifyTextInLog("pom-os-" + Os.OS_FAMILY); + verifier.verifyTextInLog("pom-property"); + verifier.verifyTextInLog("pom-file-exists-present"); + verifier.verifyTextInLog("pom-file-missing-absent"); } } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/TestSuiteOrdering.java b/its/core-it-suite/src/test/java/org/apache/maven/it/TestSuiteOrdering.java index 5c755a96ef..d6fddd654e 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/TestSuiteOrdering.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/TestSuiteOrdering.java @@ -1,3 +1,21 @@ +/* + * 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.it; /* @@ -37,73 +55,64 @@ import org.junit.jupiter.api.Tag; /** * The Core IT suite. */ -public class TestSuiteOrdering implements ClassOrderer -{ +public class TestSuiteOrdering implements ClassOrderer { private static PrintStream out = System.out; // store missed test to show info only once - private final static List> MISSED_TESTS = new ArrayList<>(); + private static final List> MISSED_TESTS = new ArrayList<>(); final Map, Integer> tests = new HashMap<>(); - private static void infoProperty( PrintStream info, String property ) - { - info.println( property + ": " + System.getProperty( property ) ); + private static void infoProperty(PrintStream info, String property) { + info.println(property + ": " + System.getProperty(property)); } - static - { - try - { + static { + try { // TODO: workaround for https://github.com/apache/maven-integration-testing/pull/232 // The verifier currently uses system properties to configure itself, such as - // maven.home (see https://github.com/apache/maven-integration-testing/blob/ba72268198fb4c68890f11bfa0aac3f4889c79b9/core-it-suite/pom.xml#L509-L511) + // maven.home (see + // https://github.com/apache/maven-integration-testing/blob/ba72268198fb4c68890f11bfa0aac3f4889c79b9/core-it-suite/pom.xml#L509-L511) // or other properties to configure the maven that will be launched. Using system properties // make impossible the detection whether a system property has been set by the maven being run // or by the code that wants to use the verifier to create a new embedded maven, which means // those properties can not be cleared by the verifier. So clear those properties here, as // we do want to isolate the tests from the outside environment. - System.clearProperty( "maven.bootclasspath" ); - System.clearProperty( "maven.conf" ); - System.clearProperty( "classworlds.conf" ); + System.clearProperty("maven.bootclasspath"); + System.clearProperty("maven.conf"); + System.clearProperty("classworlds.conf"); - Verifier verifier = new Verifier( "" ); + Verifier verifier = new Verifier(""); String mavenVersion = verifier.getMavenVersion(); String executable = verifier.getExecutable(); - out.println( "Running integration tests for Maven " + mavenVersion + System.lineSeparator() - + "\tusing Maven executable: " + executable + System.lineSeparator() - + "\twith verifier.forkMode: " + System.getProperty( "verifier.forkMode", - "not defined == fork" ) ); + out.println("Running integration tests for Maven " + mavenVersion + System.lineSeparator() + + "\tusing Maven executable: " + executable + System.lineSeparator() + + "\twith verifier.forkMode: " + System.getProperty("verifier.forkMode", "not defined == fork")); - System.setProperty( "maven.version", mavenVersion ); + System.setProperty("maven.version", mavenVersion); - String basedir = System.getProperty( "basedir", "." ); + String basedir = System.getProperty("basedir", "."); - try ( PrintStream info = new PrintStream( - Files.newOutputStream( Paths.get( basedir, "target/info.txt" ) ) ) ) - { - infoProperty( info, "maven.version" ); - infoProperty( info, "java.version" ); - infoProperty( info, "os.name" ); - infoProperty( info, "os.version" ); + try (PrintStream info = new PrintStream(Files.newOutputStream(Paths.get(basedir, "target/info.txt")))) { + infoProperty(info, "maven.version"); + infoProperty(info, "java.version"); + infoProperty(info, "os.name"); + infoProperty(info, "os.version"); } - } - catch ( Exception e ) - { - throw new RuntimeException( e ); + } catch (Exception e) { + throw new RuntimeException(e); } } - public TestSuiteOrdering() - { + public TestSuiteOrdering() { TestSuiteOrdering suite = this; /* * This must be the first one to ensure the local repository is properly setup. */ - suite.addTestSuite( MavenITBootstrapTest.class, -10 ); + suite.addTestSuite(MavenITBootstrapTest.class, -10); /* * Add tests in reverse order of implementation. This makes testing new @@ -111,681 +120,676 @@ public class TestSuiteOrdering implements ClassOrderer * the tests are to finishing. Newer tests are also more likely to fail, so this is * a fail fast technique as well. */ - suite.addTestSuite( MavenITmng7587Jsr330.class ); - suite.addTestSuite( MavenITmng7038RootdirTest.class ); - suite.addTestSuite( MavenITmng7697PomWithEmojiTest.class ); - suite.addTestSuite( MavenITmng7737ProfileActivationTest.class ); - suite.addTestSuite( MavenITmng7716BuildDeadlock.class ); - suite.addTestSuite( MavenITmng7679SingleMojoNoPomTest.class ); - suite.addTestSuite( MavenITmng7629SubtreeBuildTest.class ); - suite.addTestSuite( MavenITmng7606DependencyImportScopeTest.class ); - suite.addTestSuite( MavenITmng6609ProfileActivationForPackagingTest.class ); - suite.addTestSuite( MavenITmng7566JavaPrerequisiteTest.class ); - suite.addTestSuite( MavenITmng5889FindBasedir.class ); - suite.addTestSuite( MavenITmng7360BuildConsumer.class ); - suite.addTestSuite( MavenITmng5452MavenBuildTimestampUTCTest.class ); - suite.addTestSuite( MavenITmng3890TransitiveDependencyScopeUpdateTest.class ); - suite.addTestSuite( MavenITmng3092SnapshotsExcludedFromVersionRangeTest.class ); - suite.addTestSuite( MavenITmng3038TransitiveDepManVersionTest.class ); - suite.addTestSuite( MavenITmng2771PomExtensionComponentOverrideTest.class ); - suite.addTestSuite( MavenITmng0612NewestConflictResolverTest.class ); - suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); - suite.addTestSuite( MavenITmng7310LifecycleActivatedInSpecifiedModuleTest.class ); - suite.addTestSuite( MavenITmng7474SessionScopeTest.class ); - suite.addTestSuite( MavenITmng7529VersionRangeRepositorySelection.class ); - suite.addTestSuite( MavenITmng7443ConsistencyOfOptionalProjectsAndProfilesTest.class ); - suite.addTestSuite( MavenITmng7353CliGoalInvocationTest.class ); - suite.addTestSuite( MavenITmng7504NotWarnUnsupportedReportPluginsTest.class ); - suite.addTestSuite( MavenITmng7160ExtensionClassloader.class ); - suite.addTestSuite( MavenITmng7468UnsupportedPluginsParametersTest.class ); - suite.addTestSuite( MavenITmng7487DeadlockTest.class ); - suite.addTestSuite( MavenITmng7470ResolverTransportTest.class ); - suite.addTestSuite( MavenITmng7464ReadOnlyMojoParametersWarningTest.class ); - suite.addTestSuite( MavenITmng7404IgnorePrefixlessExpressionsTest.class ); - suite.addTestSuite( MavenITmng5222MojoDeprecatedTest.class ); - suite.addTestSuite( MavenITmng7390SelectModuleOutsideCwdTest.class ); - suite.addTestSuite( MavenITmng7244IgnorePomPrefixInExpressions.class ); - suite.addTestSuite( MavenITmng7349RelocationWarningTest.class ); - suite.addTestSuite( MavenITmng6326CoreExtensionsNotFoundTest.class ); - suite.addTestSuite( MavenITmng5561PluginRelocationLosesConfigurationTest.class ); - suite.addTestSuite( MavenITmng7335MissingJarInParallelBuild.class ); - suite.addTestSuite( MavenITmng4463DependencyManagementImportVersionRanges.class ); - suite.addTestSuite( MavenITmng7112ProjectsWithNonRecursiveTest.class ); - suite.addTestSuite( MavenITmng7128BlockExternalHttpReactorTest.class ); - suite.addTestSuite( MavenITmng6511OptionalProjectSelectionTest.class ); - suite.addTestSuite( MavenITmng7110ExtensionClassloader.class ); - suite.addTestSuite( MavenITmng7051OptionalProfileActivationTest.class ); - suite.addTestSuite( MavenITmng6957BuildConsumer.class ); - suite.addTestSuite( MavenITmng7045DropUselessAndOutdatedCdiApiTest.class ); - suite.addTestSuite( MavenITmng6566ExecuteAnnotationShouldNotReExecuteGoalsTest.class ); - suite.addTestSuite( MavenITmng6754TimestampInMultimoduleProject.class ); - suite.addTestSuite( MavenITmng6981ProjectListShouldIncludeChildrenTest.class ); - suite.addTestSuite( MavenITmng6972AllowAccessToGraphPackageTest.class ); - suite.addTestSuite( MavenITmng6772NestedImportScopeRepositoryOverride.class ); - suite.addTestSuite( MavenITmng6759TransitiveDependencyRepositoriesTest.class ); - suite.addTestSuite( MavenITmng6720FailFastTest.class ); - suite.addTestSuite( MavenITmng6656BuildConsumer.class ); - suite.addTestSuite( MavenITmng6562WarnDefaultBindings.class ); - suite.addTestSuite( MavenITmng6558ToolchainsBuildingEventTest.class ); - suite.addTestSuite( MavenITmng6506PackageAnnotationTest.class ); - suite.addTestSuite( MavenITmng6391PrintVersionTest.class ); - suite.addTestSuite( MavenITmng6386BaseUriPropertyTest.class ); - suite.addTestSuite( MavenITmng6330RelativePath.class ); - suite.addTestSuite( MavenITmng6256SpecialCharsAlternatePOMLocation.class ); - suite.addTestSuite( MavenITmng6255FixConcatLines.class ); - suite.addTestSuite( MavenITmng6240PluginExtensionAetherProvider.class ); - suite.addTestSuite( MavenITmng6223FindBasedir.class ); - suite.addTestSuite( MavenITmng6210CoreExtensionsCustomScopesTest.class ); - suite.addTestSuite( MavenITmng6189SiteReportPluginsWarningTest.class ); - suite.addTestSuite( MavenITmng6173GetProjectsAndDependencyGraphTest.class ); - suite.addTestSuite( MavenITmng6173GetAllProjectsInReactorTest.class ); - suite.addTestSuite( MavenITmng6127PluginExecutionConfigurationInterferenceTest.class ); - suite.addTestSuite( MavenITmng6118SubmoduleInvocation.class ); - suite.addTestSuite( MavenITmng6090CIFriendlyTest.class ); - suite.addTestSuite( MavenITmng6084Jsr250PluginTest.class ); - suite.addTestSuite( MavenITmng6071GetResourceWithCustomPom.class ); - suite.addTestSuite( MavenITmng6065FailOnSeverityTest.class ); - suite.addTestSuite( MavenITmng6057CheckReactorOrderTest.class ); - suite.addTestSuite( MavenITmng5965ParallelBuildMultipliesWorkTest.class ); - suite.addTestSuite( MavenITmng5958LifecyclePhaseBinaryCompat.class ); - suite.addTestSuite( MavenITmng5935OptionalLostInTranstiveManagedDependenciesTest.class ); - suite.addTestSuite( MavenITmng5898BuildMultimoduleWithEARFailsToResolveWARTest.class ); - suite.addTestSuite( MavenITmng5895CIFriendlyUsageWithPropertyTest.class ); - suite.addTestSuite( MavenITmng5868NoDuplicateAttachedArtifacts.class ); - suite.addTestSuite( MavenITmng5840RelativePathReactorMatching.class ); - suite.addTestSuite( MavenITmng5840ParentVersionRanges.class ); - suite.addTestSuite( MavenITmng5805PkgTypeMojoConfiguration2.class ); - suite.addTestSuite( MavenITmng5783PluginDependencyFiltering.class ); - suite.addTestSuite( MavenITmng5774ConfigurationProcessorsTest.class ); - suite.addTestSuite( MavenITmng5771CoreExtensionsTest.class ); - suite.addTestSuite( MavenITmng5768CliExecutionIdTest.class ); - suite.addTestSuite( MavenITmng5760ResumeFeatureTest.class ); - suite.addTestSuite( MavenITmng5753CustomMojoExecutionConfiguratorTest.class ); - suite.addTestSuite( MavenITmng5742BuildExtensionClassloaderTest.class ); - suite.addTestSuite( MavenITmng5716ToolchainsTypeTest.class ); - suite.addTestSuite( MavenITmng5669ReadPomsOnce.class ); - suite.addTestSuite( MavenITmng5663NestedImportScopePomResolutionTest.class ); - suite.addTestSuite( MavenITmng5640LifecycleParticipantAfterSessionEnd.class ); - suite.addTestSuite( MavenITmng5639ImportScopePomResolutionTest.class ); - suite.addTestSuite( MavenITmng5608ProfileActivationWarningTest.class ); - suite.addTestSuite( MavenITmng5591WorkspaceReader.class ); - suite.addTestSuite( MavenITmng5581LifecycleMappingDelegate.class ); - suite.addTestSuite( MavenITmng5578SessionScopeTest.class ); - suite.addTestSuite( MavenITmng5576CdFriendlyVersions.class ); - suite.addTestSuite( MavenITmng5572ReactorPluginExtensionsTest.class ); - suite.addTestSuite( MavenITmng5530MojoExecutionScopeTest.class ); - suite.addTestSuite( MavenITmng5482AetherNotFoundTest.class ); - suite.addTestSuite( MavenITmng5445LegacyStringSearchModelInterpolatorTest.class ); - suite.addTestSuite( MavenITmng5389LifecycleParticipantAfterSessionEnd.class ); - suite.addTestSuite( MavenITmng5387ArtifactReplacementPlugin.class ); - suite.addTestSuite( MavenITmng5382Jsr330Plugin.class ); - suite.addTestSuite( MavenITmng5338FileOptionToDirectory.class ); - suite.addTestSuite( MavenITmng5280SettingsProfilesRepositoriesOrderTest.class ); - suite.addTestSuite( MavenITmng5230MakeReactorWithExcludesTest.class ); - suite.addTestSuite( MavenITmng5224InjectedSettings.class ); - suite.addTestSuite( MavenITmng5214DontMapWsdlToJar.class ); - suite.addTestSuite( MavenITmng5208EventSpyParallelTest.class ); - suite.addTestSuite( MavenITmng5175WagonHttpTest.class ); - suite.addTestSuite( MavenITmng5137ReactorResolutionInForkedBuildTest.class ); - suite.addTestSuite( MavenITmng5135AggregatorDepResolutionModuleExtensionTest.class ); - suite.addTestSuite( MavenITmng5096ExclusionAtDependencyWithImpliedClassifierTest.class ); - suite.addTestSuite( MavenITmng5064SuppressSnapshotUpdatesTest.class ); - suite.addTestSuite( MavenITmng5019StringBasedCompLookupFromChildPluginRealmTest.class ); - suite.addTestSuite( MavenITmng5013ConfigureParamBeanFromScalarValueTest.class ); - suite.addTestSuite( MavenITmng5012CollectionVsArrayParamCoercionTest.class ); - suite.addTestSuite( MavenITmng5011ConfigureCollectionArrayFromUserPropertiesTest.class ); - suite.addTestSuite( MavenITmng5009AggregationCycleTest.class ); - suite.addTestSuite( MavenITmng5006VersionRangeDependencyParentResolutionTest.class ); - suite.addTestSuite( MavenITmng5000ChildPathAwareUrlInheritanceTest.class ); - suite.addTestSuite( MavenITmng4992MapStylePropertiesParamConfigTest.class ); - suite.addTestSuite( MavenITmng4991NonProxyHostsTest.class ); - suite.addTestSuite( MavenITmng4987TimestampBasedSnapshotSelectionTest.class ); - suite.addTestSuite( MavenITmng4975ProfileInjectedPluginExecutionOrderTest.class ); - suite.addTestSuite( MavenITmng4973ExtensionVisibleToPluginInReactorTest.class ); - suite.addTestSuite( MavenITmng4966AbnormalUrlPreservationTest.class ); - suite.addTestSuite( MavenITmng4963ParentResolutionFromMirrorTest.class ); - suite.addTestSuite( MavenITmng4960MakeLikeReactorResumeTest.class ); - suite.addTestSuite( MavenITmng4955LocalVsRemoteSnapshotResolutionTest.class ); - suite.addTestSuite( MavenITmng4952MetadataReleaseInfoUpdateTest.class ); - suite.addTestSuite( MavenITmng4936EventSpyTest.class ); - suite.addTestSuite( MavenITmng4925ContainerLookupRealmDuringMojoExecTest.class ); - suite.addTestSuite( MavenITmng4919LifecycleMappingWithSameGoalTwiceTest.class ); - suite.addTestSuite( MavenITmng4913UserPropertyVsDependencyPomPropertyTest.class ); - suite.addTestSuite( MavenITmng4895PluginDepWithNonRelocatedMavenApiTest.class ); - suite.addTestSuite( MavenITmng4891RobustSnapshotResolutionTest.class ); - suite.addTestSuite( MavenITmng4890MakeLikeReactorConsidersVersionsTest.class ); - suite.addTestSuite( MavenITmng4883FailUponOverconstrainedVersionRangesTest.class ); - suite.addTestSuite( MavenITmng4877DeployUsingPrivateKeyTest.class ); - suite.addTestSuite( MavenITmng4874UpdateLatestPluginVersionTest.class ); - suite.addTestSuite( MavenITmng4872ReactorResolutionAttachedWithExclusionsTest.class ); - suite.addTestSuite( MavenITmng4842ParentResolutionOfDependencyPomTest.class ); - suite.addTestSuite( MavenITmng4840MavenPrerequisiteTest.class ); - suite.addTestSuite( MavenITmng4834ParentProjectResolvedFromRemoteReposTest.class ); - suite.addTestSuite( MavenITmng4829ChecksumFailureWarningTest.class ); - suite.addTestSuite( MavenITmng4814ReResolutionOfDependenciesDuringReactorTest.class ); - suite.addTestSuite( MavenITmng4811CustomComponentConfiguratorTest.class ); - suite.addTestSuite( MavenITmng4800NearestWinsVsScopeWideningTest.class ); - suite.addTestSuite( MavenITmng4795DepResolutionInReactorProjectForkedByLifecycleTest.class ); - suite.addTestSuite( MavenITmng4791ProjectBuilderResolvesRemotePomArtifactTest.class ); - suite.addTestSuite( MavenITmng4789ScopeInheritanceMeetsConflictTest.class ); - suite.addTestSuite( MavenITmng4788InstallationToCustomLocalRepoTest.class ); - suite.addTestSuite( MavenITmng4786AntBased21xMojoSupportTest.class ); - suite.addTestSuite( MavenITmng4785TransitiveResolutionInForkedThreadTest.class ); - suite.addTestSuite( MavenITmng4781DeploymentToNexusStagingRepoTest.class ); - suite.addTestSuite( MavenITmng4779MultipleDepsWithVersionRangeFromLocalRepoTest.class ); - suite.addTestSuite( MavenITmng4776ForkedReactorPluginVersionResolutionTest.class ); - suite.addTestSuite( MavenITmng4772PluginVersionResolutionDoesntTouchDisabledRepoTest.class ); - suite.addTestSuite( MavenITmng4771PluginPrefixResolutionDoesntTouchDisabledRepoTest.class ); - suite.addTestSuite( MavenITmng4768NearestMatchConflictResolutionTest.class ); - suite.addTestSuite( MavenITmng4765LocalPomProjectBuilderTest.class ); - suite.addTestSuite( MavenITmng4755FetchRemoteMetadataForVersionRangeTest.class ); - suite.addTestSuite( MavenITmng4750ResolvedMavenProjectDependencyArtifactsTest.class ); - suite.addTestSuite( MavenITmng4747JavaAgentUsedByPluginTest.class ); - suite.addTestSuite( MavenITmng4745PluginVersionUpdateTest.class ); - suite.addTestSuite( MavenITmng4729MirrorProxyAuthUsedByProjectBuilderTest.class ); - suite.addTestSuite( MavenITmng4721OptionalPluginDependencyTest.class ); - suite.addTestSuite( MavenITmng4720DependencyManagementExclusionMergeTest.class ); - suite.addTestSuite( MavenITmng4696MavenProjectDependencyArtifactsTest.class ); - suite.addTestSuite( MavenITmng4690InterdependentConflictResolutionTest.class ); - suite.addTestSuite( MavenITmng4684DistMgmtOverriddenByProfileTest.class ); - suite.addTestSuite( MavenITmng4679SnapshotUpdateInPluginTest.class ); - suite.addTestSuite( MavenITmng4677DisabledPluginConfigInheritanceTest.class ); - suite.addTestSuite( MavenITmng4666CoreRealmImportTest.class ); - suite.addTestSuite( MavenITmng4660ResumeFromTest.class ); - suite.addTestSuite( MavenITmng4660OutdatedPackagedArtifact.class ); - suite.addTestSuite( MavenITmng4654ArtifactHandlerForMainArtifactTest.class ); - suite.addTestSuite( MavenITmng4644StrictPomParsingRejectsMisplacedTextTest.class ); - suite.addTestSuite( MavenITmng4633DualCompilerExecutionsWeaveModeTest.class ); - suite.addTestSuite( MavenITmng4629NoPomValidationErrorUponMissingSystemDepTest.class ); - suite.addTestSuite( MavenITmng4625SettingsXmlInterpolationWithXmlMarkupTest.class ); - suite.addTestSuite( MavenITmng4618AggregatorBuiltAfterModulesTest.class ); - suite.addTestSuite( MavenITmng4615ValidateRequiredPluginParameterTest.class ); - suite.addTestSuite( MavenITmng4600DependencyOptionalFlagManagementTest.class ); - suite.addTestSuite( MavenITmng4590ImportedPomUsesSystemAndUserPropertiesTest.class ); - suite.addTestSuite( MavenITmng4586PluginPrefixResolutionFromVersionlessPluginMgmtTest.class ); - suite.addTestSuite( MavenITmng4580ProjectLevelPluginDepUsedForCliInvocInReactorTest.class ); - suite.addTestSuite( MavenITmng4572ModelVersionSurroundedByWhitespaceTest.class ); - suite.addTestSuite( MavenITmng4561MirroringOfPluginRepoTest.class ); - suite.addTestSuite( MavenITmng4555MetaversionResolutionOfflineTest.class ); - suite.addTestSuite( MavenITmng4554PluginPrefixMappingUpdateTest.class ); - suite.addTestSuite( MavenITmng4553CoreArtifactFilterConsidersGroupIdTest.class ); - suite.addTestSuite( MavenITmng4544ActiveComponentCollectionThreadSafeTest.class ); - suite.addTestSuite( MavenITmng4536RequiresNoProjectForkingMojoTest.class ); - suite.addTestSuite( MavenITmng4528ExcludeWagonsFromMavenCoreArtifactsTest.class ); - suite.addTestSuite( MavenITmng4526MavenProjectArtifactsScopeTest.class ); - suite.addTestSuite( MavenITmng4522FailUponMissingDependencyParentPomTest.class ); - suite.addTestSuite( MavenITmng4500NoUpdateOfTimestampedSnapshotsTest.class ); - suite.addTestSuite( MavenITmng4498IgnoreBrokenMetadataTest.class ); - suite.addTestSuite( MavenITmng4489MirroringOfExtensionRepoTest.class ); - suite.addTestSuite( MavenITmng4488ValidateExternalParenPomLenientTest.class ); - suite.addTestSuite( MavenITmng4482ForcePluginSnapshotUpdateTest.class ); - suite.addTestSuite( MavenITmng4474PerLookupWagonInstantiationTest.class ); - suite.addTestSuite( MavenITmng4470AuthenticatedDeploymentToProxyTest.class ); - suite.addTestSuite( MavenITmng4469AuthenticatedDeploymentToCustomRepoTest.class ); - suite.addTestSuite( MavenITmng4465PluginPrefixFromLocalCacheOfDownRepoTest.class ); - suite.addTestSuite( MavenITmng4464PlatformIndependentFileSeparatorTest.class ); - suite.addTestSuite( MavenITmng4461ArtifactUploadMonitorTest.class ); - suite.addTestSuite( MavenITmng4459InMemorySettingsKeptEncryptedTest.class ); - suite.addTestSuite( MavenITmng4453PluginVersionFromLifecycleMappingTest.class ); - suite.addTestSuite( MavenITmng4452ResolutionOfSnapshotWithClassifierTest.class ); - suite.addTestSuite( MavenITmng4450StubModelForMissingDependencyPomTest.class ); - suite.addTestSuite( MavenITmng4436SingletonComponentLookupTest.class ); - suite.addTestSuite( MavenITmng4433ForceParentSnapshotUpdateTest.class ); - suite.addTestSuite( MavenITmng4430DistributionManagementStatusTest.class ); - suite.addTestSuite( MavenITmng4429CompRequirementOnNonDefaultImplTest.class ); - suite.addTestSuite( MavenITmng4428FollowHttpRedirectTest.class ); - suite.addTestSuite( MavenITmng4423SessionDataFromPluginParameterExpressionTest.class ); - suite.addTestSuite( MavenITmng4422PluginExecutionPhaseInterpolationTest.class ); - suite.addTestSuite( MavenITmng4421DeprecatedPomInterpolationExpressionsTest.class ); - suite.addTestSuite( MavenITmng4416PluginOrderAfterProfileInjectionTest.class ); - suite.addTestSuite( MavenITmng4415InheritedPluginOrderTest.class ); - suite.addTestSuite( MavenITmng4413MirroringOfDependencyRepoTest.class ); - suite.addTestSuite( MavenITmng4412OfflineModeInPluginTest.class ); - suite.addTestSuite( MavenITmng4411VersionInfoTest.class ); - suite.addTestSuite( MavenITmng4410UsageHelpTest.class ); - suite.addTestSuite( MavenITmng4408NonExistentSettingsFileTest.class ); - suite.addTestSuite( MavenITmng4405ValidPluginVersionTest.class ); - suite.addTestSuite( MavenITmng4404UniqueProfileIdTest.class ); - suite.addTestSuite( MavenITmng4403LenientDependencyPomParsingTest.class ); - suite.addTestSuite( MavenITmng4402DuplicateChildModuleTest.class ); - suite.addTestSuite( MavenITmng4401RepositoryOrderForParentPomTest.class ); - suite.addTestSuite( MavenITmng4400RepositoryOrderTest.class ); - suite.addTestSuite( MavenITmng4396AntBased20xMojoSupportTest.class ); - suite.addTestSuite( MavenITmng4393ParseExternalParenPomLenientTest.class ); - suite.addTestSuite( MavenITmng4387QuietLoggingTest.class ); - suite.addTestSuite( MavenITmng4386DebugLoggingTest.class ); - suite.addTestSuite( MavenITmng4385LifecycleMappingFromExtensionInReactorTest.class ); - suite.addTestSuite( MavenITmng4383ValidDependencyVersionTest.class ); - suite.addTestSuite( MavenITmng4381ExtensionSingletonComponentTest.class ); - suite.addTestSuite( MavenITmng4379TransitiveSystemPathInterpolatedWithEnvVarTest.class ); - suite.addTestSuite( MavenITmng4368TimestampAwareArtifactInstallerTest.class ); - suite.addTestSuite( MavenITmng4367LayoutAwareMirrorSelectionTest.class ); - suite.addTestSuite( MavenITmng4365XmlMarkupInAttributeValueTest.class ); - suite.addTestSuite( MavenITmng4363DynamicAdditionOfDependencyArtifactTest.class ); - suite.addTestSuite( MavenITmng4361ForceDependencySnapshotUpdateTest.class ); - suite.addTestSuite( MavenITmng4360WebDavSupportTest.class ); - suite.addTestSuite( MavenITmng4359LocallyReachableParentOutsideOfReactorTest.class ); - suite.addTestSuite( MavenITmng4357LifecycleMappingDiscoveryInReactorTest.class ); - suite.addTestSuite( MavenITmng4355ExtensionAutomaticVersionResolutionTest.class ); - suite.addTestSuite( MavenITmng4353PluginDependencyResolutionFromPomRepoTest.class ); - suite.addTestSuite( MavenITmng4350LifecycleMappingExecutionOrderTest.class ); - suite.addTestSuite( MavenITmng4349RelocatedArtifactWithInvalidPomTest.class ); - suite.addTestSuite( MavenITmng4348NoUnnecessaryRepositoryAccessTest.class ); - suite.addTestSuite( MavenITmng4347ImportScopeWithSettingsProfilesTest.class ); - suite.addTestSuite( MavenITmng4345DefaultPluginExecutionOrderTest.class ); - suite.addTestSuite( MavenITmng4344ManagedPluginExecutionOrderTest.class ); - suite.addTestSuite( MavenITmng4343MissingReleaseUpdatePolicyTest.class ); - suite.addTestSuite( MavenITmng4342IndependentMojoParameterDefaultValuesTest.class ); - suite.addTestSuite( MavenITmng4341PluginExecutionOrderTest.class ); - suite.addTestSuite( MavenITmng4338OptionalMojosTest.class ); - suite.addTestSuite( MavenITmng4335SettingsOfflineModeTest.class ); - suite.addTestSuite( MavenITmng4332DefaultPluginExecutionOrderTest.class ); - suite.addTestSuite( MavenITmng4331DependencyCollectionTest.class ); - suite.addTestSuite( MavenITmng4328PrimitiveMojoParameterConfigurationTest.class ); - suite.addTestSuite( MavenITmng4327ExcludeForkingMojoFromForkedLifecycleTest.class ); - suite.addTestSuite( MavenITmng4326LocalSnapshotSuppressesRemoteCheckTest.class ); - suite.addTestSuite( MavenITmng4321CliUsesPluginMgmtConfigTest.class ); - suite.addTestSuite( MavenITmng4320AggregatorAndDependenciesTest.class ); - suite.addTestSuite( MavenITmng4319PluginExecutionGoalInterpolationTest.class ); - suite.addTestSuite( MavenITmng4318ProjectExecutionRootTest.class ); - suite.addTestSuite( MavenITmng4317PluginVersionResolutionFromMultiReposTest.class ); - suite.addTestSuite( MavenITmng4314DirectInvocationOfAggregatorTest.class ); - suite.addTestSuite( MavenITmng4312TypeAwarePluginParameterExpressionInjectionTest.class ); - suite.addTestSuite( MavenITmng4309StrictChecksumValidationForMetadataTest.class ); - suite.addTestSuite( MavenITmng4305LocalRepoBasedirTest.class ); - suite.addTestSuite( MavenITmng4304ProjectDependencyArtifactsTest.class ); - suite.addTestSuite( MavenITmng4293RequiresCompilePlusRuntimeScopeTest.class ); - suite.addTestSuite( MavenITmng4292EnumTypeMojoParametersTest.class ); - suite.addTestSuite( MavenITmng4291MojoRequiresOnlineModeTest.class ); - suite.addTestSuite( MavenITmng4283ParentPomPackagingTest.class ); - suite.addTestSuite( MavenITmng4281PreferLocalSnapshotTest.class ); - suite.addTestSuite( MavenITmng4276WrongTransitivePlexusUtilsTest.class ); - suite.addTestSuite( MavenITmng4275RelocationWarningTest.class ); - suite.addTestSuite( MavenITmng4274PluginRealmArtifactsTest.class ); - suite.addTestSuite( MavenITmng4273RestrictedCoreRealmAccessForPluginTest.class ); - suite.addTestSuite( MavenITmng4270ArtifactHandlersFromPluginDepsTest.class ); - suite.addTestSuite( MavenITmng4269BadReactorResolutionFromOutDirTest.class ); - suite.addTestSuite( MavenITmng4262MakeLikeReactorDottedPathTest.class ); - suite.addTestSuite( MavenITmng4262MakeLikeReactorDottedPath370Test.class ); - suite.addTestSuite( MavenITmng4238ArtifactHandlerExtensionUsageTest.class ); - suite.addTestSuite( MavenITmng4235HttpAuthDeploymentChecksumsTest.class ); - suite.addTestSuite( MavenITmng4233ReactorResolutionForManuallyCreatedArtifactTest.class ); - suite.addTestSuite( MavenITmng4231SnapshotUpdatePolicyTest.class ); - suite.addTestSuite( MavenITmng4214MirroredParentSearchReposTest.class ); - suite.addTestSuite( MavenITmng4208InterpolationPrefersCliOverProjectPropsTest.class ); - suite.addTestSuite( MavenITmng4207PluginWithLog4JTest.class ); - suite.addTestSuite( MavenITmng4203TransitiveDependencyExclusionTest.class ); - suite.addTestSuite( MavenITmng4199CompileMeetsRuntimeScopeTest.class ); - suite.addTestSuite( MavenITmng4196ExclusionOnPluginDepTest.class ); - suite.addTestSuite( MavenITmng4193UniqueRepoIdTest.class ); - suite.addTestSuite( MavenITmng4190MirrorRepoMergingTest.class ); - suite.addTestSuite( MavenITmng4189UniqueVersionSnapshotTest.class ); - suite.addTestSuite( MavenITmng4180PerDependencyExclusionsTest.class ); - suite.addTestSuite( MavenITmng4172EmptyDependencySetTest.class ); - suite.addTestSuite( MavenITmng4166HideCoreCommonsCliTest.class ); - suite.addTestSuite( MavenITmng4162ReportingMigrationTest.class ); - suite.addTestSuite( MavenITmng4150VersionRangeTest.class ); - suite.addTestSuite( MavenITmng4129PluginExecutionInheritanceTest.class ); - suite.addTestSuite( MavenITmng4116UndecodedUrlsTest.class ); - suite.addTestSuite( MavenITmng4112MavenVersionPropertyTest.class ); - suite.addTestSuite( MavenITmng4107InterpolationUsesDominantProfileSourceTest.class ); - suite.addTestSuite( MavenITmng4106InterpolationUsesDominantProfileTest.class ); - suite.addTestSuite( MavenITmng4102InheritedPropertyInterpolationTest.class ); - suite.addTestSuite( MavenITmng4091BadPluginDescriptorTest.class ); - suite.addTestSuite( MavenITmng4087PercentEncodedFileUrlTest.class ); - suite.addTestSuite( MavenITmng4072InactiveProfileReposTest.class ); - suite.addTestSuite( MavenITmng4070WhitespaceTrimmingTest.class ); - suite.addTestSuite( MavenITmng4068AuthenticatedMirrorTest.class ); - suite.addTestSuite( MavenITmng4056ClassifierBasedDepResolutionFromReactorTest.class ); - suite.addTestSuite( MavenITmng4053PluginConfigAttributesTest.class ); - suite.addTestSuite( MavenITmng4052ReactorAwareImportScopeTest.class ); - suite.addTestSuite( MavenITmng4048VersionRangeReactorResolutionTest.class ); - suite.addTestSuite( MavenITmng4040ProfileInjectedModulesTest.class ); - suite.addTestSuite( MavenITmng4036ParentResolutionFromSettingsRepoTest.class ); - suite.addTestSuite( MavenITmng4034ManagedProfileDependencyTest.class ); - suite.addTestSuite( MavenITmng4026ReactorDependenciesOrderTest.class ); - suite.addTestSuite( MavenITmng4023ParentProfileOneTimeInjectionTest.class ); - suite.addTestSuite( MavenITmng4022IdempotentPluginConfigMergingTest.class ); - suite.addTestSuite( MavenITmng4016PrefixedPropertyInterpolationTest.class ); - suite.addTestSuite( MavenITmng4009InheritProfileEffectsTest.class ); - suite.addTestSuite( MavenITmng4008MergedFilterOrderTest.class ); - suite.addTestSuite( MavenITmng4007PlatformFileSeparatorTest.class ); - suite.addTestSuite( MavenITmng4005UniqueDependencyKeyTest.class ); - suite.addTestSuite( MavenITmng4000MultiPluginExecutionsTest.class ); - suite.addTestSuite( MavenITmng3998PluginExecutionConfigTest.class ); - suite.addTestSuite( MavenITmng3991ValidDependencyScopeTest.class ); - suite.addTestSuite( MavenITmng3983PluginResolutionFromProfileReposTest.class ); - suite.addTestSuite( MavenITmng3979ElementJoinTest.class ); - suite.addTestSuite( MavenITmng3974MirrorOrderingTest.class ); - suite.addTestSuite( MavenITmng3970DepResolutionFromProfileReposTest.class ); - suite.addTestSuite( MavenITmng3955EffectiveSettingsTest.class ); - suite.addTestSuite( MavenITmng3953AuthenticatedDeploymentTest.class ); - suite.addTestSuite( MavenITmng3951AbsolutePathsTest.class ); - suite.addTestSuite( MavenITmng3948ParentResolutionFromProfileReposTest.class ); - suite.addTestSuite( MavenITmng3947PluginDefaultExecutionConfigTest.class ); - suite.addTestSuite( MavenITmng3944BasedirInterpolationTest.class ); - suite.addTestSuite( MavenITmng3943PluginExecutionInheritanceTest.class ); - suite.addTestSuite( MavenITmng3941ExecutionProjectRestrictedToForkingMojoTest.class ); - suite.addTestSuite( MavenITmng3940EnvVarInterpolationTest.class ); - suite.addTestSuite( MavenITmng3938MergePluginExecutionsTest.class ); - suite.addTestSuite( MavenITmng3937MergedPluginExecutionGoalsTest.class ); - suite.addTestSuite( MavenITmng3927PluginDefaultExecutionConfigTest.class ); - suite.addTestSuite( MavenITmng3925MergedPluginExecutionOrderTest.class ); - suite.addTestSuite( MavenITmng3924XmlMarkupInterpolationTest.class ); - suite.addTestSuite( MavenITmng3916PluginExecutionInheritanceTest.class ); - suite.addTestSuite( MavenITmng3906MergedPluginClassPathOrderingTest.class ); - suite.addTestSuite( MavenITmng3904NestedBuildDirInterpolationTest.class ); - suite.addTestSuite( MavenITmng3900ProfilePropertiesInterpolationTest.class ); - suite.addTestSuite( MavenITmng3899ExtensionInheritanceTest.class ); - suite.addTestSuite( MavenITmng3892ReleaseDeploymentTest.class ); - suite.addTestSuite( MavenITmng3887PluginExecutionOrderTest.class ); - suite.addTestSuite( MavenITmng3886ExecutionGoalsOrderTest.class ); - suite.addTestSuite( MavenITmng3877BasedirAlignedModelTest.class ); - suite.addTestSuite( MavenITmng3873MultipleExecutionGoalsTest.class ); - suite.addTestSuite( MavenITmng3872ProfileActivationInRelocatedPomTest.class ); - suite.addTestSuite( MavenITmng3866PluginConfigInheritanceTest.class ); - suite.addTestSuite( MavenITmng3864PerExecPluginConfigTest.class ); - suite.addTestSuite( MavenITmng3863AutoPluginGroupIdTest.class ); - suite.addTestSuite( MavenITmng3853ProfileInjectedDistReposTest.class ); - suite.addTestSuite( MavenITmng3852PluginConfigWithHeterogeneousListTest.class ); - suite.addTestSuite( MavenITmng3846PomInheritanceUrlAdjustmentTest.class ); - suite.addTestSuite( MavenITmng3845LimitedPomInheritanceTest.class ); - suite.addTestSuite( MavenITmng3843PomInheritanceTest.class ); - suite.addTestSuite( MavenITmng3839PomParsingCoalesceTextTest.class ); - suite.addTestSuite( MavenITmng3838EqualPluginDepsTest.class ); - suite.addTestSuite( MavenITmng3836PluginConfigInheritanceTest.class ); - suite.addTestSuite( MavenITmng3833PomInterpolationDataFlowChainTest.class ); - suite.addTestSuite( MavenITmng3831PomInterpolationTest.class ); - suite.addTestSuite( MavenITmng3827PluginConfigTest.class ); - suite.addTestSuite( MavenITmng3822BasedirAlignedInterpolationTest.class ); - suite.addTestSuite( MavenITmng3821EqualPluginExecIdsTest.class ); - suite.addTestSuite( MavenITmng3814BogusProjectCycleTest.class ); - suite.addTestSuite( MavenITmng3813PluginClassPathOrderingTest.class ); - suite.addTestSuite( MavenITmng3811ReportingPluginConfigurationInheritanceTest.class ); - suite.addTestSuite( MavenITmng3810BadProfileActivationTest.class ); - suite.addTestSuite( MavenITmng3808ReportInheritanceOrderingTest.class ); - suite.addTestSuite( MavenITmng3807PluginConfigExpressionEvaluationTest.class ); - suite.addTestSuite( MavenITmng3805ExtensionClassPathOrderingTest.class ); - suite.addTestSuite( MavenITmng3796ClassImportInconsistencyTest.class ); - suite.addTestSuite( MavenITmng3775ConflictResolutionBacktrackingTest.class ); - suite.addTestSuite( MavenITmng3769ExclusionRelocatedTransdepsTest.class ); - suite.addTestSuite( MavenITmng3766ToolchainsFromExtensionTest.class ); - suite.addTestSuite( MavenITmng3748BadSettingsXmlTest.class ); - suite.addTestSuite( MavenITmng3747PrefixedPathExpressionTest.class ); - suite.addTestSuite( MavenITmng3746POMPropertyOverrideTest.class ); - suite.addTestSuite( MavenITmng3740SelfReferentialReactorProjectsTest.class ); - suite.addTestSuite( MavenITmng3732ActiveProfilesTest.class ); - suite.addTestSuite( MavenITmng3729MultiForkAggregatorsTest.class ); - suite.addTestSuite( MavenITmng3724ExecutionProjectSyncTest.class ); - suite.addTestSuite( MavenITmng3723ConcreteParentProjectTest.class ); - suite.addTestSuite( MavenITmng3719PomExecutionOrderingTest.class ); - suite.addTestSuite( MavenITmng3716AggregatorForkingTest.class ); - suite.addTestSuite( MavenITmng3714ToolchainsCliOptionTest.class ); - suite.addTestSuite( MavenITmng3710PollutedClonedPluginsTest.class ); - suite.addTestSuite( MavenITmng3703ExecutionProjectWithRelativePathsTest.class ); - suite.addTestSuite( MavenITmng3701ImplicitProfileIdTest.class ); - suite.addTestSuite( MavenITmng3694ReactorProjectsDynamismTest.class ); - suite.addTestSuite( MavenITmng3693PomFileBasedirChangeTest.class ); - suite.addTestSuite( MavenITmng3684BuildPluginParameterTest.class ); - suite.addTestSuite( MavenITmng3680InvalidDependencyPOMTest.class ); - suite.addTestSuite( MavenITmng3679PluginExecIdInterpolationTest.class ); - suite.addTestSuite( MavenITmng3671PluginLevelDepInterpolationTest.class ); - suite.addTestSuite( MavenITmng3667ResolveDepsWithBadPomVersionTest.class ); - suite.addTestSuite( MavenITmng3652UserAgentHeaderTest.class ); - suite.addTestSuite( MavenITmng3645POMSyntaxErrorTest.class ); - suite.addTestSuite( MavenITmng3642DynamicResourcesTest.class ); - suite.addTestSuite( MavenITmng3641ProfileActivationWarningTest.class ); - suite.addTestSuite( MavenITmng3621UNCInheritedPathsTest.class ); - suite.addTestSuite( MavenITmng3607ClassLoadersUseValidUrlsTest.class ); - suite.addTestSuite( MavenITmng3600DeploymentModeDefaultsTest.class ); - suite.addTestSuite( MavenITmng3599useHttpProxyForWebDAVMk2Test.class ); - suite.addTestSuite( MavenITmng3586SystemScopePluginDependencyTest.class ); - suite.addTestSuite( MavenITmng3581PluginUsesWagonDependencyTest.class ); - suite.addTestSuite( MavenITmng3575HexadecimalOctalPluginParameterConfigTest.class ); - suite.addTestSuite( MavenITmng3545ProfileDeactivationTest.class ); - suite.addTestSuite( MavenITmng3536AppendedAbsolutePathsTest.class ); - suite.addTestSuite( MavenITmng3535SelfReferentialPropertiesTest.class ); - suite.addTestSuite( MavenITmng3529QuotedCliArgTest.class ); - suite.addTestSuite( MavenITmng3506ArtifactHandlersFromPluginsTest.class ); - suite.addTestSuite( MavenITmng3503Xpp3ShadingTest.class ); - suite.addTestSuite( MavenITmng3498ForkToOtherMojoTest.class ); - suite.addTestSuite( MavenITmng3485OverrideWagonExtensionTest.class ); - suite.addTestSuite( MavenITmng3482DependencyPomInterpolationTest.class ); - suite.addTestSuite( MavenITmng3477DependencyResolutionErrorMessageTest.class ); - suite.addTestSuite( MavenITmng3475BaseAlignedDirTest.class ); - suite.addTestSuite( MavenITmng3470StrictChecksumVerificationOfDependencyPomTest.class ); - suite.addTestSuite( MavenITmng3461MirrorMatchingTest.class ); - suite.addTestSuite( MavenITmng3441MetadataUpdatedFromDeploymentRepositoryTest.class ); - suite.addTestSuite( MavenITmng3422ActiveComponentCollectionTest.class ); - suite.addTestSuite( MavenITmng3415JunkRepositoryMetadataTest.class ); - suite.addTestSuite( MavenITmng3401CLIDefaultExecIdTest.class ); - suite.addTestSuite( MavenITmng3396DependencyManagementForOverConstrainedRangesTest.class ); - suite.addTestSuite( MavenITmng3394POMPluginVersionDominanceTest.class ); - suite.addTestSuite( MavenITmng3380ManagedRelocatedTransdepsTest.class ); - suite.addTestSuite( MavenITmng3379ParallelArtifactDownloadsTest.class ); - suite.addTestSuite( MavenITmng3372DirectInvocationOfPluginsTest.class ); - suite.addTestSuite( MavenITmng3355TranslatedPathInterpolationTest.class ); - suite.addTestSuite( MavenITmng3331ModulePathNormalizationTest.class ); - suite.addTestSuite( MavenITmng3314OfflineSnapshotsTest.class ); - suite.addTestSuite( MavenITmng3297DependenciesNotLeakedToMojoTest.class ); - suite.addTestSuite( MavenITmng3288SystemScopeDirTest.class ); - suite.addTestSuite( MavenITmng3284UsingCachedPluginsTest.class ); - suite.addTestSuite( MavenITmng3268MultipleHyphenPCommandLineTest.class ); - suite.addTestSuite( MavenITmng3259DepsDroppedInMultiModuleBuildTest.class ); - suite.addTestSuite( MavenITmng3220ImportScopeTest.class ); - suite.addTestSuite( MavenITmng3217InterPluginDependencyTest.class ); - suite.addTestSuite( MavenITmng3208ProfileAwareReactorSortingTest.class ); - suite.addTestSuite( MavenITmng3203DefaultLifecycleExecIdTest.class ); - suite.addTestSuite( MavenITmng3183LoggingToFileTest.class ); - suite.addTestSuite( MavenITmng3139UseCachedMetadataOfBlacklistedRepoTest.class ); - suite.addTestSuite( MavenITmng3133UrlNormalizationNotBeforeInterpolationTest.class ); - suite.addTestSuite( MavenITmng3122ActiveProfilesNoDuplicatesTest.class ); - suite.addTestSuite( MavenITmng3118TestClassPathOrderTest.class ); - suite.addTestSuite( MavenITmng3099SettingsProfilesWithNoPomTest.class ); - suite.addTestSuite( MavenITmng3052DepRepoAggregationTest.class ); - suite.addTestSuite( MavenITmng3043BestEffortReactorResolutionTest.class ); - suite.addTestSuite( MavenITmng3023ReactorDependencyResolutionTest.class ); - suite.addTestSuite( MavenITmng3012CoreClassImportTest.class ); - suite.addTestSuite( MavenITmng3004ReactorFailureBehaviorMultithreadedTest.class ); - suite.addTestSuite( MavenITmng2994SnapshotRangeRepositoryTest.class ); - suite.addTestSuite( MavenITmng2972OverridePluginDependencyTest.class ); - suite.addTestSuite( MavenITmng2926PluginPrefixOrderTest.class ); - suite.addTestSuite( MavenITmng2921ActiveAttachedArtifactsTest.class ); - suite.addTestSuite( MavenITmng2892HideCorePlexusUtilsTest.class ); - suite.addTestSuite( MavenITmng2871PrePackageSubartifactResolutionTest.class ); - suite.addTestSuite( MavenITmng2865MirrorWildcardTest.class ); - suite.addTestSuite( MavenITmng2861RelocationsAndRangesTest.class ); - suite.addTestSuite( MavenITmng2848ProfileActivationByEnvironmentVariableTest.class ); - suite.addTestSuite( MavenITmng2843PluginConfigPropertiesInjectionTest.class ); - suite.addTestSuite( MavenITmng2831CustomArtifactHandlerAndCustomLifecycleTest.class ); - suite.addTestSuite( MavenITmng2820PomCommentsTest.class ); - suite.addTestSuite( MavenITmng2790LastUpdatedMetadataTest.class ); - suite.addTestSuite( MavenITmng2749ExtensionAvailableToPluginTest.class ); - suite.addTestSuite( MavenITmng2744checksumVerificationTest.class ); - suite.addTestSuite( MavenITmng2741PluginMetadataResolutionErrorMessageTest.class ); - suite.addTestSuite( MavenITmng2739RequiredRepositoryElementsTest.class ); - suite.addTestSuite( MavenITmng2738ProfileIdCollidesWithCliOptionTest.class ); - suite.addTestSuite( MavenITmng2720SiblingClasspathArtifactsTest.class ); - suite.addTestSuite( MavenITmng2695OfflinePluginSnapshotsTest.class ); - suite.addTestSuite( MavenITmng2693SitePluginRealmTest.class ); - suite.addTestSuite( MavenITmng2690MojoLoadingErrorsTest.class ); - suite.addTestSuite( MavenITmng2668UsePluginDependenciesForSortingTest.class ); - suite.addTestSuite( MavenITmng2605BogusProfileActivationTest.class ); - suite.addTestSuite( MavenITmng2591MergeInheritedPluginConfigTest.class ); - suite.addTestSuite( MavenITmng2577SettingsXmlInterpolationTest.class ); - suite.addTestSuite( MavenITmng2576MakeLikeReactorTest.class ); - suite.addTestSuite( MavenITmng2562Timestamp322Test.class ); - suite.addTestSuite( MavenITmng2486TimestampedDependencyVersionInterpolationTest.class ); - suite.addTestSuite( MavenITmng2432PluginPrefixOrderTest.class ); - suite.addTestSuite( MavenITmng2387InactiveProxyTest.class ); - suite.addTestSuite( MavenITmng2363BasedirAwareFileActivatorTest.class ); - suite.addTestSuite( MavenITmng2362DeployedPomEncodingTest.class ); - suite.addTestSuite( MavenITmng2339BadProjectInterpolationTest.class ); - suite.addTestSuite( MavenITmng2318LocalParentResolutionTest.class ); - suite.addTestSuite( MavenITmng2309ProfileInjectionOrderTest.class ); - suite.addTestSuite( MavenITmng2305MultipleProxiesTest.class ); - suite.addTestSuite( MavenITmng2277AggregatorAndResolutionPluginsTest.class ); - suite.addTestSuite( MavenITmng2276ProfileActivationBySettingsPropertyTest.class ); - suite.addTestSuite( MavenITmng2254PomEncodingTest.class ); - suite.addTestSuite( MavenITmng2234ActiveProfilesFromSettingsTest.class ); - suite.addTestSuite( MavenITmng2228ComponentInjectionTest.class ); - suite.addTestSuite( MavenITmng2222OutputDirectoryReactorResolutionTest.class ); - suite.addTestSuite( MavenITmng2201PluginConfigInterpolationTest.class ); - suite.addTestSuite( MavenITmng2199ParentVersionRangeTest.class ); - suite.addTestSuite( MavenITmng2196ParentResolutionTest.class ); - suite.addTestSuite( MavenITmng2174PluginDepsManagedByParentProfileTest.class ); - suite.addTestSuite( MavenITmng2140ReactorAwareDepResolutionWhenForkTest.class ); - suite.addTestSuite( MavenITmng2136ActiveByDefaultProfileTest.class ); - suite.addTestSuite( MavenITmng2135PluginBuildInReactorTest.class ); - suite.addTestSuite( MavenITmng2130ParentLookupFromReactorCacheTest.class ); - suite.addTestSuite( MavenITmng2124PomInterpolationWithParentValuesTest.class ); - suite.addTestSuite( MavenITmng2123VersionRangeDependencyTest.class ); - suite.addTestSuite( MavenITmng2103PluginExecutionInheritanceTest.class ); - suite.addTestSuite( MavenITmng2098VersionRangeSatisfiedFromWrongRepoTest.class ); - suite.addTestSuite( MavenITmng2068ReactorRelativeParentsTest.class ); - suite.addTestSuite( MavenITmng2054PluginExecutionInheritanceTest.class ); - suite.addTestSuite( MavenITmng2052InterpolateWithSettingsProfilePropertiesTest.class ); - suite.addTestSuite( MavenITmng2045testJarDependenciesBrokenInReactorTest.class ); - suite.addTestSuite( MavenITmng2006ChildPathAwareUrlInheritanceTest.class ); - suite.addTestSuite( MavenITmng1995InterpolateBooleanModelElementsTest.class ); - suite.addTestSuite( MavenITmng1992SystemPropOverridesPomPropTest.class ); - suite.addTestSuite( MavenITmng1957JdkActivationWithVersionRangeTest.class ); - suite.addTestSuite( MavenITmng1895ScopeConflictResolutionTest.class ); - suite.addTestSuite( MavenITmng1803PomValidationErrorIncludesLineNumberTest.class ); - suite.addTestSuite( MavenITmng1751ForcedMetadataUpdateDuringDeploymentTest.class ); - suite.addTestSuite( MavenITmng1703PluginMgmtDepInheritanceTest.class ); - suite.addTestSuite( MavenITmng1701DuplicatePluginTest.class ); - suite.addTestSuite( MavenITmng1493NonStandardModulePomNamesTest.class ); - suite.addTestSuite( MavenITmng1491ReactorArtifactIdCollisionTest.class ); - suite.addTestSuite( MavenITmng1415QuotedSystemPropertiesTest.class ); - suite.addTestSuite( MavenITmng1412DependenciesOrderTest.class ); - suite.addTestSuite( MavenITmng1349ChecksumFormatsTest.class ); - suite.addTestSuite( MavenITmng1323AntrunDependenciesTest.class ); - suite.addTestSuite( MavenITmng1233WarDepWithProvidedScopeTest.class ); - suite.addTestSuite( MavenITmng1144MultipleDefaultGoalsTest.class ); - suite.addTestSuite( MavenITmng1142VersionRangeIntersectionTest.class ); - suite.addTestSuite( MavenITmng1088ReactorPluginResolutionTest.class ); - suite.addTestSuite( MavenITmng1073AggregatorForksReactorTest.class ); - suite.addTestSuite( MavenITmng1052PluginMgmtConfigTest.class ); - suite.addTestSuite( MavenITmng1021EqualAttachmentBuildNumberTest.class ); - suite.addTestSuite( MavenITmng0985NonExecutedPluginMgmtGoalsTest.class ); - suite.addTestSuite( MavenITmng0956ComponentInjectionViaProjectLevelPluginDepTest.class ); - suite.addTestSuite( MavenITmng0947OptionalDependencyTest.class ); - suite.addTestSuite( MavenITmng0870ReactorAwarePluginDiscoveryTest.class ); - suite.addTestSuite( MavenITmng0866EvaluateDefaultValueTest.class ); - suite.addTestSuite( MavenITmng0848UserPropertyOverridesDefaultValueTest.class ); - suite.addTestSuite( MavenITmng0836PluginParentResolutionTest.class ); - suite.addTestSuite( MavenITmng0828PluginConfigValuesInDebugTest.class ); - suite.addTestSuite( MavenITmng0823MojoContextPassingTest.class ); - suite.addTestSuite( MavenITmng0820ConflictResolutionTest.class ); - suite.addTestSuite( MavenITmng0818WarDepsNotTransitiveTest.class ); - suite.addTestSuite( MavenITmng0814ExplicitProfileActivationTest.class ); - suite.addTestSuite( MavenITmng0786ProfileAwareReactorTest.class ); - suite.addTestSuite( MavenITmng0781PluginConfigVsExecConfigTest.class ); - suite.addTestSuite( MavenITmng0773SettingsProfileReactorPollutionTest.class ); - suite.addTestSuite( MavenITmng0768OfflineModeTest.class ); - suite.addTestSuite( MavenITmng0761MissingSnapshotDistRepoTest.class ); - suite.addTestSuite( MavenITmng0680ParentBasedirTest.class ); - suite.addTestSuite( MavenITmng0674PluginParameterAliasTest.class ); - suite.addTestSuite( MavenITmng0666IgnoreLegacyPomTest.class ); - suite.addTestSuite( MavenITmng0557UserSettingsCliOptionTest.class ); - suite.addTestSuite( MavenITmng0553SettingsAuthzEncryptionTest.class ); - suite.addTestSuite( MavenITmng0522InheritedPluginMgmtConfigTest.class ); - suite.addTestSuite( MavenITmng0507ArtifactRelocationTest.class ); - suite.addTestSuite( MavenITmng0505VersionRangeTest.class ); - suite.addTestSuite( MavenITmng0496IgnoreUnknownPluginParametersTest.class ); - suite.addTestSuite( MavenITmng0479OverrideCentralRepoTest.class ); - suite.addTestSuite( MavenITmng0471CustomLifecycleTest.class ); - suite.addTestSuite( MavenITmng0469ReportConfigTest.class ); - suite.addTestSuite( MavenITmng0461TolerateMissingDependencyPomTest.class ); - suite.addTestSuite( MavenITmng0449PluginVersionResolutionTest.class ); - suite.addTestSuite( MavenITmng0377PluginLookupFromPrefixTest.class ); - suite.addTestSuite( MavenITmng0294MergeGlobalAndUserSettingsTest.class ); - suite.addTestSuite( MavenITmng0282NonReactorExecWhenProjectIndependentTest.class ); - suite.addTestSuite( MavenITmng0249ResolveDepsFromReactorTest.class ); - suite.addTestSuite( MavenITmng0187CollectedProjectsTest.class ); - suite.addTestSuite( MavenITmng0095ReactorFailureBehaviorTest.class ); - suite.addTestSuite( MavenIT0199CyclicImportScopeTest.class ); - suite.addTestSuite( MavenIT0146InstallerSnapshotNaming.class ); - suite.addTestSuite( MavenIT0144LifecycleExecutionOrderTest.class ); - suite.addTestSuite( MavenIT0143TransitiveDependencyScopesTest.class ); - suite.addTestSuite( MavenIT0142DirectDependencyScopesTest.class ); - suite.addTestSuite( MavenIT0140InterpolationWithPomPrefixTest.class ); - suite.addTestSuite( MavenIT0139InterpolationWithProjectPrefixTest.class ); - suite.addTestSuite( MavenIT0138PluginLifecycleTest.class ); - suite.addTestSuite( MavenIT0137EarLifecycleTest.class ); - suite.addTestSuite( MavenIT0136RarLifecycleTest.class ); - suite.addTestSuite( MavenIT0135EjbLifecycleTest.class ); - suite.addTestSuite( MavenIT0134WarLifecycleTest.class ); - suite.addTestSuite( MavenIT0133JarLifecycleTest.class ); - suite.addTestSuite( MavenIT0132PomLifecycleTest.class ); - suite.addTestSuite( MavenIT0131SiteLifecycleTest.class ); - suite.addTestSuite( MavenIT0130CleanLifecycleTest.class ); - suite.addTestSuite( MavenIT0113ServerAuthzAvailableToWagonMgrInPluginTest.class ); - suite.addTestSuite( MavenIT0090EnvVarInterpolationTest.class ); - suite.addTestSuite( MavenIT0087PluginRealmWithProjectLevelDepsTest.class ); - suite.addTestSuite( MavenIT0086PluginRealmTest.class ); - suite.addTestSuite( MavenIT0085TransitiveSystemScopeTest.class ); - suite.addTestSuite( MavenIT0072InterpolationWithDottedPropertyTest.class ); - suite.addTestSuite( MavenIT0071PluginConfigWithDottedPropertyTest.class ); - suite.addTestSuite( MavenIT0064MojoConfigViaSettersTest.class ); - suite.addTestSuite( MavenIT0063SystemScopeDependencyTest.class ); - suite.addTestSuite( MavenIT0056MultipleGoalExecutionsTest.class ); - suite.addTestSuite( MavenIT0052ReleaseProfileTest.class ); - suite.addTestSuite( MavenIT0051ReleaseProfileTest.class ); - suite.addTestSuite( MavenIT0041ArtifactTypeFromPluginExtensionTest.class ); - suite.addTestSuite( MavenIT0040PackagingFromPluginExtensionTest.class ); - suite.addTestSuite( MavenIT0038AlternatePomFileDifferentDirTest.class ); - suite.addTestSuite( MavenIT0037AlternatePomFileSameDirTest.class ); - suite.addTestSuite( MavenIT0032MavenPrerequisiteTest.class ); - suite.addTestSuite( MavenIT0030DepPomDepMgmtInheritanceTest.class ); - suite.addTestSuite( MavenIT0025MultipleExecutionLevelConfigsTest.class ); - suite.addTestSuite( MavenIT0024MultipleGoalExecutionsTest.class ); - suite.addTestSuite( MavenIT0023SettingsProfileTest.class ); - suite.addTestSuite( MavenIT0021PomProfileTest.class ); - suite.addTestSuite( MavenIT0019PluginVersionMgmtBySuperPomTest.class ); - suite.addTestSuite( MavenIT0018DependencyManagementTest.class ); - suite.addTestSuite( MavenIT0012PomInterpolationTest.class ); - suite.addTestSuite( MavenIT0011DefaultVersionByDependencyManagementTest.class ); - suite.addTestSuite( MavenIT0010DependencyClosureResolutionTest.class ); - suite.addTestSuite( MavenIT0009GoalConfigurationTest.class ); - suite.addTestSuite( MavenIT0008SimplePluginTest.class ); + suite.addTestSuite(MavenITmng7587Jsr330.class); + suite.addTestSuite(MavenITmng7038RootdirTest.class); + suite.addTestSuite(MavenITmng7697PomWithEmojiTest.class); + suite.addTestSuite(MavenITmng7737ProfileActivationTest.class); + suite.addTestSuite(MavenITmng7716BuildDeadlock.class); + suite.addTestSuite(MavenITmng7679SingleMojoNoPomTest.class); + suite.addTestSuite(MavenITmng7629SubtreeBuildTest.class); + suite.addTestSuite(MavenITmng7606DependencyImportScopeTest.class); + suite.addTestSuite(MavenITmng6609ProfileActivationForPackagingTest.class); + suite.addTestSuite(MavenITmng7566JavaPrerequisiteTest.class); + suite.addTestSuite(MavenITmng5889FindBasedir.class); + suite.addTestSuite(MavenITmng7360BuildConsumer.class); + suite.addTestSuite(MavenITmng5452MavenBuildTimestampUTCTest.class); + suite.addTestSuite(MavenITmng3890TransitiveDependencyScopeUpdateTest.class); + suite.addTestSuite(MavenITmng3092SnapshotsExcludedFromVersionRangeTest.class); + suite.addTestSuite(MavenITmng3038TransitiveDepManVersionTest.class); + suite.addTestSuite(MavenITmng2771PomExtensionComponentOverrideTest.class); + suite.addTestSuite(MavenITmng0612NewestConflictResolverTest.class); + suite.addTestSuite(MavenIT0108SnapshotUpdateTest.class); + suite.addTestSuite(MavenITmng7310LifecycleActivatedInSpecifiedModuleTest.class); + suite.addTestSuite(MavenITmng7474SessionScopeTest.class); + suite.addTestSuite(MavenITmng7529VersionRangeRepositorySelection.class); + suite.addTestSuite(MavenITmng7443ConsistencyOfOptionalProjectsAndProfilesTest.class); + suite.addTestSuite(MavenITmng7353CliGoalInvocationTest.class); + suite.addTestSuite(MavenITmng7504NotWarnUnsupportedReportPluginsTest.class); + suite.addTestSuite(MavenITmng7160ExtensionClassloader.class); + suite.addTestSuite(MavenITmng7468UnsupportedPluginsParametersTest.class); + suite.addTestSuite(MavenITmng7487DeadlockTest.class); + suite.addTestSuite(MavenITmng7470ResolverTransportTest.class); + suite.addTestSuite(MavenITmng7464ReadOnlyMojoParametersWarningTest.class); + suite.addTestSuite(MavenITmng7404IgnorePrefixlessExpressionsTest.class); + suite.addTestSuite(MavenITmng5222MojoDeprecatedTest.class); + suite.addTestSuite(MavenITmng7390SelectModuleOutsideCwdTest.class); + suite.addTestSuite(MavenITmng7244IgnorePomPrefixInExpressions.class); + suite.addTestSuite(MavenITmng7349RelocationWarningTest.class); + suite.addTestSuite(MavenITmng6326CoreExtensionsNotFoundTest.class); + suite.addTestSuite(MavenITmng5561PluginRelocationLosesConfigurationTest.class); + suite.addTestSuite(MavenITmng7335MissingJarInParallelBuild.class); + suite.addTestSuite(MavenITmng4463DependencyManagementImportVersionRanges.class); + suite.addTestSuite(MavenITmng7112ProjectsWithNonRecursiveTest.class); + suite.addTestSuite(MavenITmng7128BlockExternalHttpReactorTest.class); + suite.addTestSuite(MavenITmng6511OptionalProjectSelectionTest.class); + suite.addTestSuite(MavenITmng7110ExtensionClassloader.class); + suite.addTestSuite(MavenITmng7051OptionalProfileActivationTest.class); + suite.addTestSuite(MavenITmng6957BuildConsumer.class); + suite.addTestSuite(MavenITmng7045DropUselessAndOutdatedCdiApiTest.class); + suite.addTestSuite(MavenITmng6566ExecuteAnnotationShouldNotReExecuteGoalsTest.class); + suite.addTestSuite(MavenITmng6754TimestampInMultimoduleProject.class); + suite.addTestSuite(MavenITmng6981ProjectListShouldIncludeChildrenTest.class); + suite.addTestSuite(MavenITmng6972AllowAccessToGraphPackageTest.class); + suite.addTestSuite(MavenITmng6772NestedImportScopeRepositoryOverride.class); + suite.addTestSuite(MavenITmng6759TransitiveDependencyRepositoriesTest.class); + suite.addTestSuite(MavenITmng6720FailFastTest.class); + suite.addTestSuite(MavenITmng6656BuildConsumer.class); + suite.addTestSuite(MavenITmng6562WarnDefaultBindings.class); + suite.addTestSuite(MavenITmng6558ToolchainsBuildingEventTest.class); + suite.addTestSuite(MavenITmng6506PackageAnnotationTest.class); + suite.addTestSuite(MavenITmng6391PrintVersionTest.class); + suite.addTestSuite(MavenITmng6386BaseUriPropertyTest.class); + suite.addTestSuite(MavenITmng6330RelativePath.class); + suite.addTestSuite(MavenITmng6256SpecialCharsAlternatePOMLocation.class); + suite.addTestSuite(MavenITmng6255FixConcatLines.class); + suite.addTestSuite(MavenITmng6240PluginExtensionAetherProvider.class); + suite.addTestSuite(MavenITmng6223FindBasedir.class); + suite.addTestSuite(MavenITmng6210CoreExtensionsCustomScopesTest.class); + suite.addTestSuite(MavenITmng6189SiteReportPluginsWarningTest.class); + suite.addTestSuite(MavenITmng6173GetProjectsAndDependencyGraphTest.class); + suite.addTestSuite(MavenITmng6173GetAllProjectsInReactorTest.class); + suite.addTestSuite(MavenITmng6127PluginExecutionConfigurationInterferenceTest.class); + suite.addTestSuite(MavenITmng6118SubmoduleInvocation.class); + suite.addTestSuite(MavenITmng6090CIFriendlyTest.class); + suite.addTestSuite(MavenITmng6084Jsr250PluginTest.class); + suite.addTestSuite(MavenITmng6071GetResourceWithCustomPom.class); + suite.addTestSuite(MavenITmng6065FailOnSeverityTest.class); + suite.addTestSuite(MavenITmng6057CheckReactorOrderTest.class); + suite.addTestSuite(MavenITmng5965ParallelBuildMultipliesWorkTest.class); + suite.addTestSuite(MavenITmng5958LifecyclePhaseBinaryCompat.class); + suite.addTestSuite(MavenITmng5935OptionalLostInTranstiveManagedDependenciesTest.class); + suite.addTestSuite(MavenITmng5898BuildMultimoduleWithEARFailsToResolveWARTest.class); + suite.addTestSuite(MavenITmng5895CIFriendlyUsageWithPropertyTest.class); + suite.addTestSuite(MavenITmng5868NoDuplicateAttachedArtifacts.class); + suite.addTestSuite(MavenITmng5840RelativePathReactorMatching.class); + suite.addTestSuite(MavenITmng5840ParentVersionRanges.class); + suite.addTestSuite(MavenITmng5805PkgTypeMojoConfiguration2.class); + suite.addTestSuite(MavenITmng5783PluginDependencyFiltering.class); + suite.addTestSuite(MavenITmng5774ConfigurationProcessorsTest.class); + suite.addTestSuite(MavenITmng5771CoreExtensionsTest.class); + suite.addTestSuite(MavenITmng5768CliExecutionIdTest.class); + suite.addTestSuite(MavenITmng5760ResumeFeatureTest.class); + suite.addTestSuite(MavenITmng5753CustomMojoExecutionConfiguratorTest.class); + suite.addTestSuite(MavenITmng5742BuildExtensionClassloaderTest.class); + suite.addTestSuite(MavenITmng5716ToolchainsTypeTest.class); + suite.addTestSuite(MavenITmng5669ReadPomsOnce.class); + suite.addTestSuite(MavenITmng5663NestedImportScopePomResolutionTest.class); + suite.addTestSuite(MavenITmng5640LifecycleParticipantAfterSessionEnd.class); + suite.addTestSuite(MavenITmng5639ImportScopePomResolutionTest.class); + suite.addTestSuite(MavenITmng5608ProfileActivationWarningTest.class); + suite.addTestSuite(MavenITmng5591WorkspaceReader.class); + suite.addTestSuite(MavenITmng5581LifecycleMappingDelegate.class); + suite.addTestSuite(MavenITmng5578SessionScopeTest.class); + suite.addTestSuite(MavenITmng5576CdFriendlyVersions.class); + suite.addTestSuite(MavenITmng5572ReactorPluginExtensionsTest.class); + suite.addTestSuite(MavenITmng5530MojoExecutionScopeTest.class); + suite.addTestSuite(MavenITmng5482AetherNotFoundTest.class); + suite.addTestSuite(MavenITmng5445LegacyStringSearchModelInterpolatorTest.class); + suite.addTestSuite(MavenITmng5389LifecycleParticipantAfterSessionEnd.class); + suite.addTestSuite(MavenITmng5387ArtifactReplacementPlugin.class); + suite.addTestSuite(MavenITmng5382Jsr330Plugin.class); + suite.addTestSuite(MavenITmng5338FileOptionToDirectory.class); + suite.addTestSuite(MavenITmng5280SettingsProfilesRepositoriesOrderTest.class); + suite.addTestSuite(MavenITmng5230MakeReactorWithExcludesTest.class); + suite.addTestSuite(MavenITmng5224InjectedSettings.class); + suite.addTestSuite(MavenITmng5214DontMapWsdlToJar.class); + suite.addTestSuite(MavenITmng5208EventSpyParallelTest.class); + suite.addTestSuite(MavenITmng5175WagonHttpTest.class); + suite.addTestSuite(MavenITmng5137ReactorResolutionInForkedBuildTest.class); + suite.addTestSuite(MavenITmng5135AggregatorDepResolutionModuleExtensionTest.class); + suite.addTestSuite(MavenITmng5096ExclusionAtDependencyWithImpliedClassifierTest.class); + suite.addTestSuite(MavenITmng5064SuppressSnapshotUpdatesTest.class); + suite.addTestSuite(MavenITmng5019StringBasedCompLookupFromChildPluginRealmTest.class); + suite.addTestSuite(MavenITmng5013ConfigureParamBeanFromScalarValueTest.class); + suite.addTestSuite(MavenITmng5012CollectionVsArrayParamCoercionTest.class); + suite.addTestSuite(MavenITmng5011ConfigureCollectionArrayFromUserPropertiesTest.class); + suite.addTestSuite(MavenITmng5009AggregationCycleTest.class); + suite.addTestSuite(MavenITmng5006VersionRangeDependencyParentResolutionTest.class); + suite.addTestSuite(MavenITmng5000ChildPathAwareUrlInheritanceTest.class); + suite.addTestSuite(MavenITmng4992MapStylePropertiesParamConfigTest.class); + suite.addTestSuite(MavenITmng4991NonProxyHostsTest.class); + suite.addTestSuite(MavenITmng4987TimestampBasedSnapshotSelectionTest.class); + suite.addTestSuite(MavenITmng4975ProfileInjectedPluginExecutionOrderTest.class); + suite.addTestSuite(MavenITmng4973ExtensionVisibleToPluginInReactorTest.class); + suite.addTestSuite(MavenITmng4966AbnormalUrlPreservationTest.class); + suite.addTestSuite(MavenITmng4963ParentResolutionFromMirrorTest.class); + suite.addTestSuite(MavenITmng4960MakeLikeReactorResumeTest.class); + suite.addTestSuite(MavenITmng4955LocalVsRemoteSnapshotResolutionTest.class); + suite.addTestSuite(MavenITmng4952MetadataReleaseInfoUpdateTest.class); + suite.addTestSuite(MavenITmng4936EventSpyTest.class); + suite.addTestSuite(MavenITmng4925ContainerLookupRealmDuringMojoExecTest.class); + suite.addTestSuite(MavenITmng4919LifecycleMappingWithSameGoalTwiceTest.class); + suite.addTestSuite(MavenITmng4913UserPropertyVsDependencyPomPropertyTest.class); + suite.addTestSuite(MavenITmng4895PluginDepWithNonRelocatedMavenApiTest.class); + suite.addTestSuite(MavenITmng4891RobustSnapshotResolutionTest.class); + suite.addTestSuite(MavenITmng4890MakeLikeReactorConsidersVersionsTest.class); + suite.addTestSuite(MavenITmng4883FailUponOverconstrainedVersionRangesTest.class); + suite.addTestSuite(MavenITmng4877DeployUsingPrivateKeyTest.class); + suite.addTestSuite(MavenITmng4874UpdateLatestPluginVersionTest.class); + suite.addTestSuite(MavenITmng4872ReactorResolutionAttachedWithExclusionsTest.class); + suite.addTestSuite(MavenITmng4842ParentResolutionOfDependencyPomTest.class); + suite.addTestSuite(MavenITmng4840MavenPrerequisiteTest.class); + suite.addTestSuite(MavenITmng4834ParentProjectResolvedFromRemoteReposTest.class); + suite.addTestSuite(MavenITmng4829ChecksumFailureWarningTest.class); + suite.addTestSuite(MavenITmng4814ReResolutionOfDependenciesDuringReactorTest.class); + suite.addTestSuite(MavenITmng4811CustomComponentConfiguratorTest.class); + suite.addTestSuite(MavenITmng4800NearestWinsVsScopeWideningTest.class); + suite.addTestSuite(MavenITmng4795DepResolutionInReactorProjectForkedByLifecycleTest.class); + suite.addTestSuite(MavenITmng4791ProjectBuilderResolvesRemotePomArtifactTest.class); + suite.addTestSuite(MavenITmng4789ScopeInheritanceMeetsConflictTest.class); + suite.addTestSuite(MavenITmng4788InstallationToCustomLocalRepoTest.class); + suite.addTestSuite(MavenITmng4786AntBased21xMojoSupportTest.class); + suite.addTestSuite(MavenITmng4785TransitiveResolutionInForkedThreadTest.class); + suite.addTestSuite(MavenITmng4781DeploymentToNexusStagingRepoTest.class); + suite.addTestSuite(MavenITmng4779MultipleDepsWithVersionRangeFromLocalRepoTest.class); + suite.addTestSuite(MavenITmng4776ForkedReactorPluginVersionResolutionTest.class); + suite.addTestSuite(MavenITmng4772PluginVersionResolutionDoesntTouchDisabledRepoTest.class); + suite.addTestSuite(MavenITmng4771PluginPrefixResolutionDoesntTouchDisabledRepoTest.class); + suite.addTestSuite(MavenITmng4768NearestMatchConflictResolutionTest.class); + suite.addTestSuite(MavenITmng4765LocalPomProjectBuilderTest.class); + suite.addTestSuite(MavenITmng4755FetchRemoteMetadataForVersionRangeTest.class); + suite.addTestSuite(MavenITmng4750ResolvedMavenProjectDependencyArtifactsTest.class); + suite.addTestSuite(MavenITmng4747JavaAgentUsedByPluginTest.class); + suite.addTestSuite(MavenITmng4745PluginVersionUpdateTest.class); + suite.addTestSuite(MavenITmng4729MirrorProxyAuthUsedByProjectBuilderTest.class); + suite.addTestSuite(MavenITmng4721OptionalPluginDependencyTest.class); + suite.addTestSuite(MavenITmng4720DependencyManagementExclusionMergeTest.class); + suite.addTestSuite(MavenITmng4696MavenProjectDependencyArtifactsTest.class); + suite.addTestSuite(MavenITmng4690InterdependentConflictResolutionTest.class); + suite.addTestSuite(MavenITmng4684DistMgmtOverriddenByProfileTest.class); + suite.addTestSuite(MavenITmng4679SnapshotUpdateInPluginTest.class); + suite.addTestSuite(MavenITmng4677DisabledPluginConfigInheritanceTest.class); + suite.addTestSuite(MavenITmng4666CoreRealmImportTest.class); + suite.addTestSuite(MavenITmng4660ResumeFromTest.class); + suite.addTestSuite(MavenITmng4660OutdatedPackagedArtifact.class); + suite.addTestSuite(MavenITmng4654ArtifactHandlerForMainArtifactTest.class); + suite.addTestSuite(MavenITmng4644StrictPomParsingRejectsMisplacedTextTest.class); + suite.addTestSuite(MavenITmng4633DualCompilerExecutionsWeaveModeTest.class); + suite.addTestSuite(MavenITmng4629NoPomValidationErrorUponMissingSystemDepTest.class); + suite.addTestSuite(MavenITmng4625SettingsXmlInterpolationWithXmlMarkupTest.class); + suite.addTestSuite(MavenITmng4618AggregatorBuiltAfterModulesTest.class); + suite.addTestSuite(MavenITmng4615ValidateRequiredPluginParameterTest.class); + suite.addTestSuite(MavenITmng4600DependencyOptionalFlagManagementTest.class); + suite.addTestSuite(MavenITmng4590ImportedPomUsesSystemAndUserPropertiesTest.class); + suite.addTestSuite(MavenITmng4586PluginPrefixResolutionFromVersionlessPluginMgmtTest.class); + suite.addTestSuite(MavenITmng4580ProjectLevelPluginDepUsedForCliInvocInReactorTest.class); + suite.addTestSuite(MavenITmng4572ModelVersionSurroundedByWhitespaceTest.class); + suite.addTestSuite(MavenITmng4561MirroringOfPluginRepoTest.class); + suite.addTestSuite(MavenITmng4555MetaversionResolutionOfflineTest.class); + suite.addTestSuite(MavenITmng4554PluginPrefixMappingUpdateTest.class); + suite.addTestSuite(MavenITmng4553CoreArtifactFilterConsidersGroupIdTest.class); + suite.addTestSuite(MavenITmng4544ActiveComponentCollectionThreadSafeTest.class); + suite.addTestSuite(MavenITmng4536RequiresNoProjectForkingMojoTest.class); + suite.addTestSuite(MavenITmng4528ExcludeWagonsFromMavenCoreArtifactsTest.class); + suite.addTestSuite(MavenITmng4526MavenProjectArtifactsScopeTest.class); + suite.addTestSuite(MavenITmng4522FailUponMissingDependencyParentPomTest.class); + suite.addTestSuite(MavenITmng4500NoUpdateOfTimestampedSnapshotsTest.class); + suite.addTestSuite(MavenITmng4498IgnoreBrokenMetadataTest.class); + suite.addTestSuite(MavenITmng4489MirroringOfExtensionRepoTest.class); + suite.addTestSuite(MavenITmng4488ValidateExternalParenPomLenientTest.class); + suite.addTestSuite(MavenITmng4482ForcePluginSnapshotUpdateTest.class); + suite.addTestSuite(MavenITmng4474PerLookupWagonInstantiationTest.class); + suite.addTestSuite(MavenITmng4470AuthenticatedDeploymentToProxyTest.class); + suite.addTestSuite(MavenITmng4469AuthenticatedDeploymentToCustomRepoTest.class); + suite.addTestSuite(MavenITmng4465PluginPrefixFromLocalCacheOfDownRepoTest.class); + suite.addTestSuite(MavenITmng4464PlatformIndependentFileSeparatorTest.class); + suite.addTestSuite(MavenITmng4461ArtifactUploadMonitorTest.class); + suite.addTestSuite(MavenITmng4459InMemorySettingsKeptEncryptedTest.class); + suite.addTestSuite(MavenITmng4453PluginVersionFromLifecycleMappingTest.class); + suite.addTestSuite(MavenITmng4452ResolutionOfSnapshotWithClassifierTest.class); + suite.addTestSuite(MavenITmng4450StubModelForMissingDependencyPomTest.class); + suite.addTestSuite(MavenITmng4436SingletonComponentLookupTest.class); + suite.addTestSuite(MavenITmng4433ForceParentSnapshotUpdateTest.class); + suite.addTestSuite(MavenITmng4430DistributionManagementStatusTest.class); + suite.addTestSuite(MavenITmng4429CompRequirementOnNonDefaultImplTest.class); + suite.addTestSuite(MavenITmng4428FollowHttpRedirectTest.class); + suite.addTestSuite(MavenITmng4423SessionDataFromPluginParameterExpressionTest.class); + suite.addTestSuite(MavenITmng4422PluginExecutionPhaseInterpolationTest.class); + suite.addTestSuite(MavenITmng4421DeprecatedPomInterpolationExpressionsTest.class); + suite.addTestSuite(MavenITmng4416PluginOrderAfterProfileInjectionTest.class); + suite.addTestSuite(MavenITmng4415InheritedPluginOrderTest.class); + suite.addTestSuite(MavenITmng4413MirroringOfDependencyRepoTest.class); + suite.addTestSuite(MavenITmng4412OfflineModeInPluginTest.class); + suite.addTestSuite(MavenITmng4411VersionInfoTest.class); + suite.addTestSuite(MavenITmng4410UsageHelpTest.class); + suite.addTestSuite(MavenITmng4408NonExistentSettingsFileTest.class); + suite.addTestSuite(MavenITmng4405ValidPluginVersionTest.class); + suite.addTestSuite(MavenITmng4404UniqueProfileIdTest.class); + suite.addTestSuite(MavenITmng4403LenientDependencyPomParsingTest.class); + suite.addTestSuite(MavenITmng4402DuplicateChildModuleTest.class); + suite.addTestSuite(MavenITmng4401RepositoryOrderForParentPomTest.class); + suite.addTestSuite(MavenITmng4400RepositoryOrderTest.class); + suite.addTestSuite(MavenITmng4396AntBased20xMojoSupportTest.class); + suite.addTestSuite(MavenITmng4393ParseExternalParenPomLenientTest.class); + suite.addTestSuite(MavenITmng4387QuietLoggingTest.class); + suite.addTestSuite(MavenITmng4386DebugLoggingTest.class); + suite.addTestSuite(MavenITmng4385LifecycleMappingFromExtensionInReactorTest.class); + suite.addTestSuite(MavenITmng4383ValidDependencyVersionTest.class); + suite.addTestSuite(MavenITmng4381ExtensionSingletonComponentTest.class); + suite.addTestSuite(MavenITmng4379TransitiveSystemPathInterpolatedWithEnvVarTest.class); + suite.addTestSuite(MavenITmng4368TimestampAwareArtifactInstallerTest.class); + suite.addTestSuite(MavenITmng4367LayoutAwareMirrorSelectionTest.class); + suite.addTestSuite(MavenITmng4365XmlMarkupInAttributeValueTest.class); + suite.addTestSuite(MavenITmng4363DynamicAdditionOfDependencyArtifactTest.class); + suite.addTestSuite(MavenITmng4361ForceDependencySnapshotUpdateTest.class); + suite.addTestSuite(MavenITmng4360WebDavSupportTest.class); + suite.addTestSuite(MavenITmng4359LocallyReachableParentOutsideOfReactorTest.class); + suite.addTestSuite(MavenITmng4357LifecycleMappingDiscoveryInReactorTest.class); + suite.addTestSuite(MavenITmng4355ExtensionAutomaticVersionResolutionTest.class); + suite.addTestSuite(MavenITmng4353PluginDependencyResolutionFromPomRepoTest.class); + suite.addTestSuite(MavenITmng4350LifecycleMappingExecutionOrderTest.class); + suite.addTestSuite(MavenITmng4349RelocatedArtifactWithInvalidPomTest.class); + suite.addTestSuite(MavenITmng4348NoUnnecessaryRepositoryAccessTest.class); + suite.addTestSuite(MavenITmng4347ImportScopeWithSettingsProfilesTest.class); + suite.addTestSuite(MavenITmng4345DefaultPluginExecutionOrderTest.class); + suite.addTestSuite(MavenITmng4344ManagedPluginExecutionOrderTest.class); + suite.addTestSuite(MavenITmng4343MissingReleaseUpdatePolicyTest.class); + suite.addTestSuite(MavenITmng4342IndependentMojoParameterDefaultValuesTest.class); + suite.addTestSuite(MavenITmng4341PluginExecutionOrderTest.class); + suite.addTestSuite(MavenITmng4338OptionalMojosTest.class); + suite.addTestSuite(MavenITmng4335SettingsOfflineModeTest.class); + suite.addTestSuite(MavenITmng4332DefaultPluginExecutionOrderTest.class); + suite.addTestSuite(MavenITmng4331DependencyCollectionTest.class); + suite.addTestSuite(MavenITmng4328PrimitiveMojoParameterConfigurationTest.class); + suite.addTestSuite(MavenITmng4327ExcludeForkingMojoFromForkedLifecycleTest.class); + suite.addTestSuite(MavenITmng4326LocalSnapshotSuppressesRemoteCheckTest.class); + suite.addTestSuite(MavenITmng4321CliUsesPluginMgmtConfigTest.class); + suite.addTestSuite(MavenITmng4320AggregatorAndDependenciesTest.class); + suite.addTestSuite(MavenITmng4319PluginExecutionGoalInterpolationTest.class); + suite.addTestSuite(MavenITmng4318ProjectExecutionRootTest.class); + suite.addTestSuite(MavenITmng4317PluginVersionResolutionFromMultiReposTest.class); + suite.addTestSuite(MavenITmng4314DirectInvocationOfAggregatorTest.class); + suite.addTestSuite(MavenITmng4312TypeAwarePluginParameterExpressionInjectionTest.class); + suite.addTestSuite(MavenITmng4309StrictChecksumValidationForMetadataTest.class); + suite.addTestSuite(MavenITmng4305LocalRepoBasedirTest.class); + suite.addTestSuite(MavenITmng4304ProjectDependencyArtifactsTest.class); + suite.addTestSuite(MavenITmng4293RequiresCompilePlusRuntimeScopeTest.class); + suite.addTestSuite(MavenITmng4292EnumTypeMojoParametersTest.class); + suite.addTestSuite(MavenITmng4291MojoRequiresOnlineModeTest.class); + suite.addTestSuite(MavenITmng4283ParentPomPackagingTest.class); + suite.addTestSuite(MavenITmng4281PreferLocalSnapshotTest.class); + suite.addTestSuite(MavenITmng4276WrongTransitivePlexusUtilsTest.class); + suite.addTestSuite(MavenITmng4275RelocationWarningTest.class); + suite.addTestSuite(MavenITmng4274PluginRealmArtifactsTest.class); + suite.addTestSuite(MavenITmng4273RestrictedCoreRealmAccessForPluginTest.class); + suite.addTestSuite(MavenITmng4270ArtifactHandlersFromPluginDepsTest.class); + suite.addTestSuite(MavenITmng4269BadReactorResolutionFromOutDirTest.class); + suite.addTestSuite(MavenITmng4262MakeLikeReactorDottedPathTest.class); + suite.addTestSuite(MavenITmng4262MakeLikeReactorDottedPath370Test.class); + suite.addTestSuite(MavenITmng4238ArtifactHandlerExtensionUsageTest.class); + suite.addTestSuite(MavenITmng4235HttpAuthDeploymentChecksumsTest.class); + suite.addTestSuite(MavenITmng4233ReactorResolutionForManuallyCreatedArtifactTest.class); + suite.addTestSuite(MavenITmng4231SnapshotUpdatePolicyTest.class); + suite.addTestSuite(MavenITmng4214MirroredParentSearchReposTest.class); + suite.addTestSuite(MavenITmng4208InterpolationPrefersCliOverProjectPropsTest.class); + suite.addTestSuite(MavenITmng4207PluginWithLog4JTest.class); + suite.addTestSuite(MavenITmng4203TransitiveDependencyExclusionTest.class); + suite.addTestSuite(MavenITmng4199CompileMeetsRuntimeScopeTest.class); + suite.addTestSuite(MavenITmng4196ExclusionOnPluginDepTest.class); + suite.addTestSuite(MavenITmng4193UniqueRepoIdTest.class); + suite.addTestSuite(MavenITmng4190MirrorRepoMergingTest.class); + suite.addTestSuite(MavenITmng4189UniqueVersionSnapshotTest.class); + suite.addTestSuite(MavenITmng4180PerDependencyExclusionsTest.class); + suite.addTestSuite(MavenITmng4172EmptyDependencySetTest.class); + suite.addTestSuite(MavenITmng4166HideCoreCommonsCliTest.class); + suite.addTestSuite(MavenITmng4162ReportingMigrationTest.class); + suite.addTestSuite(MavenITmng4150VersionRangeTest.class); + suite.addTestSuite(MavenITmng4129PluginExecutionInheritanceTest.class); + suite.addTestSuite(MavenITmng4116UndecodedUrlsTest.class); + suite.addTestSuite(MavenITmng4112MavenVersionPropertyTest.class); + suite.addTestSuite(MavenITmng4107InterpolationUsesDominantProfileSourceTest.class); + suite.addTestSuite(MavenITmng4106InterpolationUsesDominantProfileTest.class); + suite.addTestSuite(MavenITmng4102InheritedPropertyInterpolationTest.class); + suite.addTestSuite(MavenITmng4091BadPluginDescriptorTest.class); + suite.addTestSuite(MavenITmng4087PercentEncodedFileUrlTest.class); + suite.addTestSuite(MavenITmng4072InactiveProfileReposTest.class); + suite.addTestSuite(MavenITmng4070WhitespaceTrimmingTest.class); + suite.addTestSuite(MavenITmng4068AuthenticatedMirrorTest.class); + suite.addTestSuite(MavenITmng4056ClassifierBasedDepResolutionFromReactorTest.class); + suite.addTestSuite(MavenITmng4053PluginConfigAttributesTest.class); + suite.addTestSuite(MavenITmng4052ReactorAwareImportScopeTest.class); + suite.addTestSuite(MavenITmng4048VersionRangeReactorResolutionTest.class); + suite.addTestSuite(MavenITmng4040ProfileInjectedModulesTest.class); + suite.addTestSuite(MavenITmng4036ParentResolutionFromSettingsRepoTest.class); + suite.addTestSuite(MavenITmng4034ManagedProfileDependencyTest.class); + suite.addTestSuite(MavenITmng4026ReactorDependenciesOrderTest.class); + suite.addTestSuite(MavenITmng4023ParentProfileOneTimeInjectionTest.class); + suite.addTestSuite(MavenITmng4022IdempotentPluginConfigMergingTest.class); + suite.addTestSuite(MavenITmng4016PrefixedPropertyInterpolationTest.class); + suite.addTestSuite(MavenITmng4009InheritProfileEffectsTest.class); + suite.addTestSuite(MavenITmng4008MergedFilterOrderTest.class); + suite.addTestSuite(MavenITmng4007PlatformFileSeparatorTest.class); + suite.addTestSuite(MavenITmng4005UniqueDependencyKeyTest.class); + suite.addTestSuite(MavenITmng4000MultiPluginExecutionsTest.class); + suite.addTestSuite(MavenITmng3998PluginExecutionConfigTest.class); + suite.addTestSuite(MavenITmng3991ValidDependencyScopeTest.class); + suite.addTestSuite(MavenITmng3983PluginResolutionFromProfileReposTest.class); + suite.addTestSuite(MavenITmng3979ElementJoinTest.class); + suite.addTestSuite(MavenITmng3974MirrorOrderingTest.class); + suite.addTestSuite(MavenITmng3970DepResolutionFromProfileReposTest.class); + suite.addTestSuite(MavenITmng3955EffectiveSettingsTest.class); + suite.addTestSuite(MavenITmng3953AuthenticatedDeploymentTest.class); + suite.addTestSuite(MavenITmng3951AbsolutePathsTest.class); + suite.addTestSuite(MavenITmng3948ParentResolutionFromProfileReposTest.class); + suite.addTestSuite(MavenITmng3947PluginDefaultExecutionConfigTest.class); + suite.addTestSuite(MavenITmng3944BasedirInterpolationTest.class); + suite.addTestSuite(MavenITmng3943PluginExecutionInheritanceTest.class); + suite.addTestSuite(MavenITmng3941ExecutionProjectRestrictedToForkingMojoTest.class); + suite.addTestSuite(MavenITmng3940EnvVarInterpolationTest.class); + suite.addTestSuite(MavenITmng3938MergePluginExecutionsTest.class); + suite.addTestSuite(MavenITmng3937MergedPluginExecutionGoalsTest.class); + suite.addTestSuite(MavenITmng3927PluginDefaultExecutionConfigTest.class); + suite.addTestSuite(MavenITmng3925MergedPluginExecutionOrderTest.class); + suite.addTestSuite(MavenITmng3924XmlMarkupInterpolationTest.class); + suite.addTestSuite(MavenITmng3916PluginExecutionInheritanceTest.class); + suite.addTestSuite(MavenITmng3906MergedPluginClassPathOrderingTest.class); + suite.addTestSuite(MavenITmng3904NestedBuildDirInterpolationTest.class); + suite.addTestSuite(MavenITmng3900ProfilePropertiesInterpolationTest.class); + suite.addTestSuite(MavenITmng3899ExtensionInheritanceTest.class); + suite.addTestSuite(MavenITmng3892ReleaseDeploymentTest.class); + suite.addTestSuite(MavenITmng3887PluginExecutionOrderTest.class); + suite.addTestSuite(MavenITmng3886ExecutionGoalsOrderTest.class); + suite.addTestSuite(MavenITmng3877BasedirAlignedModelTest.class); + suite.addTestSuite(MavenITmng3873MultipleExecutionGoalsTest.class); + suite.addTestSuite(MavenITmng3872ProfileActivationInRelocatedPomTest.class); + suite.addTestSuite(MavenITmng3866PluginConfigInheritanceTest.class); + suite.addTestSuite(MavenITmng3864PerExecPluginConfigTest.class); + suite.addTestSuite(MavenITmng3863AutoPluginGroupIdTest.class); + suite.addTestSuite(MavenITmng3853ProfileInjectedDistReposTest.class); + suite.addTestSuite(MavenITmng3852PluginConfigWithHeterogeneousListTest.class); + suite.addTestSuite(MavenITmng3846PomInheritanceUrlAdjustmentTest.class); + suite.addTestSuite(MavenITmng3845LimitedPomInheritanceTest.class); + suite.addTestSuite(MavenITmng3843PomInheritanceTest.class); + suite.addTestSuite(MavenITmng3839PomParsingCoalesceTextTest.class); + suite.addTestSuite(MavenITmng3838EqualPluginDepsTest.class); + suite.addTestSuite(MavenITmng3836PluginConfigInheritanceTest.class); + suite.addTestSuite(MavenITmng3833PomInterpolationDataFlowChainTest.class); + suite.addTestSuite(MavenITmng3831PomInterpolationTest.class); + suite.addTestSuite(MavenITmng3827PluginConfigTest.class); + suite.addTestSuite(MavenITmng3822BasedirAlignedInterpolationTest.class); + suite.addTestSuite(MavenITmng3821EqualPluginExecIdsTest.class); + suite.addTestSuite(MavenITmng3814BogusProjectCycleTest.class); + suite.addTestSuite(MavenITmng3813PluginClassPathOrderingTest.class); + suite.addTestSuite(MavenITmng3811ReportingPluginConfigurationInheritanceTest.class); + suite.addTestSuite(MavenITmng3810BadProfileActivationTest.class); + suite.addTestSuite(MavenITmng3808ReportInheritanceOrderingTest.class); + suite.addTestSuite(MavenITmng3807PluginConfigExpressionEvaluationTest.class); + suite.addTestSuite(MavenITmng3805ExtensionClassPathOrderingTest.class); + suite.addTestSuite(MavenITmng3796ClassImportInconsistencyTest.class); + suite.addTestSuite(MavenITmng3775ConflictResolutionBacktrackingTest.class); + suite.addTestSuite(MavenITmng3769ExclusionRelocatedTransdepsTest.class); + suite.addTestSuite(MavenITmng3766ToolchainsFromExtensionTest.class); + suite.addTestSuite(MavenITmng3748BadSettingsXmlTest.class); + suite.addTestSuite(MavenITmng3747PrefixedPathExpressionTest.class); + suite.addTestSuite(MavenITmng3746POMPropertyOverrideTest.class); + suite.addTestSuite(MavenITmng3740SelfReferentialReactorProjectsTest.class); + suite.addTestSuite(MavenITmng3732ActiveProfilesTest.class); + suite.addTestSuite(MavenITmng3729MultiForkAggregatorsTest.class); + suite.addTestSuite(MavenITmng3724ExecutionProjectSyncTest.class); + suite.addTestSuite(MavenITmng3723ConcreteParentProjectTest.class); + suite.addTestSuite(MavenITmng3719PomExecutionOrderingTest.class); + suite.addTestSuite(MavenITmng3716AggregatorForkingTest.class); + suite.addTestSuite(MavenITmng3714ToolchainsCliOptionTest.class); + suite.addTestSuite(MavenITmng3710PollutedClonedPluginsTest.class); + suite.addTestSuite(MavenITmng3703ExecutionProjectWithRelativePathsTest.class); + suite.addTestSuite(MavenITmng3701ImplicitProfileIdTest.class); + suite.addTestSuite(MavenITmng3694ReactorProjectsDynamismTest.class); + suite.addTestSuite(MavenITmng3693PomFileBasedirChangeTest.class); + suite.addTestSuite(MavenITmng3684BuildPluginParameterTest.class); + suite.addTestSuite(MavenITmng3680InvalidDependencyPOMTest.class); + suite.addTestSuite(MavenITmng3679PluginExecIdInterpolationTest.class); + suite.addTestSuite(MavenITmng3671PluginLevelDepInterpolationTest.class); + suite.addTestSuite(MavenITmng3667ResolveDepsWithBadPomVersionTest.class); + suite.addTestSuite(MavenITmng3652UserAgentHeaderTest.class); + suite.addTestSuite(MavenITmng3645POMSyntaxErrorTest.class); + suite.addTestSuite(MavenITmng3642DynamicResourcesTest.class); + suite.addTestSuite(MavenITmng3641ProfileActivationWarningTest.class); + suite.addTestSuite(MavenITmng3621UNCInheritedPathsTest.class); + suite.addTestSuite(MavenITmng3607ClassLoadersUseValidUrlsTest.class); + suite.addTestSuite(MavenITmng3600DeploymentModeDefaultsTest.class); + suite.addTestSuite(MavenITmng3599useHttpProxyForWebDAVMk2Test.class); + suite.addTestSuite(MavenITmng3586SystemScopePluginDependencyTest.class); + suite.addTestSuite(MavenITmng3581PluginUsesWagonDependencyTest.class); + suite.addTestSuite(MavenITmng3575HexadecimalOctalPluginParameterConfigTest.class); + suite.addTestSuite(MavenITmng3545ProfileDeactivationTest.class); + suite.addTestSuite(MavenITmng3536AppendedAbsolutePathsTest.class); + suite.addTestSuite(MavenITmng3535SelfReferentialPropertiesTest.class); + suite.addTestSuite(MavenITmng3529QuotedCliArgTest.class); + suite.addTestSuite(MavenITmng3506ArtifactHandlersFromPluginsTest.class); + suite.addTestSuite(MavenITmng3503Xpp3ShadingTest.class); + suite.addTestSuite(MavenITmng3498ForkToOtherMojoTest.class); + suite.addTestSuite(MavenITmng3485OverrideWagonExtensionTest.class); + suite.addTestSuite(MavenITmng3482DependencyPomInterpolationTest.class); + suite.addTestSuite(MavenITmng3477DependencyResolutionErrorMessageTest.class); + suite.addTestSuite(MavenITmng3475BaseAlignedDirTest.class); + suite.addTestSuite(MavenITmng3470StrictChecksumVerificationOfDependencyPomTest.class); + suite.addTestSuite(MavenITmng3461MirrorMatchingTest.class); + suite.addTestSuite(MavenITmng3441MetadataUpdatedFromDeploymentRepositoryTest.class); + suite.addTestSuite(MavenITmng3422ActiveComponentCollectionTest.class); + suite.addTestSuite(MavenITmng3415JunkRepositoryMetadataTest.class); + suite.addTestSuite(MavenITmng3401CLIDefaultExecIdTest.class); + suite.addTestSuite(MavenITmng3396DependencyManagementForOverConstrainedRangesTest.class); + suite.addTestSuite(MavenITmng3394POMPluginVersionDominanceTest.class); + suite.addTestSuite(MavenITmng3380ManagedRelocatedTransdepsTest.class); + suite.addTestSuite(MavenITmng3379ParallelArtifactDownloadsTest.class); + suite.addTestSuite(MavenITmng3372DirectInvocationOfPluginsTest.class); + suite.addTestSuite(MavenITmng3355TranslatedPathInterpolationTest.class); + suite.addTestSuite(MavenITmng3331ModulePathNormalizationTest.class); + suite.addTestSuite(MavenITmng3314OfflineSnapshotsTest.class); + suite.addTestSuite(MavenITmng3297DependenciesNotLeakedToMojoTest.class); + suite.addTestSuite(MavenITmng3288SystemScopeDirTest.class); + suite.addTestSuite(MavenITmng3284UsingCachedPluginsTest.class); + suite.addTestSuite(MavenITmng3268MultipleHyphenPCommandLineTest.class); + suite.addTestSuite(MavenITmng3259DepsDroppedInMultiModuleBuildTest.class); + suite.addTestSuite(MavenITmng3220ImportScopeTest.class); + suite.addTestSuite(MavenITmng3217InterPluginDependencyTest.class); + suite.addTestSuite(MavenITmng3208ProfileAwareReactorSortingTest.class); + suite.addTestSuite(MavenITmng3203DefaultLifecycleExecIdTest.class); + suite.addTestSuite(MavenITmng3183LoggingToFileTest.class); + suite.addTestSuite(MavenITmng3139UseCachedMetadataOfBlacklistedRepoTest.class); + suite.addTestSuite(MavenITmng3133UrlNormalizationNotBeforeInterpolationTest.class); + suite.addTestSuite(MavenITmng3122ActiveProfilesNoDuplicatesTest.class); + suite.addTestSuite(MavenITmng3118TestClassPathOrderTest.class); + suite.addTestSuite(MavenITmng3099SettingsProfilesWithNoPomTest.class); + suite.addTestSuite(MavenITmng3052DepRepoAggregationTest.class); + suite.addTestSuite(MavenITmng3043BestEffortReactorResolutionTest.class); + suite.addTestSuite(MavenITmng3023ReactorDependencyResolutionTest.class); + suite.addTestSuite(MavenITmng3012CoreClassImportTest.class); + suite.addTestSuite(MavenITmng3004ReactorFailureBehaviorMultithreadedTest.class); + suite.addTestSuite(MavenITmng2994SnapshotRangeRepositoryTest.class); + suite.addTestSuite(MavenITmng2972OverridePluginDependencyTest.class); + suite.addTestSuite(MavenITmng2926PluginPrefixOrderTest.class); + suite.addTestSuite(MavenITmng2921ActiveAttachedArtifactsTest.class); + suite.addTestSuite(MavenITmng2892HideCorePlexusUtilsTest.class); + suite.addTestSuite(MavenITmng2871PrePackageSubartifactResolutionTest.class); + suite.addTestSuite(MavenITmng2865MirrorWildcardTest.class); + suite.addTestSuite(MavenITmng2861RelocationsAndRangesTest.class); + suite.addTestSuite(MavenITmng2848ProfileActivationByEnvironmentVariableTest.class); + suite.addTestSuite(MavenITmng2843PluginConfigPropertiesInjectionTest.class); + suite.addTestSuite(MavenITmng2831CustomArtifactHandlerAndCustomLifecycleTest.class); + suite.addTestSuite(MavenITmng2820PomCommentsTest.class); + suite.addTestSuite(MavenITmng2790LastUpdatedMetadataTest.class); + suite.addTestSuite(MavenITmng2749ExtensionAvailableToPluginTest.class); + suite.addTestSuite(MavenITmng2744checksumVerificationTest.class); + suite.addTestSuite(MavenITmng2741PluginMetadataResolutionErrorMessageTest.class); + suite.addTestSuite(MavenITmng2739RequiredRepositoryElementsTest.class); + suite.addTestSuite(MavenITmng2738ProfileIdCollidesWithCliOptionTest.class); + suite.addTestSuite(MavenITmng2720SiblingClasspathArtifactsTest.class); + suite.addTestSuite(MavenITmng2695OfflinePluginSnapshotsTest.class); + suite.addTestSuite(MavenITmng2693SitePluginRealmTest.class); + suite.addTestSuite(MavenITmng2690MojoLoadingErrorsTest.class); + suite.addTestSuite(MavenITmng2668UsePluginDependenciesForSortingTest.class); + suite.addTestSuite(MavenITmng2605BogusProfileActivationTest.class); + suite.addTestSuite(MavenITmng2591MergeInheritedPluginConfigTest.class); + suite.addTestSuite(MavenITmng2577SettingsXmlInterpolationTest.class); + suite.addTestSuite(MavenITmng2576MakeLikeReactorTest.class); + suite.addTestSuite(MavenITmng2562Timestamp322Test.class); + suite.addTestSuite(MavenITmng2486TimestampedDependencyVersionInterpolationTest.class); + suite.addTestSuite(MavenITmng2432PluginPrefixOrderTest.class); + suite.addTestSuite(MavenITmng2387InactiveProxyTest.class); + suite.addTestSuite(MavenITmng2363BasedirAwareFileActivatorTest.class); + suite.addTestSuite(MavenITmng2362DeployedPomEncodingTest.class); + suite.addTestSuite(MavenITmng2339BadProjectInterpolationTest.class); + suite.addTestSuite(MavenITmng2318LocalParentResolutionTest.class); + suite.addTestSuite(MavenITmng2309ProfileInjectionOrderTest.class); + suite.addTestSuite(MavenITmng2305MultipleProxiesTest.class); + suite.addTestSuite(MavenITmng2277AggregatorAndResolutionPluginsTest.class); + suite.addTestSuite(MavenITmng2276ProfileActivationBySettingsPropertyTest.class); + suite.addTestSuite(MavenITmng2254PomEncodingTest.class); + suite.addTestSuite(MavenITmng2234ActiveProfilesFromSettingsTest.class); + suite.addTestSuite(MavenITmng2228ComponentInjectionTest.class); + suite.addTestSuite(MavenITmng2222OutputDirectoryReactorResolutionTest.class); + suite.addTestSuite(MavenITmng2201PluginConfigInterpolationTest.class); + suite.addTestSuite(MavenITmng2199ParentVersionRangeTest.class); + suite.addTestSuite(MavenITmng2196ParentResolutionTest.class); + suite.addTestSuite(MavenITmng2174PluginDepsManagedByParentProfileTest.class); + suite.addTestSuite(MavenITmng2140ReactorAwareDepResolutionWhenForkTest.class); + suite.addTestSuite(MavenITmng2136ActiveByDefaultProfileTest.class); + suite.addTestSuite(MavenITmng2135PluginBuildInReactorTest.class); + suite.addTestSuite(MavenITmng2130ParentLookupFromReactorCacheTest.class); + suite.addTestSuite(MavenITmng2124PomInterpolationWithParentValuesTest.class); + suite.addTestSuite(MavenITmng2123VersionRangeDependencyTest.class); + suite.addTestSuite(MavenITmng2103PluginExecutionInheritanceTest.class); + suite.addTestSuite(MavenITmng2098VersionRangeSatisfiedFromWrongRepoTest.class); + suite.addTestSuite(MavenITmng2068ReactorRelativeParentsTest.class); + suite.addTestSuite(MavenITmng2054PluginExecutionInheritanceTest.class); + suite.addTestSuite(MavenITmng2052InterpolateWithSettingsProfilePropertiesTest.class); + suite.addTestSuite(MavenITmng2045testJarDependenciesBrokenInReactorTest.class); + suite.addTestSuite(MavenITmng2006ChildPathAwareUrlInheritanceTest.class); + suite.addTestSuite(MavenITmng1995InterpolateBooleanModelElementsTest.class); + suite.addTestSuite(MavenITmng1992SystemPropOverridesPomPropTest.class); + suite.addTestSuite(MavenITmng1957JdkActivationWithVersionRangeTest.class); + suite.addTestSuite(MavenITmng1895ScopeConflictResolutionTest.class); + suite.addTestSuite(MavenITmng1803PomValidationErrorIncludesLineNumberTest.class); + suite.addTestSuite(MavenITmng1751ForcedMetadataUpdateDuringDeploymentTest.class); + suite.addTestSuite(MavenITmng1703PluginMgmtDepInheritanceTest.class); + suite.addTestSuite(MavenITmng1701DuplicatePluginTest.class); + suite.addTestSuite(MavenITmng1493NonStandardModulePomNamesTest.class); + suite.addTestSuite(MavenITmng1491ReactorArtifactIdCollisionTest.class); + suite.addTestSuite(MavenITmng1415QuotedSystemPropertiesTest.class); + suite.addTestSuite(MavenITmng1412DependenciesOrderTest.class); + suite.addTestSuite(MavenITmng1349ChecksumFormatsTest.class); + suite.addTestSuite(MavenITmng1323AntrunDependenciesTest.class); + suite.addTestSuite(MavenITmng1233WarDepWithProvidedScopeTest.class); + suite.addTestSuite(MavenITmng1144MultipleDefaultGoalsTest.class); + suite.addTestSuite(MavenITmng1142VersionRangeIntersectionTest.class); + suite.addTestSuite(MavenITmng1088ReactorPluginResolutionTest.class); + suite.addTestSuite(MavenITmng1073AggregatorForksReactorTest.class); + suite.addTestSuite(MavenITmng1052PluginMgmtConfigTest.class); + suite.addTestSuite(MavenITmng1021EqualAttachmentBuildNumberTest.class); + suite.addTestSuite(MavenITmng0985NonExecutedPluginMgmtGoalsTest.class); + suite.addTestSuite(MavenITmng0956ComponentInjectionViaProjectLevelPluginDepTest.class); + suite.addTestSuite(MavenITmng0947OptionalDependencyTest.class); + suite.addTestSuite(MavenITmng0870ReactorAwarePluginDiscoveryTest.class); + suite.addTestSuite(MavenITmng0866EvaluateDefaultValueTest.class); + suite.addTestSuite(MavenITmng0848UserPropertyOverridesDefaultValueTest.class); + suite.addTestSuite(MavenITmng0836PluginParentResolutionTest.class); + suite.addTestSuite(MavenITmng0828PluginConfigValuesInDebugTest.class); + suite.addTestSuite(MavenITmng0823MojoContextPassingTest.class); + suite.addTestSuite(MavenITmng0820ConflictResolutionTest.class); + suite.addTestSuite(MavenITmng0818WarDepsNotTransitiveTest.class); + suite.addTestSuite(MavenITmng0814ExplicitProfileActivationTest.class); + suite.addTestSuite(MavenITmng0786ProfileAwareReactorTest.class); + suite.addTestSuite(MavenITmng0781PluginConfigVsExecConfigTest.class); + suite.addTestSuite(MavenITmng0773SettingsProfileReactorPollutionTest.class); + suite.addTestSuite(MavenITmng0768OfflineModeTest.class); + suite.addTestSuite(MavenITmng0761MissingSnapshotDistRepoTest.class); + suite.addTestSuite(MavenITmng0680ParentBasedirTest.class); + suite.addTestSuite(MavenITmng0674PluginParameterAliasTest.class); + suite.addTestSuite(MavenITmng0666IgnoreLegacyPomTest.class); + suite.addTestSuite(MavenITmng0557UserSettingsCliOptionTest.class); + suite.addTestSuite(MavenITmng0553SettingsAuthzEncryptionTest.class); + suite.addTestSuite(MavenITmng0522InheritedPluginMgmtConfigTest.class); + suite.addTestSuite(MavenITmng0507ArtifactRelocationTest.class); + suite.addTestSuite(MavenITmng0505VersionRangeTest.class); + suite.addTestSuite(MavenITmng0496IgnoreUnknownPluginParametersTest.class); + suite.addTestSuite(MavenITmng0479OverrideCentralRepoTest.class); + suite.addTestSuite(MavenITmng0471CustomLifecycleTest.class); + suite.addTestSuite(MavenITmng0469ReportConfigTest.class); + suite.addTestSuite(MavenITmng0461TolerateMissingDependencyPomTest.class); + suite.addTestSuite(MavenITmng0449PluginVersionResolutionTest.class); + suite.addTestSuite(MavenITmng0377PluginLookupFromPrefixTest.class); + suite.addTestSuite(MavenITmng0294MergeGlobalAndUserSettingsTest.class); + suite.addTestSuite(MavenITmng0282NonReactorExecWhenProjectIndependentTest.class); + suite.addTestSuite(MavenITmng0249ResolveDepsFromReactorTest.class); + suite.addTestSuite(MavenITmng0187CollectedProjectsTest.class); + suite.addTestSuite(MavenITmng0095ReactorFailureBehaviorTest.class); + suite.addTestSuite(MavenIT0199CyclicImportScopeTest.class); + suite.addTestSuite(MavenIT0146InstallerSnapshotNaming.class); + suite.addTestSuite(MavenIT0144LifecycleExecutionOrderTest.class); + suite.addTestSuite(MavenIT0143TransitiveDependencyScopesTest.class); + suite.addTestSuite(MavenIT0142DirectDependencyScopesTest.class); + suite.addTestSuite(MavenIT0140InterpolationWithPomPrefixTest.class); + suite.addTestSuite(MavenIT0139InterpolationWithProjectPrefixTest.class); + suite.addTestSuite(MavenIT0138PluginLifecycleTest.class); + suite.addTestSuite(MavenIT0137EarLifecycleTest.class); + suite.addTestSuite(MavenIT0136RarLifecycleTest.class); + suite.addTestSuite(MavenIT0135EjbLifecycleTest.class); + suite.addTestSuite(MavenIT0134WarLifecycleTest.class); + suite.addTestSuite(MavenIT0133JarLifecycleTest.class); + suite.addTestSuite(MavenIT0132PomLifecycleTest.class); + suite.addTestSuite(MavenIT0131SiteLifecycleTest.class); + suite.addTestSuite(MavenIT0130CleanLifecycleTest.class); + suite.addTestSuite(MavenIT0113ServerAuthzAvailableToWagonMgrInPluginTest.class); + suite.addTestSuite(MavenIT0090EnvVarInterpolationTest.class); + suite.addTestSuite(MavenIT0087PluginRealmWithProjectLevelDepsTest.class); + suite.addTestSuite(MavenIT0086PluginRealmTest.class); + suite.addTestSuite(MavenIT0085TransitiveSystemScopeTest.class); + suite.addTestSuite(MavenIT0072InterpolationWithDottedPropertyTest.class); + suite.addTestSuite(MavenIT0071PluginConfigWithDottedPropertyTest.class); + suite.addTestSuite(MavenIT0064MojoConfigViaSettersTest.class); + suite.addTestSuite(MavenIT0063SystemScopeDependencyTest.class); + suite.addTestSuite(MavenIT0056MultipleGoalExecutionsTest.class); + suite.addTestSuite(MavenIT0052ReleaseProfileTest.class); + suite.addTestSuite(MavenIT0051ReleaseProfileTest.class); + suite.addTestSuite(MavenIT0041ArtifactTypeFromPluginExtensionTest.class); + suite.addTestSuite(MavenIT0040PackagingFromPluginExtensionTest.class); + suite.addTestSuite(MavenIT0038AlternatePomFileDifferentDirTest.class); + suite.addTestSuite(MavenIT0037AlternatePomFileSameDirTest.class); + suite.addTestSuite(MavenIT0032MavenPrerequisiteTest.class); + suite.addTestSuite(MavenIT0030DepPomDepMgmtInheritanceTest.class); + suite.addTestSuite(MavenIT0025MultipleExecutionLevelConfigsTest.class); + suite.addTestSuite(MavenIT0024MultipleGoalExecutionsTest.class); + suite.addTestSuite(MavenIT0023SettingsProfileTest.class); + suite.addTestSuite(MavenIT0021PomProfileTest.class); + suite.addTestSuite(MavenIT0019PluginVersionMgmtBySuperPomTest.class); + suite.addTestSuite(MavenIT0018DependencyManagementTest.class); + suite.addTestSuite(MavenIT0012PomInterpolationTest.class); + suite.addTestSuite(MavenIT0011DefaultVersionByDependencyManagementTest.class); + suite.addTestSuite(MavenIT0010DependencyClosureResolutionTest.class); + suite.addTestSuite(MavenIT0009GoalConfigurationTest.class); + suite.addTestSuite(MavenIT0008SimplePluginTest.class); /* * Add tests in reverse alpha order above. */ } - void addTestSuite( Class clazz ) - { - addTestSuite( clazz, tests.size() ); + void addTestSuite(Class clazz) { + addTestSuite(clazz, tests.size()); } - void addTestSuite( Class clazz, int order ) - { - tests.put( clazz, order ); + void addTestSuite(Class clazz, int order) { + tests.put(clazz, order); } - int getIndex( ClassDescriptor cd ) - { - Integer i = tests.get( cd.getTestClass() ); + int getIndex(ClassDescriptor cd) { + Integer i = tests.get(cd.getTestClass()); return i != null ? i : -1; } - public void orderClasses( ClassOrdererContext context ) - { + public void orderClasses(ClassOrdererContext context) { context.getClassDescriptors().stream() - .filter( cd -> !MISSED_TESTS.contains( cd.getTestClass() ) ) - .filter( cd -> getIndex( cd ) == -1 ) - .filter( cd -> cd.findRepeatableAnnotations( Tag.class ).stream() - .noneMatch( t -> "disabled".equals( t.value() ) ) ) - .forEach( cd -> { - out.println( "Test " + cd.getTestClass() - + " is not present in TestSuiteOrdering " + System.lineSeparator() - + "\t- please add it or annotate with @Tag(\"disabled\")" + System.lineSeparator() ); - MISSED_TESTS.add( cd.getTestClass() ); - } ); + .filter(cd -> !MISSED_TESTS.contains(cd.getTestClass())) + .filter(cd -> getIndex(cd) == -1) + .filter(cd -> + cd.findRepeatableAnnotations(Tag.class).stream().noneMatch(t -> "disabled".equals(t.value()))) + .forEach(cd -> { + out.println("Test " + cd.getTestClass() + + " is not present in TestSuiteOrdering " + System.lineSeparator() + + "\t- please add it or annotate with @Tag(\"disabled\")" + System.lineSeparator()); + MISSED_TESTS.add(cd.getTestClass()); + }); - context.getClassDescriptors().sort( Comparator.comparing( this::getIndex ) ); + context.getClassDescriptors().sort(Comparator.comparing(this::getIndex)); } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/TunnelingProxyServer.java b/its/core-it-suite/src/test/java/org/apache/maven/it/TunnelingProxyServer.java index 0a3538fa02..d431665da2 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/TunnelingProxyServer.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/TunnelingProxyServer.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,8 +16,8 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.it; -import org.junit.jupiter.api.Test; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; @@ -34,9 +32,7 @@ import java.util.regex.Pattern; * * @author Benjamin Bentmann */ -public class TunnelingProxyServer - implements Runnable -{ +public class TunnelingProxyServer implements Runnable { private int port; @@ -48,211 +44,152 @@ public class TunnelingProxyServer private String connectFilter; - public TunnelingProxyServer( int port, String targetHost, int targetPort, String connectFilter ) - { + public TunnelingProxyServer(int port, String targetHost, int targetPort, String connectFilter) { this.port = port; this.targetHost = targetHost; this.targetPort = targetPort; this.connectFilter = connectFilter; } - public int getPort() - { - return ( server != null ) ? server.getLocalPort() : port; + public int getPort() { + return (server != null) ? server.getLocalPort() : port; } - public void start() - throws IOException - { - server = new ServerSocket( port, 4 ); - new Thread( this ).start(); + public void start() throws IOException { + server = new ServerSocket(port, 4); + new Thread(this).start(); } - public void stop() - throws IOException - { - if ( server != null ) - { + public void stop() throws IOException { + if (server != null) { server.close(); server = null; } } - public void run() - { - try - { - while ( true ) - { - new ClientHandler( server.accept() ).start(); + public void run() { + try { + while (true) { + new ClientHandler(server.accept()).start(); } - } - catch ( Exception e ) - { + } catch (Exception e) { // closed } } - class ClientHandler - extends Thread - { + class ClientHandler extends Thread { private Socket client; - public ClientHandler( Socket client ) - { + public ClientHandler(Socket client) { this.client = client; } - public void run() - { - try - { - PushbackInputStream is = new PushbackInputStream( client.getInputStream() ); + public void run() { + try { + PushbackInputStream is = new PushbackInputStream(client.getInputStream()); String dest = null; - while ( true ) - { - String line = readLine( is ); - if ( line == null || line.length() <= 0 ) - { + while (true) { + String line = readLine(is); + if (line == null || line.length() <= 0) { break; } - Matcher m = Pattern.compile( "CONNECT +([^:]+:[0-9]+) +.*" ).matcher( line ); - if ( m.matches() ) - { - dest = m.group( 1 ); + Matcher m = Pattern.compile("CONNECT +([^:]+:[0-9]+) +.*").matcher(line); + if (m.matches()) { + dest = m.group(1); } } OutputStream os = client.getOutputStream(); - if ( dest == null || ( connectFilter != null && !dest.matches( connectFilter ) ) ) - { - os.write( ( "HTTP/1.0 400 Bad request for " + dest + "\r\n\r\n" ).getBytes( "UTF-8" ) ); + if (dest == null || (connectFilter != null && !dest.matches(connectFilter))) { + os.write(("HTTP/1.0 400 Bad request for " + dest + "\r\n\r\n").getBytes("UTF-8")); return; } - os.write( "HTTP/1.0 200 Connection established\r\n\r\n".getBytes( "UTF-8" ) ); + os.write("HTTP/1.0 200 Connection established\r\n\r\n".getBytes("UTF-8")); - Socket server = new Socket( targetHost, targetPort ); + Socket server = new Socket(targetHost, targetPort); - Thread t1 = new StreamPumper( is, server.getOutputStream() ); + Thread t1 = new StreamPumper(is, server.getOutputStream()); t1.start(); - Thread t2 = new StreamPumper( server.getInputStream(), os ); + Thread t2 = new StreamPumper(server.getInputStream(), os); t2.start(); t1.join(); t2.join(); server.close(); - } - catch ( Exception e ) - { + } catch (Exception e) { e.printStackTrace(); - } - finally - { - try - { + } finally { + try { client.close(); - } - catch ( IOException e ) - { + } catch (IOException e) { e.printStackTrace(); } } } - private String readLine( PushbackInputStream is ) - throws IOException - { - StringBuilder buffer = new StringBuilder( 1024 ); + private String readLine(PushbackInputStream is) throws IOException { + StringBuilder buffer = new StringBuilder(1024); - while ( true ) - { + while (true) { int b = is.read(); - if ( b < 0 ) - { + if (b < 0) { return null; - } - else if ( b == '\n' ) - { + } else if (b == '\n') { break; - } - else if ( b == '\r' ) - { + } else if (b == '\r') { b = is.read(); - if ( b != '\n' ) - { - is.unread( b ); + if (b != '\n') { + is.unread(b); } break; - } - else - { - buffer.append( (char) b ); + } else { + buffer.append((char) b); } } return buffer.toString(); } - } - static class StreamPumper - extends Thread - { + static class StreamPumper extends Thread { private final InputStream is; private final OutputStream os; - public StreamPumper( InputStream is, OutputStream os ) - { + public StreamPumper(InputStream is, OutputStream os) { this.is = is; this.os = os; } - public void run() - { - try - { - for ( byte[] buffer = new byte[1024 * 8]; ; ) - { - int n = is.read( buffer ); - if ( n < 0 ) - { + public void run() { + try { + for (byte[] buffer = new byte[1024 * 8]; ; ) { + int n = is.read(buffer); + if (n < 0) { break; } - os.write( buffer, 0, n ); + os.write(buffer, 0, n); } - } - catch ( IOException e ) - { + } catch (IOException e) { // closed - } - finally - { - try - { + } finally { + try { is.close(); - } - catch ( IOException e ) - { + } catch (IOException e) { e.printStackTrace(); } - try - { + try { os.close(); - } - catch ( IOException e ) - { + } catch (IOException e) { e.printStackTrace(); } } } - } - } diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/utils/DeployedResource.java b/its/core-it-suite/src/test/java/org/apache/maven/it/utils/DeployedResource.java index 7fcc84d179..29bd070064 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/utils/DeployedResource.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/utils/DeployedResource.java @@ -1,3 +1,21 @@ +/* + * 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.it.utils; /* * Licensed to the Apache Software Foundation (ASF) under one @@ -21,8 +39,7 @@ package org.apache.maven.it.utils; /** * @author Olivier Lamy */ -public class DeployedResource -{ +public class DeployedResource { public String httpMethod; public String requestUri; @@ -31,21 +48,19 @@ public class DeployedResource public String transferEncoding; - public DeployedResource() - { + public DeployedResource() { // no op } @Override - public String toString() - { + public String toString() { final StringBuilder sb = new StringBuilder(); - sb.append( "DeployedResource" ); - sb.append( "{httpMethod='" ).append( httpMethod ).append( '\'' ); - sb.append( ", requestUri='" ).append( requestUri ).append( '\'' ); - sb.append( ", contentLength='" ).append( contentLength ).append( '\'' ); - sb.append( ", transferEncoding='" ).append( transferEncoding ).append( '\'' ); - sb.append( '}' ); + sb.append("DeployedResource"); + sb.append("{httpMethod='").append(httpMethod).append('\''); + sb.append(", requestUri='").append(requestUri).append('\''); + sb.append(", contentLength='").append(contentLength).append('\''); + sb.append(", transferEncoding='").append(transferEncoding).append('\''); + sb.append('}'); return sb.toString(); } } diff --git a/its/core-it-support/core-it-component/pom.xml b/its/core-it-support/core-it-component/pom.xml index 05bd448222..fb44f9dbb2 100644 --- a/its/core-it-support/core-it-component/pom.xml +++ b/its/core-it-support/core-it-component/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 diff --git a/its/core-it-support/core-it-component/src/main/java/org/apache/maven/coreit/component/DefaultStatefulSingleton.java b/its/core-it-support/core-it-component/src/main/java/org/apache/maven/coreit/component/DefaultStatefulSingleton.java index 92840118df..cbafdce7cb 100644 --- a/its/core-it-support/core-it-component/src/main/java/org/apache/maven/coreit/component/DefaultStatefulSingleton.java +++ b/its/core-it-support/core-it-component/src/main/java/org/apache/maven/coreit/component/DefaultStatefulSingleton.java @@ -1,5 +1,3 @@ -package org.apache.maven.coreit.component; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.coreit.component; * "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 + * 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 @@ -18,6 +16,7 @@ package org.apache.maven.coreit.component; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.coreit.component; import java.io.File; import java.io.FileOutputStream; @@ -27,31 +26,23 @@ import java.util.Properties; /** * */ -public class DefaultStatefulSingleton - implements StatefulSingleton -{ +public class DefaultStatefulSingleton implements StatefulSingleton { private Properties properties = new Properties(); - public String getProperty( String key ) - { - return properties.getProperty( key ); + public String getProperty(String key) { + return properties.getProperty(key); } - public void setProperty( String key, String value ) - { - properties.setProperty( key, value ); + public void setProperty(String key, String value) { + properties.setProperty(key, value); } - public void saveProperties( File propertiesFile ) - throws IOException - { + public void saveProperties(File propertiesFile) throws IOException { propertiesFile.getParentFile().mkdirs(); - try ( FileOutputStream os = new FileOutputStream( propertiesFile ) ) - { - properties.store( os, "MAVEN-CORE-IT" ); + try (FileOutputStream os = new FileOutputStream(propertiesFile)) { + properties.store(os, "MAVEN-CORE-IT"); } } - } diff --git a/its/core-it-support/core-it-component/src/main/java/org/apache/maven/coreit/component/StatefulSingleton.java b/its/core-it-support/core-it-component/src/main/java/org/apache/maven/coreit/component/StatefulSingleton.java index c8bdd68ba2..6cac778a28 100644 --- a/its/core-it-support/core-it-component/src/main/java/org/apache/maven/coreit/component/StatefulSingleton.java +++ b/its/core-it-support/core-it-component/src/main/java/org/apache/maven/coreit/component/StatefulSingleton.java @@ -1,5 +1,3 @@ -package org.apache.maven.coreit.component; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.coreit.component; * "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 + * 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 @@ -18,6 +16,7 @@ package org.apache.maven.coreit.component; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.coreit.component; import java.io.File; import java.io.IOException; @@ -25,14 +24,11 @@ import java.io.IOException; /** * */ -public interface StatefulSingleton -{ +public interface StatefulSingleton { - void setProperty( String key, String value ); + void setProperty(String key, String value); - String getProperty( String key ); - - void saveProperties( File propertiesFile ) - throws IOException; + String getProperty(String key); + void saveProperties(File propertiesFile) throws IOException; } diff --git a/its/core-it-support/core-it-extension/pom.xml b/its/core-it-support/core-it-extension/pom.xml index 87a7acc237..9ef88a742e 100644 --- a/its/core-it-support/core-it-extension/pom.xml +++ b/its/core-it-support/core-it-extension/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 diff --git a/its/core-it-support/core-it-javaagent/pom.xml b/its/core-it-support/core-it-javaagent/pom.xml index 303487a161..6822fdde66 100644 --- a/its/core-it-support/core-it-javaagent/pom.xml +++ b/its/core-it-support/core-it-javaagent/pom.xml @@ -1,5 +1,4 @@ - - + 4.0.0 org.apache.maven.its @@ -30,6 +27,24 @@ under the License. core-it-javaagent 2.1-SNAPSHOT + + + org.ow2.asm + asm + 7.3.1 + + + org.ow2.asm + asm-commons + 7.3.1 + + + org.ow2.asm + asm-util + 7.3.1 + + + @@ -69,22 +84,4 @@ under the License. - - - - org.ow2.asm - asm - 7.3.1 - - - org.ow2.asm - asm-commons - 7.3.1 - - - org.ow2.asm - asm-util - 7.3.1 - - - \ No newline at end of file + diff --git a/its/core-it-support/core-it-javaagent/src/main/java/org/apache/maven/coreits/javaagent/mng5669/Premain.java b/its/core-it-support/core-it-javaagent/src/main/java/org/apache/maven/coreits/javaagent/mng5669/Premain.java index 4307e0c820..7f53da774f 100644 --- a/its/core-it-support/core-it-javaagent/src/main/java/org/apache/maven/coreits/javaagent/mng5669/Premain.java +++ b/its/core-it-support/core-it-javaagent/src/main/java/org/apache/maven/coreits/javaagent/mng5669/Premain.java @@ -1,5 +1,3 @@ -package org.apache.maven.coreits.javaagent.mng5669; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.coreits.javaagent.mng5669; * "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 + * 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 @@ -18,6 +16,7 @@ package org.apache.maven.coreits.javaagent.mng5669; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.coreits.javaagent.mng5669; import java.lang.instrument.ClassFileTransformer; import java.lang.instrument.IllegalClassFormatException; @@ -36,74 +35,60 @@ import org.objectweb.asm.commons.AdviceAdapter; * @author Robert Scholte * */ -public class Premain -{ - public static void premain( String agentArgs, Instrumentation inst ) - { - inst.addTransformer( new ClassFileTransformer() - { +public class Premain { + public static void premain(String agentArgs, Instrumentation inst) { + inst.addTransformer(new ClassFileTransformer() { - public byte[] transform( ClassLoader loader, String className, Class classBeingRedefined, - ProtectionDomain protectionDomain, byte[] classfileBuffer ) - throws IllegalClassFormatException - { - if ( "org/apache/maven/model/io/DefaultModelReader".equals( className ) ) - { - ClassReader r = new ClassReader( classfileBuffer ); - final ClassWriter w = new ClassWriter( Opcodes.ASM6 ); + public byte[] transform( + ClassLoader loader, + String className, + Class classBeingRedefined, + ProtectionDomain protectionDomain, + byte[] classfileBuffer) + throws IllegalClassFormatException { + if ("org/apache/maven/model/io/DefaultModelReader".equals(className)) { + ClassReader r = new ClassReader(classfileBuffer); + final ClassWriter w = new ClassWriter(Opcodes.ASM6); - ClassVisitor v = new DefaultModelReaderVisitor( Opcodes.ASM6, w ); + ClassVisitor v = new DefaultModelReaderVisitor(Opcodes.ASM6, w); - r.accept( v, ClassReader.EXPAND_FRAMES ); + r.accept(v, ClassReader.EXPAND_FRAMES); return w.toByteArray(); - } - else - { + } else { return classfileBuffer; } } - } ); + }); } - private static class DefaultModelReaderVisitor - extends ClassVisitor - { - DefaultModelReaderVisitor( int api, org.objectweb.asm.ClassVisitor cv ) - { - super( api, cv ); + private static class DefaultModelReaderVisitor extends ClassVisitor { + DefaultModelReaderVisitor(int api, org.objectweb.asm.ClassVisitor cv) { + super(api, cv); } @Override - public MethodVisitor visitMethod( int access, String name, String desc, String signature, String[] exceptions ) - { - MethodVisitor mv = cv.visitMethod( access, name, desc, signature, exceptions ); - if ( "getSource".equals( name ) ) - { - return new GetSourceMethodAdvice( Opcodes.ASM6, mv, access, name, desc ); - } - else - { + public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { + MethodVisitor mv = cv.visitMethod(access, name, desc, signature, exceptions); + if ("getSource".equals(name)) { + return new GetSourceMethodAdvice(Opcodes.ASM6, mv, access, name, desc); + } else { return mv; } } } // org.apache.maven.model.io.DefaultModelReader.getSource(Map) - private static class GetSourceMethodAdvice - extends AdviceAdapter - { - GetSourceMethodAdvice( int api, MethodVisitor mv, int access, String name, String desc ) - { - super( api, mv, access, name, desc ); + private static class GetSourceMethodAdvice extends AdviceAdapter { + GetSourceMethodAdvice(int api, MethodVisitor mv, int access, String name, String desc) { + super(api, mv, access, name, desc); } @Override - protected void onMethodEnter() - { + protected void onMethodEnter() { // System.out.println( options ), - mv.visitFieldInsn( GETSTATIC, "java/lang/System", "out", "Ljava/io/PrintStream;" ); - mv.visitVarInsn( ALOAD, 1 ); - mv.visitMethodInsn( INVOKEVIRTUAL, "java/io/PrintStream", "println", "(Ljava/lang/Object;)V", false ); + mv.visitFieldInsn(GETSTATIC, "java/lang/System", "out", "Ljava/io/PrintStream;"); + mv.visitVarInsn(ALOAD, 1); + mv.visitMethodInsn(INVOKEVIRTUAL, "java/io/PrintStream", "println", "(Ljava/lang/Object;)V", false); } } } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-active-collection/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-active-collection/pom.xml index e8e0913c79..4e3e868d6e 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-active-collection/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-active-collection/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 - maven-it-plugins org.apache.maven.its.plugins + maven-it-plugins 2.1-SNAPSHOT @@ -32,9 +30,7 @@ under the License. maven-plugin Maven IT Plugin :: Active Collection - - A test plugin that depends on active collections of core components. - + A test plugin that depends on active collections of core components. 2009 diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-active-collection/src/main/java/org/apache/maven/plugin/coreit/CheckMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-active-collection/src/main/java/org/apache/maven/plugin/coreit/CheckMojo.java index dbc0e2c9f0..aa0e9325d7 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-active-collection/src/main/java/org/apache/maven/plugin/coreit/CheckMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-active-collection/src/main/java/org/apache/maven/plugin/coreit/CheckMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; -import org.apache.maven.plugins.annotations.Component; -import org.apache.maven.plugins.annotations.LifecyclePhase; -import org.apache.maven.plugins.annotations.Mojo; -import org.apache.maven.plugins.annotations.Parameter; +package org.apache.maven.plugin.coreit; import java.io.File; import java.io.FileOutputStream; @@ -36,20 +27,26 @@ import java.util.List; import java.util.Map; import java.util.Properties; +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.Component; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; + /** * Checks the general retrieval of components from active component collections. * * @author Benjamin Bentmann */ -@Mojo( name = "check", defaultPhase = LifecyclePhase.VALIDATE ) -public class CheckMojo - extends AbstractMojo -{ +@Mojo(name = "check", defaultPhase = LifecyclePhase.VALIDATE) +public class CheckMojo extends AbstractMojo { /** * Project base directory used for manual path alignment. */ - @Parameter( defaultValue = "${basedir}", readonly = true ) + @Parameter(defaultValue = "${basedir}", readonly = true) private File basedir; /** @@ -67,7 +64,7 @@ public class CheckMojo /** * The path to the properties file to create. */ - @Parameter( property = "clsldr.pluginClassLoaderOutput" ) + @Parameter(property = "clsldr.pluginClassLoaderOutput") private File outputFile; /** @@ -75,87 +72,68 @@ public class CheckMojo * * @throws MojoFailureException If the output file could not be created. */ - public void execute() - throws MojoExecutionException, MojoFailureException - { + public void execute() throws MojoExecutionException, MojoFailureException { Properties componentProperties = new Properties(); - getLog().info( "[MAVEN-CORE-IT-LOG] Dumping component info" ); + getLog().info("[MAVEN-CORE-IT-LOG] Dumping component info"); - componentProperties.setProperty( "count", Integer.toString( componentList.size() ) ); + componentProperties.setProperty("count", Integer.toString(componentList.size())); - if ( componentList.size() != componentMap.size() ) - { - throw new MojoExecutionException( "Inconsistent collection: " + componentList + " vs " + componentMap ); + if (componentList.size() != componentMap.size()) { + throw new MojoExecutionException("Inconsistent collection: " + componentList + " vs " + componentMap); } - for ( int i = componentList.size() - 1; i >= 0; i-- ) - { - Object component = componentList.get( i ); + for (int i = componentList.size() - 1; i >= 0; i--) { + Object component = componentList.get(i); - if ( component != componentList.get( i ) ) - { - throw new MojoExecutionException( "Invalid re-lookup of component from list: " + i ); + if (component != componentList.get(i)) { + throw new MojoExecutionException("Invalid re-lookup of component from list: " + i); } } int i = 0; - for ( Iterator it = componentMap.keySet().iterator(); it.hasNext(); i++ ) - { + for (Iterator it = componentMap.keySet().iterator(); it.hasNext(); i++) { String roleHint = (String) it.next(); - componentProperties.setProperty( "component." + i + ".hint", roleHint ); + componentProperties.setProperty("component." + i + ".hint", roleHint); - Object component = componentMap.get( roleHint ); + Object component = componentMap.get(roleHint); - if ( component != null ) - { - String hash = Integer.toString( System.identityHashCode( component ) ); - componentProperties.setProperty( "component." + i + ".hash", hash ); - componentProperties.setProperty( "component." + roleHint + ".hash", hash ); + if (component != null) { + String hash = Integer.toString(System.identityHashCode(component)); + componentProperties.setProperty("component." + i + ".hash", hash); + componentProperties.setProperty("component." + roleHint + ".hash", hash); } - if ( component != componentMap.get( roleHint ) ) - { - throw new MojoExecutionException( "Invalid re-lookup of component from map: " + roleHint ); + if (component != componentMap.get(roleHint)) { + throw new MojoExecutionException("Invalid re-lookup of component from map: " + roleHint); } - getLog().info( "[MAVEN-CORE-IT-LOG] " + roleHint + " = " + component ); + getLog().info("[MAVEN-CORE-IT-LOG] " + roleHint + " = " + component); } - if ( !outputFile.isAbsolute() ) - { - outputFile = new File( basedir, outputFile.getPath() ); + if (!outputFile.isAbsolute()) { + outputFile = new File(basedir, outputFile.getPath()); } - getLog().info( "[MAVEN-CORE-IT-LOG] Creating output file " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Creating output file " + outputFile); OutputStream out = null; - try - { + try { outputFile.getParentFile().mkdirs(); - out = new FileOutputStream( outputFile ); - componentProperties.store( out, "MAVEN-CORE-IT-LOG" ); - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Output file could not be created: " + outputFile, e ); - } - finally - { - if ( out != null ) - { - try - { + out = new FileOutputStream(outputFile); + componentProperties.store(out, "MAVEN-CORE-IT-LOG"); + } catch (IOException e) { + throw new MojoExecutionException("Output file could not be created: " + outputFile, e); + } finally { + if (out != null) { + try { out.close(); - } - catch ( IOException e ) - { + } catch (IOException e) { // just ignore } } } - getLog().info( "[MAVEN-CORE-IT-LOG] Created output file " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Created output file " + outputFile); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-active-collection/src/main/java/org/apache/maven/plugin/coreit/CheckThreadSafetyMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-active-collection/src/main/java/org/apache/maven/plugin/coreit/CheckThreadSafetyMojo.java index 29122de137..f8f4441bd7 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-active-collection/src/main/java/org/apache/maven/plugin/coreit/CheckThreadSafetyMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-active-collection/src/main/java/org/apache/maven/plugin/coreit/CheckThreadSafetyMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugins.annotations.Component; -import org.apache.maven.plugins.annotations.LifecyclePhase; -import org.apache.maven.plugins.annotations.Mojo; -import org.apache.maven.plugins.annotations.Parameter; +package org.apache.maven.plugin.coreit; import java.io.File; import java.io.FileOutputStream; @@ -35,20 +27,25 @@ import java.util.Map; import java.util.Properties; import java.util.Vector; +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugins.annotations.Component; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; + /** * Checks the thread-safe retrieval of components from active component collections. * * @author Benjamin Bentmann - */ -@Mojo( name = "check-thread-safety", defaultPhase = LifecyclePhase.VALIDATE ) -public class CheckThreadSafetyMojo - extends AbstractMojo -{ + */ +@Mojo(name = "check-thread-safety", defaultPhase = LifecyclePhase.VALIDATE) +public class CheckThreadSafetyMojo extends AbstractMojo { /** * Project base directory used for manual path alignment. */ - @Parameter( defaultValue = "${basedir}", readonly = true ) + @Parameter(defaultValue = "${basedir}", readonly = true) private File basedir; /** @@ -66,7 +63,7 @@ public class CheckThreadSafetyMojo /** * The path to the properties file to create. */ - @Parameter( property = "collections.outputFile" ) + @Parameter(property = "collections.outputFile") private File outputFile; /** @@ -74,12 +71,10 @@ public class CheckThreadSafetyMojo * * @throws MojoExecutionException If the output file could not be created. */ - public void execute() - throws MojoExecutionException - { + public void execute() throws MojoExecutionException { Properties componentProperties = new Properties(); - getLog().info( "[MAVEN-CORE-IT-LOG] Testing concurrent component access" ); + getLog().info("[MAVEN-CORE-IT-LOG] Testing concurrent component access"); ClassLoader pluginRealm = getClass().getClassLoader(); ClassLoader coreRealm = MojoExecutionException.class.getClassLoader(); @@ -90,39 +85,29 @@ public class CheckThreadSafetyMojo final List exceptions = new Vector(); Thread[] threads = new Thread[2]; - for ( int i = 0; i < threads.length; i++ ) - { + for (int i = 0; i < threads.length; i++) { // NOTE: The threads need to use different realms to trigger changes of the collections - final ClassLoader cl = ( i % 2 ) == 0 ? pluginRealm : coreRealm; - threads[i] = new Thread() - { + final ClassLoader cl = (i % 2) == 0 ? pluginRealm : coreRealm; + threads[i] = new Thread() { private final ClassLoader tccl = cl; - public void run() - { - getLog().info( "[MAVEN-CORE-IT-LOG] Thread " + this + " uses " + tccl ); - Thread.currentThread().setContextClassLoader( tccl ); - while ( go.isEmpty() ) - { + public void run() { + getLog().info("[MAVEN-CORE-IT-LOG] Thread " + this + " uses " + tccl); + Thread.currentThread().setContextClassLoader(tccl); + while (go.isEmpty()) { // wait for start } - for ( int j = 0; j < 10 * 1000; j++ ) - { - try - { - for ( Object o : map.values() ) - { + for (int j = 0; j < 10 * 1000; j++) { + try { + for (Object o : map.values()) { o.toString(); } - for ( Object aList : list ) - { + for (Object aList : list) { aList.toString(); } - } - catch ( Exception e ) - { - getLog().warn( "[MAVEN-CORE-IT-LOG] Thread " + this + " encountered concurrency issue", e ); - exceptions.add( e ); + } catch (Exception e) { + getLog().warn("[MAVEN-CORE-IT-LOG] Thread " + this + " encountered concurrency issue", e); + exceptions.add(e); } } } @@ -130,56 +115,41 @@ public class CheckThreadSafetyMojo threads[i].start(); } - go.add( null ); - for ( Thread thread : threads ) - { - try - { + go.add(null); + for (Thread thread : threads) { + try { thread.join(); - } - catch ( InterruptedException e ) - { - getLog().warn( "[MAVEN-CORE-IT-LOG] Interrupted while joining " + thread ); + } catch (InterruptedException e) { + getLog().warn("[MAVEN-CORE-IT-LOG] Interrupted while joining " + thread); } } - componentProperties.setProperty( "components", Integer.toString( componentList.size() ) ); - componentProperties.setProperty( "exceptions", Integer.toString( exceptions.size() ) ); + componentProperties.setProperty("components", Integer.toString(componentList.size())); + componentProperties.setProperty("exceptions", Integer.toString(exceptions.size())); - if ( !outputFile.isAbsolute() ) - { - outputFile = new File( basedir, outputFile.getPath() ); + if (!outputFile.isAbsolute()) { + outputFile = new File(basedir, outputFile.getPath()); } - getLog().info( "[MAVEN-CORE-IT-LOG] Creating output file " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Creating output file " + outputFile); OutputStream out = null; - try - { + try { outputFile.getParentFile().mkdirs(); - out = new FileOutputStream( outputFile ); - componentProperties.store( out, "MAVEN-CORE-IT-LOG" ); - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Output file could not be created: " + outputFile, e ); - } - finally - { - if ( out != null ) - { - try - { + out = new FileOutputStream(outputFile); + componentProperties.store(out, "MAVEN-CORE-IT-LOG"); + } catch (IOException e) { + throw new MojoExecutionException("Output file could not be created: " + outputFile, e); + } finally { + if (out != null) { + try { out.close(); - } - catch ( IOException e ) - { + } catch (IOException e) { // just ignore } } } - getLog().info( "[MAVEN-CORE-IT-LOG] Created output file " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Created output file " + outputFile); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-active-collection/src/main/java/org/apache/maven/plugin/coreit/DefaultTestComponent.java b/its/core-it-support/core-it-plugins/maven-it-plugin-active-collection/src/main/java/org/apache/maven/plugin/coreit/DefaultTestComponent.java index bd10925a26..d27e6451df 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-active-collection/src/main/java/org/apache/maven/plugin/coreit/DefaultTestComponent.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-active-collection/src/main/java/org/apache/maven/plugin/coreit/DefaultTestComponent.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,11 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; /** * A simple test component. * * @author Benjamin Bentmann */ -public class DefaultTestComponent - implements TestComponent -{ - -} +public class DefaultTestComponent implements TestComponent {} diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-active-collection/src/main/java/org/apache/maven/plugin/coreit/DumpRepoLayoutsMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-active-collection/src/main/java/org/apache/maven/plugin/coreit/DumpRepoLayoutsMojo.java index f27d6c3b47..f3c0220095 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-active-collection/src/main/java/org/apache/maven/plugin/coreit/DumpRepoLayoutsMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-active-collection/src/main/java/org/apache/maven/plugin/coreit/DumpRepoLayoutsMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,15 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.util.List; +import java.util.Map; +import java.util.Properties; import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; import org.apache.maven.plugin.AbstractMojo; @@ -28,28 +35,18 @@ import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.util.List; -import java.util.Map; -import java.util.Properties; - /** * Dumps the role hints of the available repository layouts to a properties file. * * @author Benjamin Bentmann - */ -@Mojo( name = "dump-repo-layouts", defaultPhase = LifecyclePhase.VALIDATE ) -public class DumpRepoLayoutsMojo - extends AbstractMojo -{ + */ +@Mojo(name = "dump-repo-layouts", defaultPhase = LifecyclePhase.VALIDATE) +public class DumpRepoLayoutsMojo extends AbstractMojo { /** * Project base directory used for manual path alignment. */ - @Parameter( defaultValue = "${basedir}", readonly = true ) + @Parameter(defaultValue = "${basedir}", readonly = true) private File basedir; /** @@ -67,7 +64,7 @@ public class DumpRepoLayoutsMojo /** * The path to the properties file used to dump the repository layouts. */ - @Parameter( property = "collections.layoutsFile" ) + @Parameter(property = "collections.layoutsFile") private File layoutsFile; /** @@ -75,69 +72,52 @@ public class DumpRepoLayoutsMojo * * @throws MojoFailureException If the output file could not be created. */ - public void execute() - throws MojoExecutionException, MojoFailureException - { + public void execute() throws MojoExecutionException, MojoFailureException { Properties layoutProperties = new Properties(); - getLog().info( "[MAVEN-CORE-IT-LOG] Dumping repository layouts" ); + getLog().info("[MAVEN-CORE-IT-LOG] Dumping repository layouts"); - layoutProperties.setProperty( "layouts", Integer.toString( repositoryLayouts.size() ) ); + layoutProperties.setProperty("layouts", Integer.toString(repositoryLayouts.size())); - for ( Object o : repositoryLayouts.keySet() ) - { + for (Object o : repositoryLayouts.keySet()) { String roleHint = (String) o; - Object repoLayout = repositoryLayouts.get( roleHint ); - if ( repoLayout != null ) - { - layoutProperties.setProperty( "layouts." + roleHint, repoLayout.getClass().getName() ); + Object repoLayout = repositoryLayouts.get(roleHint); + if (repoLayout != null) { + layoutProperties.setProperty( + "layouts." + roleHint, repoLayout.getClass().getName()); + } else { + layoutProperties.setProperty("layouts." + roleHint, ""); } - else - { - layoutProperties.setProperty( "layouts." + roleHint, "" ); - } - getLog().info( "[MAVEN-CORE-IT-LOG] " + roleHint + " = " + repoLayout ); + getLog().info("[MAVEN-CORE-IT-LOG] " + roleHint + " = " + repoLayout); } - if ( repoLayouts.size() != repositoryLayouts.size() ) - { - throw new MojoExecutionException( "Inconsistent collection: " + repoLayouts + " vs " + repositoryLayouts ); + if (repoLayouts.size() != repositoryLayouts.size()) { + throw new MojoExecutionException("Inconsistent collection: " + repoLayouts + " vs " + repositoryLayouts); } - if ( !layoutsFile.isAbsolute() ) - { - layoutsFile = new File( basedir, layoutsFile.getPath() ); + if (!layoutsFile.isAbsolute()) { + layoutsFile = new File(basedir, layoutsFile.getPath()); } - getLog().info( "[MAVEN-CORE-IT-LOG] Creating output file " + layoutsFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Creating output file " + layoutsFile); OutputStream out = null; - try - { + try { layoutsFile.getParentFile().mkdirs(); - out = new FileOutputStream( layoutsFile ); - layoutProperties.store( out, "MAVEN-CORE-IT-LOG" ); - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Output file could not be created: " + layoutsFile, e ); - } - finally - { - if ( out != null ) - { - try - { + out = new FileOutputStream(layoutsFile); + layoutProperties.store(out, "MAVEN-CORE-IT-LOG"); + } catch (IOException e) { + throw new MojoExecutionException("Output file could not be created: " + layoutsFile, e); + } finally { + if (out != null) { + try { out.close(); - } - catch ( IOException e ) - { + } catch (IOException e) { // just ignore } } } - getLog().info( "[MAVEN-CORE-IT-LOG] Created output file " + layoutsFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Created output file " + layoutsFile); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-active-collection/src/main/java/org/apache/maven/plugin/coreit/TestComponent.java b/its/core-it-support/core-it-plugins/maven-it-plugin-active-collection/src/main/java/org/apache/maven/plugin/coreit/TestComponent.java index 6adc9a4c2c..c3b1b292d9 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-active-collection/src/main/java/org/apache/maven/plugin/coreit/TestComponent.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-active-collection/src/main/java/org/apache/maven/plugin/coreit/TestComponent.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,11 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; /** * A simple interface for our test components. * * @author Benjamin Bentmann */ -public interface TestComponent -{ - -} +public interface TestComponent {} diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-all/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-all/pom.xml index a22965fe85..a3b8015474 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-all/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-all/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 - maven-it-plugins org.apache.maven.its.plugins + maven-it-plugins 2.1-SNAPSHOT diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-all/src/main/java/org/apache/maven/plugin/coreit/AggregatorDependenciesMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-all/src/main/java/org/apache/maven/plugin/coreit/AggregatorDependenciesMojo.java index c26b526326..379302f0d9 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-all/src/main/java/org/apache/maven/plugin/coreit/AggregatorDependenciesMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-all/src/main/java/org/apache/maven/plugin/coreit/AggregatorDependenciesMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; import java.io.File; import java.io.IOException; @@ -31,37 +30,31 @@ import org.apache.maven.plugins.annotations.ResolutionScope; /** */ -@Mojo( name = "aggregator-dependencies", defaultPhase = LifecyclePhase.VALIDATE, - requiresDependencyResolution = ResolutionScope.TEST, aggregator = true ) -public class AggregatorDependenciesMojo - extends AbstractMojo -{ +@Mojo( + name = "aggregator-dependencies", + defaultPhase = LifecyclePhase.VALIDATE, + requiresDependencyResolution = ResolutionScope.TEST, + aggregator = true) +public class AggregatorDependenciesMojo extends AbstractMojo { /** * The path to the touch file, relative to the project's base directory. */ - @Parameter( property = "aggregator.touchFile", defaultValue = "${project.build.directory}/touch.txt" ) + @Parameter(property = "aggregator.touchFile", defaultValue = "${project.build.directory}/touch.txt") private File touchFile; - public void execute() - throws MojoExecutionException - { - getLog().info( "[MAVEN-CORE-IT-LOG] Touching file: " + touchFile ); + public void execute() throws MojoExecutionException { + getLog().info("[MAVEN-CORE-IT-LOG] Touching file: " + touchFile); - if ( touchFile != null ) - { - try - { + if (touchFile != null) { + try { touchFile.getParentFile().mkdirs(); touchFile.createNewFile(); - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Failed to create touch file " + touchFile, e ); + } catch (IOException e) { + throw new MojoExecutionException("Failed to create touch file " + touchFile, e); } } - getLog().info( "[MAVEN-CORE-IT-LOG] Touched file: " + touchFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Touched file: " + touchFile); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-ant-based/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-ant-based/pom.xml index 0fef1178af..7bfc3feb01 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-ant-based/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-ant-based/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 - maven-it-plugins org.apache.maven.its.plugins + maven-it-plugins 2.1-SNAPSHOT @@ -32,9 +30,7 @@ under the License. maven-plugin Maven IT Plugin :: Ant-Based - - A test plugin whose mojos are implemented via Ant scripts. - + A test plugin whose mojos are implemented via Ant scripts. 2009 @@ -95,13 +91,6 @@ under the License. via MNG-3284. --> 2.4.2 - - - org.apache.maven.plugin-tools - maven-plugin-tools-ant - 2.4.2 - - ${project.build.directory} @@ -109,6 +98,13 @@ under the License. ant + + + org.apache.maven.plugin-tools + maven-plugin-tools-ant + 2.4.2 + + diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/pom.xml index 360605b52a..5e23b13c4c 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 - maven-it-plugins org.apache.maven.its.plugins + maven-it-plugins 2.1-SNAPSHOT @@ -32,11 +30,9 @@ under the License. maven-plugin Maven IT Plugin :: Artifact - - A test plugin that manages the build artifacts of a project. More precisely, it can set the main artifact's file, + A test plugin that manages the build artifacts of a project. More precisely, it can set the main artifact's file, attach artifacts and install/deploy them to the repos. As such, it is the simplified essence of a bunch of - production plugins. - + production plugins. 2008 diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/AbstractRepoMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/AbstractRepoMojo.java index 12d26bb300..d753aeeb47 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/AbstractRepoMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/AbstractRepoMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,58 +16,55 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; +import java.util.Collection; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugins.annotations.Parameter; -import java.io.File; -import java.util.Collection; - /** * Provides common code for the install and deploy mojos. * * @author Benjamin Bentmann * */ -public abstract class AbstractRepoMojo - extends AbstractMojo -{ +public abstract class AbstractRepoMojo extends AbstractMojo { /** * The project's main artifact. */ - @Parameter( defaultValue = "${project.artifact}", required = true, readonly = true ) + @Parameter(defaultValue = "${project.artifact}", required = true, readonly = true) protected Artifact mainArtifact; /** * The project's attached artifact. */ - @Parameter( defaultValue = "${project.attachedArtifacts}", required = true, readonly = true ) + @Parameter(defaultValue = "${project.attachedArtifacts}", required = true, readonly = true) protected Collection attachedArtifacts; /** * The packaging of the project. */ - @Parameter( defaultValue = "${project.packaging}", required = true, readonly = true ) + @Parameter(defaultValue = "${project.packaging}", required = true, readonly = true) protected String packaging; /** * The POM file of the project. */ - @Parameter( defaultValue = "${project.file}", required = true, readonly = true ) + @Parameter(defaultValue = "${project.file}", required = true, readonly = true) protected File pomFile; /** * The local repository. */ - @Parameter( defaultValue = "${localRepository}", required = true, readonly = true ) + @Parameter(defaultValue = "${localRepository}", required = true, readonly = true) protected ArtifactRepository localRepository; - protected boolean isPomArtifact() - { - return "pom".equals( packaging ); + protected boolean isPomArtifact() { + return "pom".equals(packaging); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/AttachMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/AttachMojo.java index 3a27f8a3c3..9911c2e934 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/AttachMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/AttachMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,9 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; @@ -29,24 +30,20 @@ import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; import org.apache.maven.project.MavenProjectHelper; -import java.io.File; - /** * Attaches a secondary artifact to the current project. This mimics source/javadoc attachments or other assemblies. * - * + * * @author Benjamin Bentmann * */ -@Mojo( name = "attach", defaultPhase = LifecyclePhase.PACKAGE ) -public class AttachMojo - extends AbstractMojo -{ +@Mojo(name = "attach", defaultPhase = LifecyclePhase.PACKAGE) +public class AttachMojo extends AbstractMojo { /** * The current Maven project. */ - @Parameter( defaultValue = "${project}", readonly = true, required = true ) + @Parameter(defaultValue = "${project}", readonly = true, required = true) private MavenProject project; /** @@ -59,20 +56,20 @@ public class AttachMojo /** * The path to the file to attach, relative to the project base directory. The plugin will not validate this path. */ - @Parameter( property = "artifact.attachedFile", required = true ) + @Parameter(property = "artifact.attachedFile", required = true) private String attachedFile; /** * The type of the artifact to attach. */ - @Parameter( property = "artifact.artifactType" ) + @Parameter(property = "artifact.artifactType") private String artifactType; /** * The classifier for the attached artifact. If unspecified, the default classifier for the specified artifact type * is used. */ - @Parameter( property = "artifact.artifactClassifier" ) + @Parameter(property = "artifact.artifactClassifier") private String artifactClassifier; /** @@ -80,34 +77,28 @@ public class AttachMojo * * @throws MojoFailureException If the attached file has not been set. */ - public void execute() - throws MojoExecutionException, MojoFailureException - { - getLog().info( "[MAVEN-CORE-IT-LOG] Attaching artifact file: " + attachedFile ); - getLog().info( "[MAVEN-CORE-IT-LOG] type=" + artifactType + ", classifier=" + artifactClassifier ); + public void execute() throws MojoExecutionException, MojoFailureException { + getLog().info("[MAVEN-CORE-IT-LOG] Attaching artifact file: " + attachedFile); + getLog().info("[MAVEN-CORE-IT-LOG] type=" + artifactType + ", classifier=" + artifactClassifier); - if ( attachedFile == null || attachedFile.length() <= 0 ) - { - throw new MojoFailureException( "Path name for attached artifact file has not been specified" ); + if (attachedFile == null || attachedFile.length() <= 0) { + throw new MojoFailureException("Path name for attached artifact file has not been specified"); } /* * NOTE: We do not want to test path translation here, so resolve relative paths manually. */ - File artifactFile = new File( attachedFile ); - if ( !artifactFile.isAbsolute() ) - { - artifactFile = new File( project.getBasedir(), attachedFile ); + File artifactFile = new File(attachedFile); + if (!artifactFile.isAbsolute()) { + artifactFile = new File(project.getBasedir(), attachedFile); } - if ( !artifactFile.exists() ) - { - getLog().warn( "[MAVEN-CORE-IT-LOG] Attached artifact file does not exist: " + artifactFile ); + if (!artifactFile.exists()) { + getLog().warn("[MAVEN-CORE-IT-LOG] Attached artifact file does not exist: " + artifactFile); } - helper.attachArtifact( project, artifactType, artifactClassifier, artifactFile ); + helper.attachArtifact(project, artifactType, artifactClassifier, artifactFile); - getLog().info( "[MAVEN-CORE-IT-LOG] Attached artifact file: " + artifactFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Attached artifact file: " + artifactFile); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/AttachPomMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/AttachPomMojo.java index c16aa21e43..b2cdc86c4c 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/AttachPomMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/AttachPomMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,9 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; import org.apache.maven.artifact.Artifact; import org.apache.maven.plugin.AbstractMojo; @@ -29,31 +30,27 @@ import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; import org.apache.maven.project.artifact.ProjectArtifactMetadata; -import java.io.File; - /** * Attaches a POM to the main artifact. * - * + * * @author Benjamin Bentmann * */ -@Mojo( name = "attach-pom", defaultPhase = LifecyclePhase.PACKAGE ) -public class AttachPomMojo - extends AbstractMojo -{ +@Mojo(name = "attach-pom", defaultPhase = LifecyclePhase.PACKAGE) +public class AttachPomMojo extends AbstractMojo { /** * The current Maven project. */ - @Parameter( defaultValue = "${project}", required = true, readonly = true ) + @Parameter(defaultValue = "${project}", required = true, readonly = true) private MavenProject project; /** * The path to the POM file to attach to the main artifact, relative to the project base directory. The plugin will * not validate this path. */ - @Parameter( property = "artifact.pomFile", defaultValue = "${project.file.path}", required = true ) + @Parameter(property = "artifact.pomFile", defaultValue = "${project.file.path}", required = true) private String pomFile; /** @@ -61,29 +58,24 @@ public class AttachPomMojo * * @throws MojoFailureException If the artifact file has not been set. */ - public void execute() - throws MojoExecutionException, MojoFailureException - { - getLog().info( "[MAVEN-CORE-IT-LOG] Attaching POM to main artifact: " + pomFile ); + public void execute() throws MojoExecutionException, MojoFailureException { + getLog().info("[MAVEN-CORE-IT-LOG] Attaching POM to main artifact: " + pomFile); - if ( pomFile == null || pomFile.length() <= 0 ) - { - throw new MojoFailureException( "Path name for POM file has not been specified" ); + if (pomFile == null || pomFile.length() <= 0) { + throw new MojoFailureException("Path name for POM file has not been specified"); } /* * NOTE: We do not want to test path translation here, so resolve relative paths manually. */ - File metadataFile = new File( pomFile ); - if ( !metadataFile.isAbsolute() ) - { - metadataFile = new File( project.getBasedir(), pomFile ); + File metadataFile = new File(pomFile); + if (!metadataFile.isAbsolute()) { + metadataFile = new File(project.getBasedir(), pomFile); } Artifact artifact = project.getArtifact(); - artifact.addMetadata( new ProjectArtifactMetadata( artifact, metadataFile ) ); + artifact.addMetadata(new ProjectArtifactMetadata(artifact, metadataFile)); - getLog().info( "[MAVEN-CORE-IT-LOG] Attached POM to main artifact: " + metadataFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Attached POM to main artifact: " + metadataFile); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/CollectMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/CollectMojo.java index 4570c6d5f7..40495725c3 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/CollectMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/CollectMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,12 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.util.Collections; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.factory.ArtifactFactory; @@ -32,32 +36,25 @@ import org.apache.maven.plugins.annotations.Component; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; -import java.util.Collections; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Set; - /** * Collects user-specified artifacts. This mimics in part the Maven Assembly Plugin. * * @author Benjamin Bentmann * - */ -@Mojo( name = "collect" ) -public class CollectMojo - extends AbstractMojo -{ + */ +@Mojo(name = "collect") +public class CollectMojo extends AbstractMojo { /** * The local repository. */ - @Parameter( defaultValue = "${localRepository}", readonly = true, required = true ) + @Parameter(defaultValue = "${localRepository}", readonly = true, required = true) private ArtifactRepository localRepository; /** * The remote repositories of the current Maven project. */ - @Parameter( defaultValue = "${project.remoteArtifactRepositories}", readonly = true, required = true ) + @Parameter(defaultValue = "${project.remoteArtifactRepositories}", readonly = true, required = true) private List remoteRepositories; /** @@ -93,39 +90,39 @@ public class CollectMojo * * @throws MojoFailureException If the artifact file has not been set. */ - public void execute() - throws MojoExecutionException, MojoFailureException - { - getLog().info( "[MAVEN-CORE-IT-LOG] Collecting artifacts" ); + public void execute() throws MojoExecutionException, MojoFailureException { + getLog().info("[MAVEN-CORE-IT-LOG] Collecting artifacts"); - try - { - Artifact origin = factory.createArtifact( "it", "it", "0.1", null, "pom" ); + try { + Artifact origin = factory.createArtifact("it", "it", "0.1", null, "pom"); Set artifacts = new LinkedHashSet(); - if ( dependencies != null ) - { - for ( Dependency dependency : dependencies ) - { - Artifact artifact = - factory.createArtifactWithClassifier( dependency.getGroupId(), dependency.getArtifactId(), - dependency.getVersion(), dependency.getType(), - dependency.getClassifier() ); + if (dependencies != null) { + for (Dependency dependency : dependencies) { + Artifact artifact = factory.createArtifactWithClassifier( + dependency.getGroupId(), + dependency.getArtifactId(), + dependency.getVersion(), + dependency.getType(), + dependency.getClassifier()); - artifacts.add( artifact ); + artifacts.add(artifact); - getLog().info( "[MAVEN-CORE-IT-LOG] Collecting " + artifact.getId() ); + getLog().info("[MAVEN-CORE-IT-LOG] Collecting " + artifact.getId()); } } - collector.collect( artifacts, origin, localRepository, remoteRepositories, metadataSource, null, - Collections.EMPTY_LIST ); - } - catch ( Exception e ) - { - throw new MojoExecutionException( "Failed to collect artifacts: " + e.getMessage(), e ); + collector.collect( + artifacts, + origin, + localRepository, + remoteRepositories, + metadataSource, + null, + Collections.EMPTY_LIST); + } catch (Exception e) { + throw new MojoExecutionException("Failed to collect artifacts: " + e.getMessage(), e); } } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/CustomRepositoryLayout.java b/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/CustomRepositoryLayout.java index b7db2475b0..088f2e76c5 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/CustomRepositoryLayout.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/CustomRepositoryLayout.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.handler.ArtifactHandler; @@ -28,44 +27,36 @@ import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; /** * @author Benjamin Bentmann */ -public class CustomRepositoryLayout - implements ArtifactRepositoryLayout -{ +public class CustomRepositoryLayout implements ArtifactRepositoryLayout { @Override - public String getId() - { + public String getId() { return "id"; } - public String pathOf( Artifact artifact ) - { + public String pathOf(Artifact artifact) { ArtifactHandler artifactHandler = artifact.getArtifactHandler(); StringBuilder path = new StringBuilder(); - path.append( artifact.getArtifactId() ).append( '-' ).append( artifact.getVersion() ); + path.append(artifact.getArtifactId()).append('-').append(artifact.getVersion()); - if ( artifact.hasClassifier() ) - { - path.append( '-' ).append( artifact.getClassifier() ); + if (artifact.hasClassifier()) { + path.append('-').append(artifact.getClassifier()); } - if ( artifactHandler.getExtension() != null && artifactHandler.getExtension().length() > 0 ) - { - path.append( '.' ).append( artifactHandler.getExtension() ); + if (artifactHandler.getExtension() != null + && artifactHandler.getExtension().length() > 0) { + path.append('.').append(artifactHandler.getExtension()); } return path.toString(); } - public String pathOfLocalRepositoryMetadata( ArtifactMetadata metadata, ArtifactRepository repository ) - { - return metadata.getLocalFilename( repository ); + public String pathOfLocalRepositoryMetadata(ArtifactMetadata metadata, ArtifactRepository repository) { + return metadata.getLocalFilename(repository); } - public String pathOfRemoteRepositoryMetadata( ArtifactMetadata metadata ) - { + public String pathOfRemoteRepositoryMetadata(ArtifactMetadata metadata) { return metadata.getRemoteFilename(); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/DeployFileMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/DeployFileMojo.java index 075e7f9497..8dcdd94185 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/DeployFileMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/DeployFileMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,9 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.deployer.ArtifactDeployer; @@ -32,53 +33,49 @@ import org.apache.maven.plugins.annotations.Component; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; -import java.io.File; - /** * Deploys a user-supplied file to some repository. This mimics part of the Maven Deploy Plugin. * * @author Benjamin Bentmann * */ -@Mojo( name = "deploy-file", requiresProject = false ) -public class DeployFileMojo - extends AbstractMojo -{ +@Mojo(name = "deploy-file", requiresProject = false) +public class DeployFileMojo extends AbstractMojo { /** * The file of the artifact to deploy. */ - @Parameter( property = "file" ) + @Parameter(property = "file") private File file; /** * The group id of the artifact. */ - @Parameter( property = "groupId" ) + @Parameter(property = "groupId") private String groupId; /** * The artifact id of the artifact. */ - @Parameter( property = "artifactId" ) + @Parameter(property = "artifactId") private String artifactId; /** * The version of the artifact. */ - @Parameter( property = "version" ) + @Parameter(property = "version") private String version; /** * The URL of the repository to deploy to. */ - @Parameter( property = "repositoryUrl" ) + @Parameter(property = "repositoryUrl") private String repositoryUrl; /** * The ID of the repository to deploy to. */ - @Parameter( property = "repositoryId" ) + @Parameter(property = "repositoryId") private String repositoryId; /** @@ -91,7 +88,7 @@ public class DeployFileMojo /** * The repository layout. */ - @Component( hint = "default" ) + @Component(hint = "default") private ArtifactRepositoryLayout repositoryLayout; /** @@ -111,7 +108,7 @@ public class DeployFileMojo /** * The local repository. */ - @Parameter( defaultValue = "${localRepository}", readonly = true, required = true ) + @Parameter(defaultValue = "${localRepository}", readonly = true, required = true) private ArtifactRepository localRepository; /** @@ -119,25 +116,18 @@ public class DeployFileMojo * * @throws MojoExecutionException If any artifact could not be deployed. */ - public void execute() - throws MojoExecutionException, MojoFailureException - { - getLog().info( "[MAVEN-CORE-IT-LOG] Deploying artifacts" ); + public void execute() throws MojoExecutionException, MojoFailureException { + getLog().info("[MAVEN-CORE-IT-LOG] Deploying artifacts"); - try - { - ArtifactRepository repository = - repositoryFactory.createDeploymentArtifactRepository( repositoryId, repositoryUrl, repositoryLayout, - true ); + try { + ArtifactRepository repository = repositoryFactory.createDeploymentArtifactRepository( + repositoryId, repositoryUrl, repositoryLayout, true); - Artifact artifact = artifactFactory.createArtifact( groupId, artifactId, version, null, "jar" ); + Artifact artifact = artifactFactory.createArtifact(groupId, artifactId, version, null, "jar"); - deployer.deploy( file, artifact, repository, localRepository ); - } - catch ( Exception e ) - { - throw new MojoExecutionException( "Failed to deploy artifacts: " + e.getMessage(), e ); + deployer.deploy(file, artifact, repository, localRepository); + } catch (Exception e) { + throw new MojoExecutionException("Failed to deploy artifacts: " + e.getMessage(), e); } } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/DeployMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/DeployMojo.java index 43c50b21f6..9f4e22cc52 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/DeployMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/DeployMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.deployer.ArtifactDeployer; @@ -33,16 +32,14 @@ import org.apache.maven.plugins.annotations.Parameter; * * @author Benjamin Bentmann * - */ -@Mojo( name = "deploy", defaultPhase = LifecyclePhase.DEPLOY ) -public class DeployMojo - extends AbstractRepoMojo -{ + */ +@Mojo(name = "deploy", defaultPhase = LifecyclePhase.DEPLOY) +public class DeployMojo extends AbstractRepoMojo { /** * The distribution repository. */ - @Parameter( defaultValue = "${project.distributionManagementArtifactRepository}", readonly = true, required = true ) + @Parameter(defaultValue = "${project.distributionManagementArtifactRepository}", readonly = true, required = true) private ArtifactRepository deploymentRepository; /** @@ -57,35 +54,24 @@ public class DeployMojo * * @throws MojoExecutionException If any artifact could not be installed. */ - public void execute() - throws MojoExecutionException - { - getLog().info( "[MAVEN-CORE-IT-LOG] Deploying project artifacts" ); + public void execute() throws MojoExecutionException { + getLog().info("[MAVEN-CORE-IT-LOG] Deploying project artifacts"); - try - { - if ( isPomArtifact() ) - { - deployer.deploy( pomFile, mainArtifact, deploymentRepository, localRepository ); - } - else - { - deployer.deploy( mainArtifact.getFile(), mainArtifact, deploymentRepository, localRepository ); + try { + if (isPomArtifact()) { + deployer.deploy(pomFile, mainArtifact, deploymentRepository, localRepository); + } else { + deployer.deploy(mainArtifact.getFile(), mainArtifact, deploymentRepository, localRepository); } - if ( attachedArtifacts != null ) - { - for ( Artifact attachedArtifact : attachedArtifacts ) - { - deployer.deploy( attachedArtifact.getFile(), attachedArtifact, deploymentRepository, - localRepository ); + if (attachedArtifacts != null) { + for (Artifact attachedArtifact : attachedArtifacts) { + deployer.deploy( + attachedArtifact.getFile(), attachedArtifact, deploymentRepository, localRepository); } } - } - catch ( Exception e ) - { - throw new MojoExecutionException( "Failed to deploy artifacts: " + e.getMessage(), e ); + } catch (Exception e) { + throw new MojoExecutionException("Failed to deploy artifacts: " + e.getMessage(), e); } } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/InstallArtifactsMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/InstallArtifactsMojo.java index 117d480315..7588992df9 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/InstallArtifactsMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/InstallArtifactsMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,10 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; +import java.util.List; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.handler.ArtifactHandler; @@ -36,21 +38,18 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.plugins.annotations.ResolutionScope; -import java.io.File; -import java.util.List; - /** * @author Olivier Lamy */ -@Mojo( name = "install-artifacts", requiresDependencyResolution = ResolutionScope.RUNTIME, - defaultPhase = LifecyclePhase.PACKAGE ) -public class InstallArtifactsMojo - extends AbstractMojo -{ +@Mojo( + name = "install-artifacts", + requiresDependencyResolution = ResolutionScope.RUNTIME, + defaultPhase = LifecyclePhase.PACKAGE) +public class InstallArtifactsMojo extends AbstractMojo { /** */ - @Parameter( defaultValue = "${project.runtimeArtifacts}", readonly = true ) + @Parameter(defaultValue = "${project.runtimeArtifacts}", readonly = true) private List artifacts; /** @@ -67,105 +66,90 @@ public class InstallArtifactsMojo * The directory that will be used to assemble the artifacts in * and place the bin scripts. */ - @Parameter( property = "assembleDirectory", defaultValue = "${project.build.directory}/appassembler" ) + @Parameter(property = "assembleDirectory", defaultValue = "${project.build.directory}/appassembler") private File assembleDirectory; /** * Path (relative to assembleDirectory) of the desired output repository. */ - @Parameter( defaultValue = "repo" ) + @Parameter(defaultValue = "repo") private String repositoryName; - public void execute() - throws MojoExecutionException, MojoFailureException - { + public void execute() throws MojoExecutionException, MojoFailureException { ArtifactRepositoryLayout artifactRepositoryLayout = new FlatRepositoryLayout(); // The repo where the jar files will be installed - ArtifactRepository artifactRepository = - artifactRepositoryFactory.createDeploymentArtifactRepository( "appassembler", "file://" - + assembleDirectory.getAbsolutePath() + "/" + repositoryName, artifactRepositoryLayout, false ); - for ( Artifact artifact : artifacts ) - { - installArtifact( artifactRepository, artifact ); + ArtifactRepository artifactRepository = artifactRepositoryFactory.createDeploymentArtifactRepository( + "appassembler", + "file://" + assembleDirectory.getAbsolutePath() + "/" + repositoryName, + artifactRepositoryLayout, + false); + for (Artifact artifact : artifacts) { + installArtifact(artifactRepository, artifact); } } - private void installArtifact( ArtifactRepository artifactRepository, Artifact artifact ) - throws MojoExecutionException - { - try - { + private void installArtifact(ArtifactRepository artifactRepository, Artifact artifact) + throws MojoExecutionException { + try { artifact.isSnapshot(); - if ( artifact.getFile() != null ) - { - artifactInstaller.install( artifact.getFile(), artifact, artifactRepository ); + if (artifact.getFile() != null) { + artifactInstaller.install(artifact.getFile(), artifact, artifactRepository); } - } - catch ( ArtifactInstallationException e ) - { - throw new MojoExecutionException( "Failed to copy artifact.", e ); + } catch (ArtifactInstallationException e) { + throw new MojoExecutionException("Failed to copy artifact.", e); } } /** * */ - public static class FlatRepositoryLayout - implements ArtifactRepositoryLayout - { + public static class FlatRepositoryLayout implements ArtifactRepositoryLayout { private static final char ARTIFACT_SEPARATOR = '-'; private static final char GROUP_SEPARATOR = '.'; @Override - public String getId() - { + public String getId() { return "id"; } - public String pathOf( Artifact artifact ) - { + public String pathOf(Artifact artifact) { ArtifactHandler artifactHandler = artifact.getArtifactHandler(); StringBuilder path = new StringBuilder(); - path.append( artifact.getArtifactId() ).append( ARTIFACT_SEPARATOR ).append( artifact.getVersion() ); + path.append(artifact.getArtifactId()).append(ARTIFACT_SEPARATOR).append(artifact.getVersion()); - if ( artifact.hasClassifier() ) - { - path.append( ARTIFACT_SEPARATOR ).append( artifact.getClassifier() ); + if (artifact.hasClassifier()) { + path.append(ARTIFACT_SEPARATOR).append(artifact.getClassifier()); } - if ( artifactHandler.getExtension() != null && artifactHandler.getExtension().length() > 0 ) - { - path.append( GROUP_SEPARATOR ).append( artifactHandler.getExtension() ); + if (artifactHandler.getExtension() != null + && artifactHandler.getExtension().length() > 0) { + path.append(GROUP_SEPARATOR).append(artifactHandler.getExtension()); } return path.toString(); } - public String pathOfLocalRepositoryMetadata( ArtifactMetadata metadata, ArtifactRepository repository ) - { - return pathOfRepositoryMetadata( metadata.getLocalFilename( repository ) ); + public String pathOfLocalRepositoryMetadata(ArtifactMetadata metadata, ArtifactRepository repository) { + return pathOfRepositoryMetadata(metadata.getLocalFilename(repository)); } - private String pathOfRepositoryMetadata( String filename ) - { + private String pathOfRepositoryMetadata(String filename) { StringBuilder path = new StringBuilder(); - path.append( filename ); + path.append(filename); return path.toString(); } - public String pathOfRemoteRepositoryMetadata( ArtifactMetadata metadata ) - { - return pathOfRepositoryMetadata( metadata.getRemoteFilename() ); + public String pathOfRemoteRepositoryMetadata(ArtifactMetadata metadata) { + return pathOfRepositoryMetadata(metadata.getRemoteFilename()); } } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/InstallCustomMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/InstallCustomMojo.java index 6993bdaf9d..b20ce9d2f8 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/InstallCustomMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/InstallCustomMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; import java.io.File; @@ -34,10 +33,8 @@ import org.apache.maven.plugins.annotations.Parameter; * @author Benjamin Bentmann * */ -@Mojo( name = "install-custom" ) -public class InstallCustomMojo - extends InstallMojo -{ +@Mojo(name = "install-custom") +public class InstallCustomMojo extends InstallMojo { /** */ @@ -47,7 +44,7 @@ public class InstallCustomMojo /** * The base directory of the local repository to install to. */ - @Parameter( property = "install.localRepoDir" ) + @Parameter(property = "install.localRepoDir") private File localRepoDir; /** @@ -55,24 +52,20 @@ public class InstallCustomMojo * * @throws MojoExecutionException If any artifact could not be installed. */ - public void execute() - throws MojoExecutionException - { - try - { + public void execute() throws MojoExecutionException { + try { String url = "file://" + localRepoDir.toURL().getPath(); - localRepository = - repositoryFactory.createArtifactRepository( localRepository.getId(), url, new CustomRepositoryLayout(), - localRepository.getSnapshots(), - localRepository.getReleases() ); - } - catch ( Exception e ) - { - throw new MojoExecutionException( "Failed to create custom local repository", e ); + localRepository = repositoryFactory.createArtifactRepository( + localRepository.getId(), + url, + new CustomRepositoryLayout(), + localRepository.getSnapshots(), + localRepository.getReleases()); + } catch (Exception e) { + throw new MojoExecutionException("Failed to create custom local repository", e); } super.execute(); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/InstallMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/InstallMojo.java index fe13b8f323..afc8ae4fe5 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/InstallMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/InstallMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.installer.ArtifactInstaller; @@ -31,11 +30,9 @@ import org.apache.maven.plugins.annotations.Mojo; * * @author Benjamin Bentmann * - */ -@Mojo( name = "install", defaultPhase = LifecyclePhase.INSTALL ) -public class InstallMojo - extends AbstractRepoMojo -{ + */ +@Mojo(name = "install", defaultPhase = LifecyclePhase.INSTALL) +public class InstallMojo extends AbstractRepoMojo { /** * The artifact installer. @@ -48,34 +45,23 @@ public class InstallMojo * * @throws MojoExecutionException If any artifact could not be installed. */ - public void execute() - throws MojoExecutionException - { - getLog().info( "[MAVEN-CORE-IT-LOG] Installing project artifacts" ); + public void execute() throws MojoExecutionException { + getLog().info("[MAVEN-CORE-IT-LOG] Installing project artifacts"); - try - { - if ( isPomArtifact() ) - { - installer.install( pomFile, mainArtifact, localRepository ); - } - else - { - installer.install( mainArtifact.getFile(), mainArtifact, localRepository ); + try { + if (isPomArtifact()) { + installer.install(pomFile, mainArtifact, localRepository); + } else { + installer.install(mainArtifact.getFile(), mainArtifact, localRepository); } - if ( attachedArtifacts != null ) - { - for ( Artifact attachedArtifact : attachedArtifacts ) - { - installer.install( attachedArtifact.getFile(), attachedArtifact, localRepository ); + if (attachedArtifacts != null) { + for (Artifact attachedArtifact : attachedArtifacts) { + installer.install(attachedArtifact.getFile(), attachedArtifact, localRepository); } } - } - catch ( Exception e ) - { - throw new MojoExecutionException( "Failed to install artifacts", e ); + } catch (Exception e) { + throw new MojoExecutionException("Failed to install artifacts", e); } } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/LatestMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/LatestMojo.java index 8ae85b96ce..c8fe2fff2b 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/LatestMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/LatestMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata; @@ -31,34 +30,29 @@ import org.apache.maven.plugins.annotations.Parameter; /** * Marks the project's artifact as the latest version. * - * + * * @author Benjamin Bentmann */ -@Mojo( name = "latest", defaultPhase = LifecyclePhase.PACKAGE ) -public class LatestMojo - extends AbstractMojo -{ +@Mojo(name = "latest", defaultPhase = LifecyclePhase.PACKAGE) +public class LatestMojo extends AbstractMojo { /** * The main project artifact. */ - @Parameter( defaultValue = "${project.artifact}", readonly = true, required = true ) + @Parameter(defaultValue = "${project.artifact}", readonly = true, required = true) private Artifact projectArtifact; /** * Runs this mojo. */ - public void execute() - throws MojoExecutionException - { + public void execute() throws MojoExecutionException { Versioning versioning = new Versioning(); - versioning.setLatest( projectArtifact.getVersion() ); + versioning.setLatest(projectArtifact.getVersion()); versioning.updateTimestamp(); - ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata( projectArtifact, versioning ); - projectArtifact.addMetadata( metadata ); + ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata(projectArtifact, versioning); + projectArtifact.addMetadata(metadata); - getLog().info( "[MAVEN-CORE-IT-LOG] Marked artifact as latest" ); + getLog().info("[MAVEN-CORE-IT-LOG] Marked artifact as latest"); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/ReleaseMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/ReleaseMojo.java index 041f8c9e86..9f05f47a24 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/ReleaseMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/ReleaseMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; import org.apache.maven.artifact.Artifact; import org.apache.maven.plugin.AbstractMojo; @@ -31,31 +30,26 @@ import org.apache.maven.project.MavenProject; /** * Marks the project's artifact as a release. * - * + * * @author Benjamin Bentmann * */ -@Mojo( name = "release", defaultPhase = LifecyclePhase.PACKAGE ) -public class ReleaseMojo - extends AbstractMojo -{ +@Mojo(name = "release", defaultPhase = LifecyclePhase.PACKAGE) +public class ReleaseMojo extends AbstractMojo { /** * The current Maven project. */ - @Parameter( defaultValue = "${project}", readonly = true, required = true ) + @Parameter(defaultValue = "${project}", readonly = true, required = true) private MavenProject project; /** * Runs this mojo. */ - public void execute() - throws MojoExecutionException, MojoFailureException - { + public void execute() throws MojoExecutionException, MojoFailureException { Artifact artifact = project.getArtifact(); - artifact.setRelease( true ); + artifact.setRelease(true); - getLog().info( "[MAVEN-CORE-IT-LOG] Marked artifact as release" ); + getLog().info("[MAVEN-CORE-IT-LOG] Marked artifact as release"); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/ResolveMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/ResolveMojo.java index 1118fb18ed..b408990aa3 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/ResolveMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/ResolveMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,13 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.List; +import java.util.Properties; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.factory.ArtifactFactory; @@ -30,33 +35,25 @@ import org.apache.maven.plugins.annotations.Component; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.List; -import java.util.Properties; - /** * Resolves user-specified artifacts. This mimics in part the Maven Dependency Plugin and the Maven Surefire Plugin. * * @author Benjamin Bentmann * - */ -@Mojo( name = "resolve" ) -public class ResolveMojo - extends AbstractMojo -{ + */ +@Mojo(name = "resolve") +public class ResolveMojo extends AbstractMojo { /** * The local repository. */ - @Parameter( defaultValue = "${localRepository}", readonly = true, required = true ) + @Parameter(defaultValue = "${localRepository}", readonly = true, required = true) private ArtifactRepository localRepository; /** * The remote repositories of the current Maven project. */ - @Parameter( defaultValue = "${project.remoteArtifactRepositories}", readonly = true, required = true ) + @Parameter(defaultValue = "${project.remoteArtifactRepositories}", readonly = true, required = true) private List remoteRepositories; /** @@ -92,66 +89,53 @@ public class ResolveMojo * * @throws MojoExecutionException If the artifact could not be resolved */ - public void execute() - throws MojoExecutionException - { - getLog().info( "[MAVEN-CORE-IT-LOG] Resolving artifacts" ); + public void execute() throws MojoExecutionException { + getLog().info("[MAVEN-CORE-IT-LOG] Resolving artifacts"); Properties props = new Properties(); - try - { - if ( dependencies != null ) - { - for ( Dependency dependency : dependencies ) - { - Artifact artifact = - factory.createArtifactWithClassifier( dependency.getGroupId(), dependency.getArtifactId(), - dependency.getVersion(), dependency.getType(), - dependency.getClassifier() ); + try { + if (dependencies != null) { + for (Dependency dependency : dependencies) { + Artifact artifact = factory.createArtifactWithClassifier( + dependency.getGroupId(), + dependency.getArtifactId(), + dependency.getVersion(), + dependency.getType(), + dependency.getClassifier()); - getLog().info( "[MAVEN-CORE-IT-LOG] Resolving " + getId( artifact ) ); + getLog().info("[MAVEN-CORE-IT-LOG] Resolving " + getId(artifact)); - resolver.resolve( artifact, remoteRepositories, localRepository ); + resolver.resolve(artifact, remoteRepositories, localRepository); - if ( artifact.getFile() != null ) - { - props.setProperty( getId( artifact ), artifact.getFile().getPath() ); + if (artifact.getFile() != null) { + props.setProperty(getId(artifact), artifact.getFile().getPath()); } - getLog().info( "[MAVEN-CORE-IT-LOG] " + artifact.getFile() ); + getLog().info("[MAVEN-CORE-IT-LOG] " + artifact.getFile()); } } - } - catch ( Exception e ) - { - throw new MojoExecutionException( "Failed to resolve artifacts: " + e.getMessage(), e ); + } catch (Exception e) { + throw new MojoExecutionException("Failed to resolve artifacts: " + e.getMessage(), e); } - if ( propertiesFile != null ) - { - getLog().info( "[MAVEN-CORE-IT-LOG] Creating properties file " + propertiesFile ); + if (propertiesFile != null) { + getLog().info("[MAVEN-CORE-IT-LOG] Creating properties file " + propertiesFile); - try - { + try { propertiesFile.getParentFile().mkdirs(); - try ( FileOutputStream fos = new FileOutputStream( propertiesFile ) ) - { - props.store( fos, "MAVEN-CORE-IT" ); + try (FileOutputStream fos = new FileOutputStream(propertiesFile)) { + props.store(fos, "MAVEN-CORE-IT"); } - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Failed to create properties file: " + e.getMessage(), e ); + } catch (IOException e) { + throw new MojoExecutionException("Failed to create properties file: " + e.getMessage(), e); } } } - private String getId( Artifact artifact ) - { + private String getId(Artifact artifact) { artifact.isSnapshot(); // decouple from MNG-2961 return artifact.getId(); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/ResolveTransitiveMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/ResolveTransitiveMojo.java index 06a61f512d..5fa853cd69 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/ResolveTransitiveMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/ResolveTransitiveMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,15 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Properties; +import java.util.Set; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.factory.ArtifactFactory; @@ -31,35 +38,25 @@ import org.apache.maven.plugins.annotations.Component; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Properties; -import java.util.Set; - /** * Resolves user-specified artifacts transitively. As an additional exercise, the resolution happens in a forked thread * to test access to any shared session state. * * @author Benjamin Bentmann - */ -@Mojo( name = "resolve-transitive" ) -public class ResolveTransitiveMojo - extends AbstractMojo -{ + */ +@Mojo(name = "resolve-transitive") +public class ResolveTransitiveMojo extends AbstractMojo { /** * The local repository. */ - @Parameter( defaultValue = "${localRepository}", readonly = true, required = true ) + @Parameter(defaultValue = "${localRepository}", readonly = true, required = true) private ArtifactRepository localRepository; /** * The remote repositories of the current Maven project. */ - @Parameter( defaultValue = "${project.remoteArtifactRepositories}", readonly = true, required = true ) + @Parameter(defaultValue = "${project.remoteArtifactRepositories}", readonly = true, required = true) private List remoteRepositories; /** @@ -102,110 +99,88 @@ public class ResolveTransitiveMojo * * @throws MojoExecutionException If the artifacts couldn't be resolved. */ - public void execute() - throws MojoExecutionException - { - getLog().info( "[MAVEN-CORE-IT-LOG] Resolving artifacts" ); + public void execute() throws MojoExecutionException { + getLog().info("[MAVEN-CORE-IT-LOG] Resolving artifacts"); ResolverThread thread = new ResolverThread(); thread.start(); - while ( thread.isAlive() ) - { - try - { + while (thread.isAlive()) { + try { thread.join(); - } - catch ( InterruptedException e ) - { + } catch (InterruptedException e) { e.printStackTrace(); } } - if ( thread.error != null ) - { - throw new MojoExecutionException( "Failed to resolve artifacts: " + thread.error.getMessage(), - thread.error ); + if (thread.error != null) { + throw new MojoExecutionException("Failed to resolve artifacts: " + thread.error.getMessage(), thread.error); } - if ( propertiesFile != null ) - { - getLog().info( "[MAVEN-CORE-IT-LOG] Creating properties file " + propertiesFile ); + if (propertiesFile != null) { + getLog().info("[MAVEN-CORE-IT-LOG] Creating properties file " + propertiesFile); - try - { + try { propertiesFile.getParentFile().mkdirs(); - try ( FileOutputStream fos = new FileOutputStream( propertiesFile ) ) - { - thread.props.store( fos, "MAVEN-CORE-IT" ); + try (FileOutputStream fos = new FileOutputStream(propertiesFile)) { + thread.props.store(fos, "MAVEN-CORE-IT"); } - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Failed to create properties file: " + e.getMessage(), e ); + } catch (IOException e) { + throw new MojoExecutionException("Failed to create properties file: " + e.getMessage(), e); } } } - private String getId( Artifact artifact ) - { + private String getId(Artifact artifact) { artifact.isSnapshot(); // decouple from MNG-2961 return artifact.getId(); } - class ResolverThread - extends Thread - { + class ResolverThread extends Thread { Properties props = new Properties(); Exception error; - public void run() - { - if ( dependencies != null ) - { - try - { + public void run() { + if (dependencies != null) { + try { Set artifacts = new LinkedHashSet(); - for ( Dependency dependency : dependencies ) - { - Artifact artifact = - factory.createArtifactWithClassifier( dependency.getGroupId(), dependency.getArtifactId(), - dependency.getVersion(), dependency.getType(), - dependency.getClassifier() ); + for (Dependency dependency : dependencies) { + Artifact artifact = factory.createArtifactWithClassifier( + dependency.getGroupId(), + dependency.getArtifactId(), + dependency.getVersion(), + dependency.getType(), + dependency.getClassifier()); - getLog().info( - "[MAVEN-CORE-IT-LOG] Resolving " + ResolveTransitiveMojo.this.getId( artifact ) ); + getLog().info("[MAVEN-CORE-IT-LOG] Resolving " + ResolveTransitiveMojo.this.getId(artifact)); - artifacts.add( artifact ); + artifacts.add(artifact); } - Artifact origin = factory.createArtifact( "it", "it", "0.1", null, "pom" ); + Artifact origin = factory.createArtifact("it", "it", "0.1", null, "pom"); - artifacts = resolver.resolveTransitively( artifacts, origin, remoteRepositories, localRepository, - metadataSource ).getArtifacts(); + artifacts = resolver.resolveTransitively( + artifacts, origin, remoteRepositories, localRepository, metadataSource) + .getArtifacts(); - for ( Object artifact1 : artifacts ) - { + for (Object artifact1 : artifacts) { Artifact artifact = (Artifact) artifact1; - if ( artifact.getFile() != null ) - { - props.setProperty( ResolveTransitiveMojo.this.getId( artifact ), - artifact.getFile().getPath() ); + if (artifact.getFile() != null) { + props.setProperty( + ResolveTransitiveMojo.this.getId(artifact), + artifact.getFile().getPath()); } - getLog().info( "[MAVEN-CORE-IT-LOG] " + artifact.getFile() ); + getLog().info("[MAVEN-CORE-IT-LOG] " + artifact.getFile()); } - } - catch ( Exception e ) - { + } catch (Exception e) { error = e; } } } } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/SetMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/SetMojo.java index f44de09e64..95a14fc412 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/SetMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/SetMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,9 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; import org.apache.maven.artifact.Artifact; import org.apache.maven.plugin.AbstractMojo; @@ -28,32 +29,28 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; -import java.io.File; - /** * Sets the main artifact's file. This is the essence of the Maven JAR Plugin and all the other packaging plugins. * Creating the actual file for the main artifact is a specific plugin job and not related to the Maven core. * - * + * * @author Benjamin Bentmann * */ -@Mojo( name = "set", defaultPhase = LifecyclePhase.PACKAGE ) -public class SetMojo - extends AbstractMojo -{ +@Mojo(name = "set", defaultPhase = LifecyclePhase.PACKAGE) +public class SetMojo extends AbstractMojo { /** * The current Maven project. */ - @Parameter( defaultValue = "${project}", readonly = true, required = true ) + @Parameter(defaultValue = "${project}", readonly = true, required = true) private MavenProject project; /** * The path to the file to set as the main artifact, relative to the project base directory. The plugin will not * validate this path. */ - @Parameter( property = "artifact.mainFile", required = true ) + @Parameter(property = "artifact.mainFile", required = true) private String mainFile; /** @@ -61,34 +58,28 @@ public class SetMojo * * @throws MojoFailureException If the artifact file has not been set. */ - public void execute() - throws MojoExecutionException, MojoFailureException - { - getLog().info( "[MAVEN-CORE-IT-LOG] Setting main artifact file: " + mainFile ); + public void execute() throws MojoExecutionException, MojoFailureException { + getLog().info("[MAVEN-CORE-IT-LOG] Setting main artifact file: " + mainFile); - if ( mainFile == null || mainFile.length() <= 0 ) - { - throw new MojoFailureException( "Path name for main artifact file has not been specified" ); + if (mainFile == null || mainFile.length() <= 0) { + throw new MojoFailureException("Path name for main artifact file has not been specified"); } /* * NOTE: We do not want to test path translation here, so resolve relative paths manually. */ - File artifactFile = new File( mainFile ); - if ( !artifactFile.isAbsolute() ) - { - artifactFile = new File( project.getBasedir(), mainFile ); + File artifactFile = new File(mainFile); + if (!artifactFile.isAbsolute()) { + artifactFile = new File(project.getBasedir(), mainFile); } - if ( !artifactFile.exists() ) - { - getLog().warn( "[MAVEN-CORE-IT-LOG] Main artifact file does not exist: " + artifactFile ); + if (!artifactFile.exists()) { + getLog().warn("[MAVEN-CORE-IT-LOG] Main artifact file does not exist: " + artifactFile); } Artifact artifact = project.getArtifact(); - artifact.setFile( artifactFile ); + artifact.setFile(artifactFile); - getLog().info( "[MAVEN-CORE-IT-LOG] Set main artifact file: " + artifactFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Set main artifact file: " + artifactFile); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/dep-a/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/dep-a/pom.xml index 665ca5cad9..7aeadebad2 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/dep-a/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/dep-a/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 @@ -34,9 +32,7 @@ under the License. jar Maven IT Plugin :: Class Loader :: Dependency A - - A test dependency for the test plugin. - + A test dependency for the test plugin. 2008 diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/dep-a/src/main/java/org/apache/maven/plugin/coreit/ClassA.java b/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/dep-a/src/main/java/org/apache/maven/plugin/coreit/ClassA.java index 345ff4f475..bfd5649592 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/dep-a/src/main/java/org/apache/maven/plugin/coreit/ClassA.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/dep-a/src/main/java/org/apache/maven/plugin/coreit/ClassA.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; /** * A test class that is unique to this artifact. @@ -25,12 +24,9 @@ package org.apache.maven.plugin.coreit; * @author Benjamin Bentmann * */ -public class ClassA -{ +public class ClassA { - public static String methodA() - { + public static String methodA() { return "A"; } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/dep-a/src/main/java/org/apache/maven/plugin/coreit/SomeClass.java b/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/dep-a/src/main/java/org/apache/maven/plugin/coreit/SomeClass.java index 66ff79a988..4b932e3c18 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/dep-a/src/main/java/org/apache/maven/plugin/coreit/SomeClass.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/dep-a/src/main/java/org/apache/maven/plugin/coreit/SomeClass.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; /** * A test class that is not unique to this artifact. Other artifacts will deliberately contain an equally named @@ -26,12 +25,9 @@ package org.apache.maven.plugin.coreit; * @author Benjamin Bentmann * */ -public class SomeClass -{ +public class SomeClass { - public static String methodA() - { + public static String methodA() { return "A"; } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/dep-b/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/dep-b/pom.xml index 73434b74bb..703794c112 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/dep-b/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/dep-b/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 @@ -34,10 +32,8 @@ under the License. jar Maven IT Plugin :: Class Loader :: Dependency B - - A test dependency for the test plugin. This artifact has a dependency by itself to test transitive dependency - resolution. - + A test dependency for the test plugin. This artifact has a dependency by itself to test transitive dependency + resolution. 2008 diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/dep-b/src/main/java/org/apache/maven/plugin/coreit/ClassB.java b/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/dep-b/src/main/java/org/apache/maven/plugin/coreit/ClassB.java index 4ba9301343..b4daf294e9 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/dep-b/src/main/java/org/apache/maven/plugin/coreit/ClassB.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/dep-b/src/main/java/org/apache/maven/plugin/coreit/ClassB.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; /** * A test class that is unique to this artifact. @@ -25,12 +24,9 @@ package org.apache.maven.plugin.coreit; * @author Benjamin Bentmann * */ -public class ClassB -{ +public class ClassB { - public static String methodB() - { + public static String methodB() { return "B"; } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/dep-b/src/main/java/org/apache/maven/plugin/coreit/SomeClass.java b/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/dep-b/src/main/java/org/apache/maven/plugin/coreit/SomeClass.java index 58c4e8ed9e..c8efaa6f77 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/dep-b/src/main/java/org/apache/maven/plugin/coreit/SomeClass.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/dep-b/src/main/java/org/apache/maven/plugin/coreit/SomeClass.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; /** * A test class that is not unique to this artifact. Other artifacts will deliberately contain an equally named @@ -26,12 +25,9 @@ package org.apache.maven.plugin.coreit; * @author Benjamin Bentmann * */ -public class SomeClass -{ +public class SomeClass { - public static String methodB() - { + public static String methodB() { return "B"; } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/dep-c/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/dep-c/pom.xml index 4ad544b91a..e5859088f7 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/dep-c/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/dep-c/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 @@ -34,9 +32,7 @@ under the License. jar Maven IT Plugin :: Class Loader :: Dependency C - - A test dependency for the test plugin. - + A test dependency for the test plugin. 2008 diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/maven-it-plugin-class-loader/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/maven-it-plugin-class-loader/pom.xml index 29a6eb2d0d..9d5888c7cc 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/maven-it-plugin-class-loader/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/maven-it-plugin-class-loader/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 - - - - - - - - + + + + + + org.apache.maven.its.plugins maven-it-plugin-class-loader @@ -38,10 +35,8 @@ under the License. maven-plugin Maven IT Plugin :: Class Loader - - A test plugin that tries to load classes and/or resources via the plugin class loader or the thread's context class - loader. - + A test plugin that tries to load classes and/or resources via the plugin class loader or the thread's context class + loader. 2008 diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/maven-it-plugin-class-loader/src/main/java/org/apache/maven/plugin/coreit/AbstractLoadMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/maven-it-plugin-class-loader/src/main/java/org/apache/maven/plugin/coreit/AbstractLoadMojo.java index ee3a0ee0c6..1749a5b68a 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/maven-it-plugin-class-loader/src/main/java/org/apache/maven/plugin/coreit/AbstractLoadMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/maven-it-plugin-class-loader/src/main/java/org/apache/maven/plugin/coreit/AbstractLoadMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,10 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugins.annotations.Parameter; +package org.apache.maven.plugin.coreit; import java.io.File; import java.io.IOException; @@ -34,15 +29,17 @@ import java.util.Collections; import java.util.List; import java.util.Properties; +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugins.annotations.Parameter; + /** * Loads classes and/or resources from a class loader and records the results in a properties file. * * @author Benjamin Bentmann * */ -public abstract class AbstractLoadMojo - extends AbstractMojo -{ +public abstract class AbstractLoadMojo extends AbstractMojo { /** * The comma separated set of classes to load. For each specified qualified class name QCN that was @@ -51,7 +48,7 @@ public abstract class AbstractLoadMojo * comma separated list of all public methods declared directly in that class, in alphabetic order and possibly with * duplicates to account for overloaded methods. */ - @Parameter( property = "clsldr.classNames" ) + @Parameter(property = "clsldr.classNames") protected String classNames; /** @@ -60,7 +57,7 @@ public abstract class AbstractLoadMojo * the URL to the resource. In addition, the keys ARP.count, ARP.0, ARP.1 * etc. will enumerate all URLs matching the resource name. */ - @Parameter( property = "clsldr.resourcePaths" ) + @Parameter(property = "clsldr.resourcePaths") protected String resourcePaths; /** @@ -70,10 +67,8 @@ public abstract class AbstractLoadMojo * @param classLoader The class loader to use, must not be null. * @throws MojoExecutionException If the output file could not be created. */ - protected void execute( File outputFile, ClassLoader classLoader ) - throws MojoExecutionException - { - getLog().info( "[MAVEN-CORE-IT-LOG] Using class loader " + classLoader ); + protected void execute(File outputFile, ClassLoader classLoader) throws MojoExecutionException { + getLog().info("[MAVEN-CORE-IT-LOG] Using class loader " + classLoader); /* * NOTE: This one is a little subtle. For all properly implemented class loaders, loading a class/resource from @@ -85,118 +80,93 @@ public abstract class AbstractLoadMojo * loader will use a slightly different code path in the original class loader during parent delegation, thereby * increasing test coverage for its implementation. */ - ClassLoader childClassLoader = new URLClassLoader( new URL[0], classLoader ); + ClassLoader childClassLoader = new URLClassLoader(new URL[0], classLoader); Properties loaderProperties = new Properties(); - if ( classNames != null && classNames.length() > 0 ) - { - String[] names = classNames.split( "," ); - for ( String name : names ) - { - getLog().info( "[MAVEN-CORE-IT-LOG] Loading class " + name ); + if (classNames != null && classNames.length() > 0) { + String[] names = classNames.split(","); + for (String name : names) { + getLog().info("[MAVEN-CORE-IT-LOG] Loading class " + name); // test ClassLoader.loadClass(String) and (indirectly) ClassLoader.loadClass(String, boolean) - try - { - Class type = classLoader.loadClass( name ); - getLog().info( "[MAVEN-CORE-IT-LOG] Loaded class from " + type.getClassLoader() ); - try - { - if ( !type.equals( childClassLoader.loadClass( name ) ) ) - { - throw new ClassNotFoundException( name ); + try { + Class type = classLoader.loadClass(name); + getLog().info("[MAVEN-CORE-IT-LOG] Loaded class from " + type.getClassLoader()); + try { + if (!type.equals(childClassLoader.loadClass(name))) { + throw new ClassNotFoundException(name); } - } - catch ( ClassNotFoundException cnfe ) - { - getLog().error( "[MAVEN-CORE-IT-LOG] Detected class loader defect while loading " + name ); + } catch (ClassNotFoundException cnfe) { + getLog().error("[MAVEN-CORE-IT-LOG] Detected class loader defect while loading " + name); throw cnfe; } - loaderProperties.setProperty( name, "" + type.hashCode() ); + loaderProperties.setProperty(name, "" + type.hashCode()); Method[] methods = type.getDeclaredMethods(); List methodNames = new ArrayList(); - for ( Method method : methods ) - { - if ( Modifier.isPublic( method.getModifiers() ) ) - { - methodNames.add( method.getName() ); + for (Method method : methods) { + if (Modifier.isPublic(method.getModifiers())) { + methodNames.add(method.getName()); } } - Collections.sort( methodNames ); - StringBuilder buffer = new StringBuilder( 1024 ); - for ( Object methodName : methodNames ) - { - if ( buffer.length() > 0 ) - { - buffer.append( ',' ); + Collections.sort(methodNames); + StringBuilder buffer = new StringBuilder(1024); + for (Object methodName : methodNames) { + if (buffer.length() > 0) { + buffer.append(','); } - buffer.append( methodName ); + buffer.append(methodName); } - loaderProperties.setProperty( name + ".methods", buffer.toString() ); - } - catch ( ClassNotFoundException e ) - { + loaderProperties.setProperty(name + ".methods", buffer.toString()); + } catch (ClassNotFoundException e) { // ignore, will be reported by means of missing keys in the properties file - getLog().info( "[MAVEN-CORE-IT-LOG] Class not available" ); - } - catch ( LinkageError e ) - { + getLog().info("[MAVEN-CORE-IT-LOG] Class not available"); + } catch (LinkageError e) { // ignore, will be reported by means of missing keys in the properties file - getLog().info( "[MAVEN-CORE-IT-LOG] Class not linkable", e ); + getLog().info("[MAVEN-CORE-IT-LOG] Class not linkable", e); } } } - if ( resourcePaths != null && resourcePaths.length() > 0 ) - { - String[] paths = resourcePaths.split( "," ); - for ( String path : paths ) - { - getLog().info( "[MAVEN-CORE-IT-LOG] Loading resource " + path ); + if (resourcePaths != null && resourcePaths.length() > 0) { + String[] paths = resourcePaths.split(","); + for (String path : paths) { + getLog().info("[MAVEN-CORE-IT-LOG] Loading resource " + path); // test ClassLoader.getResource() - URL url = classLoader.getResource( path ); - getLog().info( "[MAVEN-CORE-IT-LOG] Loaded resource from " + url ); - if ( url != null && !url.equals( childClassLoader.getResource( path ) ) ) - { - getLog().error( "[MAVEN-CORE-IT-LOG] Detected class loader defect while getting " + path ); + URL url = classLoader.getResource(path); + getLog().info("[MAVEN-CORE-IT-LOG] Loaded resource from " + url); + if (url != null && !url.equals(childClassLoader.getResource(path))) { + getLog().error("[MAVEN-CORE-IT-LOG] Detected class loader defect while getting " + path); url = null; } - if ( url != null ) - { - loaderProperties.setProperty( path, url.toString() ); + if (url != null) { + loaderProperties.setProperty(path, url.toString()); } // test ClassLoader.getResources() - try - { - List urls = Collections.list( classLoader.getResources( path ) ); - if ( !urls.equals( Collections.list( childClassLoader.getResources( path ) ) ) ) - { - getLog().error( "[MAVEN-CORE-IT-LOG] Detected class loader defect while getting " + path ); + try { + List urls = Collections.list(classLoader.getResources(path)); + if (!urls.equals(Collections.list(childClassLoader.getResources(path)))) { + getLog().error("[MAVEN-CORE-IT-LOG] Detected class loader defect while getting " + path); urls = Collections.EMPTY_LIST; } - loaderProperties.setProperty( path + ".count", "" + urls.size() ); - for ( int j = 0; j < urls.size(); j++ ) - { - loaderProperties.setProperty( path + "." + j, urls.get( j ).toString() ); + loaderProperties.setProperty(path + ".count", "" + urls.size()); + for (int j = 0; j < urls.size(); j++) { + loaderProperties.setProperty(path + "." + j, urls.get(j).toString()); } - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Resources could not be enumerated: " + path, e ); + } catch (IOException e) { + throw new MojoExecutionException("Resources could not be enumerated: " + path, e); } } } - getLog().info( "[MAVEN-CORE-IT-LOG] Creating output file " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Creating output file " + outputFile); - PropertiesUtil.write( outputFile, loaderProperties ); + PropertiesUtil.write(outputFile, loaderProperties); - getLog().info( "[MAVEN-CORE-IT-LOG] Created output file " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Created output file " + outputFile); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/maven-it-plugin-class-loader/src/main/java/org/apache/maven/plugin/coreit/AssignmentCompatibleMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/maven-it-plugin-class-loader/src/main/java/org/apache/maven/plugin/coreit/AssignmentCompatibleMojo.java index cdf85eb44a..f78ccc60f6 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/maven-it-plugin-class-loader/src/main/java/org/apache/maven/plugin/coreit/AssignmentCompatibleMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/maven-it-plugin-class-loader/src/main/java/org/apache/maven/plugin/coreit/AssignmentCompatibleMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,10 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; +import java.util.Properties; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.Mojo; @@ -25,24 +27,19 @@ import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Parameter; -import java.io.File; -import java.util.Properties; - /** * Checks whether API classes exported by the Maven core are assignment-compatible with types loaded from the plugin * class loader. In other words, checks that types shared with the core realm are imported into the plugin realm. * * @author Benjamin Bentmann - */ -@org.apache.maven.plugins.annotations.Mojo( name = "assignment-compatible", defaultPhase = LifecyclePhase.INITIALIZE ) -public class AssignmentCompatibleMojo - extends AbstractMojo -{ + */ +@org.apache.maven.plugins.annotations.Mojo(name = "assignment-compatible", defaultPhase = LifecyclePhase.INITIALIZE) +public class AssignmentCompatibleMojo extends AbstractMojo { /** * The path to the properties file used to track the results of the assignment compatibility tests. */ - @Parameter( property = "clsldr.assigncompatPropertiesFile" ) + @Parameter(property = "clsldr.assigncompatPropertiesFile") private File assigncompatPropertiesFile; /** @@ -57,63 +54,50 @@ public class AssignmentCompatibleMojo * * @throws MojoExecutionException If the output file could not be created. */ - public void execute() - throws MojoExecutionException - { + public void execute() throws MojoExecutionException { ClassLoader coreRealm = Mojo.class.getClassLoader(); ClassLoader pluginRealm = getClass().getClassLoader(); - if ( coreRealm == pluginRealm ) - { - throw new MojoExecutionException( "Unexpected class loader hierarchy, could not detect core realm" ); + if (coreRealm == pluginRealm) { + throw new MojoExecutionException("Unexpected class loader hierarchy, could not detect core realm"); } Properties properties = new Properties(); - if ( classNames != null ) - { - for ( String className : classNames ) - { + if (classNames != null) { + for (String className : classNames) { String result; - getLog().info( "[MAVEN-CORE-IT-LOG] Loading class " + className ); + getLog().info("[MAVEN-CORE-IT-LOG] Loading class " + className); - try - { - Class type = pluginRealm.loadClass( className ); - result = getKey( type ); - } - catch ( ClassNotFoundException e ) - { + try { + Class type = pluginRealm.loadClass(className); + result = getKey(type); + } catch (ClassNotFoundException e) { result = ""; } - properties.setProperty( "plugin." + className, result ); - getLog().info( "[MAVEN-CORE-IT-LOG] plugin: " + result ); + properties.setProperty("plugin." + className, result); + getLog().info("[MAVEN-CORE-IT-LOG] plugin: " + result); - try - { - Class type = coreRealm.loadClass( className ); - result = getKey( type ); - } - catch ( ClassNotFoundException e ) - { + try { + Class type = coreRealm.loadClass(className); + result = getKey(type); + } catch (ClassNotFoundException e) { result = ""; } - properties.setProperty( "core." + className, result ); - getLog().info( "[MAVEN-CORE-IT-LOG] core : " + result ); + properties.setProperty("core." + className, result); + getLog().info("[MAVEN-CORE-IT-LOG] core : " + result); } } - getLog().info( "[MAVEN-CORE-IT-LOG] Creating output file " + assigncompatPropertiesFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Creating output file " + assigncompatPropertiesFile); - PropertiesUtil.write( assigncompatPropertiesFile, properties ); + PropertiesUtil.write(assigncompatPropertiesFile, properties); - getLog().info( "[MAVEN-CORE-IT-LOG] Created output file " + assigncompatPropertiesFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Created output file " + assigncompatPropertiesFile); } - private String getKey( Class type ) - { + private String getKey(Class type) { return type.hashCode() + "@" + type.getClassLoader().hashCode(); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/maven-it-plugin-class-loader/src/main/java/org/apache/maven/plugin/coreit/ExpressionUtil.java b/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/maven-it-plugin-class-loader/src/main/java/org/apache/maven/plugin/coreit/ExpressionUtil.java index 6e5738b3bf..6424dc4ffe 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/maven-it-plugin-class-loader/src/main/java/org/apache/maven/plugin/coreit/ExpressionUtil.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/maven-it-plugin-class-loader/src/main/java/org/apache/maven/plugin/coreit/ExpressionUtil.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; import java.lang.reflect.Array; import java.lang.reflect.Field; @@ -36,16 +35,15 @@ import java.util.Map; * @author Benjamin Bentmann * */ -class ExpressionUtil -{ +class ExpressionUtil { private static final Object[] NO_ARGS = {}; private static final Class[] NO_PARAMS = {}; - private static final Class[] OBJECT_PARAM = { Object.class }; + private static final Class[] OBJECT_PARAM = {Object.class}; - private static final Class[] STRING_PARAM = { String.class }; + private static final Class[] STRING_PARAM = {String.class}; /** * Evaluates the specified expression. Expressions are composed of segments which are separated by a forward slash @@ -61,14 +59,12 @@ class ExpressionUtil * @return The values of the evaluation, indexed by expression, or an empty map if the segments could not be * evaluated. */ - public static Map evaluate( String expression, Object context ) - { + public static Map evaluate(String expression, Object context) { Map values = Collections.EMPTY_MAP; - if ( expression != null && expression.length() > 0 ) - { - List segments = Arrays.asList( expression.split( "/", 0 ) ); - values = evaluate( "", segments, context ); + if (expression != null && expression.length() > 0) { + List segments = Arrays.asList(expression.split("/", 0)); + values = evaluate("", segments, context); } return values; @@ -83,80 +79,56 @@ class ExpressionUtil * @return The values of the evaluation, indexed by expression, or an empty map if the segments could not be * evaluated. */ - private static Map evaluate( String prefix, List segments, Object context ) - { + private static Map evaluate(String prefix, List segments, Object context) { Map values = Collections.EMPTY_MAP; - if ( segments.isEmpty() ) - { - values = Collections.singletonMap( prefix, context ); - } - else if ( context != null ) - { + if (segments.isEmpty()) { + values = Collections.singletonMap(prefix, context); + } else if (context != null) { Map targets = Collections.EMPTY_MAP; - String segment = (String) segments.get( 0 ); - if ( context.getClass().isArray() && Character.isDigit( segment.charAt( 0 ) ) ) - { - try - { - int index = Integer.parseInt( segment ); - targets = Collections.singletonMap( segment, Array.get( context, index ) ); - } - catch ( RuntimeException e ) - { + String segment = (String) segments.get(0); + if (context.getClass().isArray() && Character.isDigit(segment.charAt(0))) { + try { + int index = Integer.parseInt(segment); + targets = Collections.singletonMap(segment, Array.get(context, index)); + } catch (RuntimeException e) { // invalid index, just ignore } - } - else if ( ( context instanceof List ) && Character.isDigit( segment.charAt( 0 ) ) ) - { - try - { - int index = Integer.parseInt( segment ); - targets = Collections.singletonMap( segment, ( (List) context ).get( index ) ); - } - catch ( RuntimeException e ) - { + } else if ((context instanceof List) && Character.isDigit(segment.charAt(0))) { + try { + int index = Integer.parseInt(segment); + targets = Collections.singletonMap(segment, ((List) context).get(index)); + } catch (RuntimeException e) { // invalid index, just ignore } - } - else if ( ( context instanceof Collection ) && "*".equals( segment ) ) - { + } else if ((context instanceof Collection) && "*".equals(segment)) { targets = new LinkedHashMap(); int index = 0; - for ( Iterator it = ( (Collection) context ).iterator(); it.hasNext(); index++ ) - { - targets.put( Integer.toString( index ), it.next() ); + for (Iterator it = ((Collection) context).iterator(); it.hasNext(); index++) { + targets.put(Integer.toString(index), it.next()); } - } - else if ( context.getClass().isArray() && "*".equals( segment ) ) - { + } else if (context.getClass().isArray() && "*".equals(segment)) { targets = new LinkedHashMap(); - for ( int index = 0, n = Array.getLength( context ); index < n; index++ ) - { - targets.put( Integer.toString( index ), Array.get( context, index ) ); + for (int index = 0, n = Array.getLength(context); index < n; index++) { + targets.put(Integer.toString(index), Array.get(context, index)); } - } - else - { - targets = Collections.singletonMap( segment, getProperty( context, segment ) ); + } else { + targets = Collections.singletonMap(segment, getProperty(context, segment)); } values = new LinkedHashMap(); - for ( Object key : targets.keySet() ) - { - Object target = targets.get( key ); + for (Object key : targets.keySet()) { + Object target = targets.get(key); values.putAll( - evaluate( concat( prefix, String.valueOf( key ) ), segments.subList( 1, segments.size() ), - target ) ); + evaluate(concat(prefix, String.valueOf(key)), segments.subList(1, segments.size()), target)); } } return values; } - private static String concat( String prefix, String segment ) - { - return ( prefix == null || prefix.length() <= 0 ) ? segment : ( prefix + '/' + segment ); + private static String concat(String prefix, String segment) { + return (prefix == null || prefix.length() <= 0) ? segment : (prefix + '/' + segment); } /** @@ -166,78 +138,52 @@ class ExpressionUtil * @param property The name of the bean property, must not be null. * @return The value of the bean property or null if the property does not exist. */ - static Object getProperty( Object context, String property ) - { + static Object getProperty(Object context, String property) { Object value; Class type = context.getClass(); - if ( context instanceof Collection ) - { + if (context instanceof Collection) { type = Collection.class; - } - else if ( context instanceof Map ) - { + } else if (context instanceof Map) { type = Map.class; } - try - { - try - { - Method method = type.getMethod( property, NO_PARAMS ); - method.setAccessible( true ); - value = method.invoke( context, NO_ARGS ); - } - catch ( NoSuchMethodException e ) - { - try - { - String name = "get" + Character.toUpperCase( property.charAt( 0 ) ) + property.substring( 1 ); - Method method = type.getMethod( name, NO_PARAMS ); - method.setAccessible( true ); - value = method.invoke( context, NO_ARGS ); - } - catch ( NoSuchMethodException e1 ) - { - try - { - String name = "is" + Character.toUpperCase( property.charAt( 0 ) ) + property.substring( 1 ); - Method method = type.getMethod( name, NO_PARAMS ); - method.setAccessible( true ); - value = method.invoke( context, NO_ARGS ); - } - catch ( NoSuchMethodException e2 ) - { - try - { + try { + try { + Method method = type.getMethod(property, NO_PARAMS); + method.setAccessible(true); + value = method.invoke(context, NO_ARGS); + } catch (NoSuchMethodException e) { + try { + String name = "get" + Character.toUpperCase(property.charAt(0)) + property.substring(1); + Method method = type.getMethod(name, NO_PARAMS); + method.setAccessible(true); + value = method.invoke(context, NO_ARGS); + } catch (NoSuchMethodException e1) { + try { + String name = "is" + Character.toUpperCase(property.charAt(0)) + property.substring(1); + Method method = type.getMethod(name, NO_PARAMS); + method.setAccessible(true); + value = method.invoke(context, NO_ARGS); + } catch (NoSuchMethodException e2) { + try { Method method; - try - { - method = type.getMethod( "get", STRING_PARAM ); + try { + method = type.getMethod("get", STRING_PARAM); + } catch (NoSuchMethodException e3) { + method = type.getMethod("get", OBJECT_PARAM); } - catch ( NoSuchMethodException e3 ) - { - method = type.getMethod( "get", OBJECT_PARAM ); - } - method.setAccessible( true ); - value = method.invoke( context, new Object[]{ property } ); - } - catch ( NoSuchMethodException e3 ) - { - try - { - Field field = type.getField( property ); - field.setAccessible( true ); - value = field.get( context ); - } - catch ( NoSuchFieldException e4 ) - { - if ( "length".equals( property ) && type.isArray() ) - { - value = Array.getLength( context ); - } - else - { + method.setAccessible(true); + value = method.invoke(context, new Object[] {property}); + } catch (NoSuchMethodException e3) { + try { + Field field = type.getField(property); + field.setAccessible(true); + value = field.get(context); + } catch (NoSuchFieldException e4) { + if ("length".equals(property) && type.isArray()) { + value = Array.getLength(context); + } else { throw e4; } } @@ -245,12 +191,9 @@ class ExpressionUtil } } } - } - catch ( Exception e ) - { + } catch (Exception e) { value = null; } return value; } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/maven-it-plugin-class-loader/src/main/java/org/apache/maven/plugin/coreit/InstanceofMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/maven-it-plugin-class-loader/src/main/java/org/apache/maven/plugin/coreit/InstanceofMojo.java index bc887560c2..ed566bcf3d 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/maven-it-plugin-class-loader/src/main/java/org/apache/maven/plugin/coreit/InstanceofMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/maven-it-plugin-class-loader/src/main/java/org/apache/maven/plugin/coreit/InstanceofMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,13 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; @@ -27,35 +32,27 @@ import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; -import java.io.File; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Properties; - /** * Checks whether objects obtained from the Maven core are assignment-compatible with types loaded from the plugin class * loader. In other words, checks that types shared with the core realm are imported into the plugin realm. * * @author Benjamin Bentmann * - */ -@Mojo( name = "instanceof", defaultPhase = LifecyclePhase.INITIALIZE ) -public class InstanceofMojo - extends AbstractMojo -{ + */ +@Mojo(name = "instanceof", defaultPhase = LifecyclePhase.INITIALIZE) +public class InstanceofMojo extends AbstractMojo { /** * The path to the properties file used to track the results of the instanceof tests. */ - @Parameter( property = "clsldr.instanceofPropertiesFile" ) + @Parameter(property = "clsldr.instanceofPropertiesFile") private File instanceofPropertiesFile; /** * The qualified name of the type to which the objects should be assignment-compatible. This type will be loaded * from the plugin class loader, just like as if it was imported in the plugin source code. */ - @Parameter( property = "clsldr.className" ) + @Parameter(property = "clsldr.className") private String className; /** @@ -73,7 +70,7 @@ public class InstanceofMojo /** * The current Maven project against which expressions are evaluated. */ - @Parameter( defaultValue = "${project}", readonly = true ) + @Parameter(defaultValue = "${project}", readonly = true) private Object project; /** @@ -81,61 +78,54 @@ public class InstanceofMojo * * @throws MojoExecutionException If the output file could not be created. */ - public void execute() - throws MojoExecutionException, MojoFailureException - { + public void execute() throws MojoExecutionException, MojoFailureException { Class type; - try - { - getLog().info( "[MAVEN-CORE-IT-LOG] Loading class " + className ); - type = getClass().getClassLoader().loadClass( className ); - getLog().info( "[MAVEN-CORE-IT-LOG] Loaded class from " + type.getClassLoader() ); - } - catch ( ClassNotFoundException e ) - { - throw new MojoExecutionException( "Failed to load type " + className, e ); + try { + getLog().info("[MAVEN-CORE-IT-LOG] Loading class " + className); + type = getClass().getClassLoader().loadClass(className); + getLog().info("[MAVEN-CORE-IT-LOG] Loaded class from " + type.getClassLoader()); + } catch (ClassNotFoundException e) { + throw new MojoExecutionException("Failed to load type " + className, e); } Properties instanceofProperties = new Properties(); - if ( objectExpressions != null && objectExpressions.length > 0 ) - { + if (objectExpressions != null && objectExpressions.length > 0) { Map contexts = new HashMap(); - contexts.put( "project", project ); - contexts.put( "pom", project ); + contexts.put("project", project); + contexts.put("pom", project); - for ( String expression : objectExpressions ) - { - getLog().info( "[MAVEN-CORE-IT-LOG] Evaluating expression " + expression ); - Object object = ExpressionUtil.evaluate( expression, contexts ).get( expression ); - getLog().info( "[MAVEN-CORE-IT-LOG] Checking object " + object ); - if ( object != null ) - { - getLog().info( "[MAVEN-CORE-IT-LOG] Loaded class " + object.getClass().getName() ); - getLog().info( "[MAVEN-CORE-IT-LOG] Loaded class from " + object.getClass().getClassLoader() ); + for (String expression : objectExpressions) { + getLog().info("[MAVEN-CORE-IT-LOG] Evaluating expression " + expression); + Object object = ExpressionUtil.evaluate(expression, contexts).get(expression); + getLog().info("[MAVEN-CORE-IT-LOG] Checking object " + object); + if (object != null) { + getLog().info("[MAVEN-CORE-IT-LOG] Loaded class " + + object.getClass().getName()); + getLog().info("[MAVEN-CORE-IT-LOG] Loaded class from " + + object.getClass().getClassLoader()); } - instanceofProperties.setProperty( expression.replace( '/', '.' ), - Boolean.toString( type.isInstance( object ) ) ); + instanceofProperties.setProperty( + expression.replace('/', '.'), Boolean.toString(type.isInstance(object))); } } - if ( components != null && !components.isEmpty() ) - { - for ( Object object : components ) - { - getLog().info( "[MAVEN-CORE-IT-LOG] Checking component " + object ); - getLog().info( "[MAVEN-CORE-IT-LOG] Loaded class " + object.getClass().getName() ); - getLog().info( "[MAVEN-CORE-IT-LOG] Loaded class from " + object.getClass().getClassLoader() ); - instanceofProperties.setProperty( object.getClass().getName(), - Boolean.toString( type.isInstance( object ) ) ); + if (components != null && !components.isEmpty()) { + for (Object object : components) { + getLog().info("[MAVEN-CORE-IT-LOG] Checking component " + object); + getLog().info("[MAVEN-CORE-IT-LOG] Loaded class " + + object.getClass().getName()); + getLog().info("[MAVEN-CORE-IT-LOG] Loaded class from " + + object.getClass().getClassLoader()); + instanceofProperties.setProperty( + object.getClass().getName(), Boolean.toString(type.isInstance(object))); } } - getLog().info( "[MAVEN-CORE-IT-LOG] Creating output file " + instanceofPropertiesFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Creating output file " + instanceofPropertiesFile); - PropertiesUtil.write( instanceofPropertiesFile, instanceofProperties ); + PropertiesUtil.write(instanceofPropertiesFile, instanceofProperties); - getLog().info( "[MAVEN-CORE-IT-LOG] Created output file " + instanceofPropertiesFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Created output file " + instanceofPropertiesFile); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/maven-it-plugin-class-loader/src/main/java/org/apache/maven/plugin/coreit/LoadDependenciesMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/maven-it-plugin-class-loader/src/main/java/org/apache/maven/plugin/coreit/LoadDependenciesMojo.java index 4b33443a22..7485a4ffc7 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/maven-it-plugin-class-loader/src/main/java/org/apache/maven/plugin/coreit/LoadDependenciesMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/maven-it-plugin-class-loader/src/main/java/org/apache/maven/plugin/coreit/LoadDependenciesMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,12 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugins.annotations.LifecyclePhase; -import org.apache.maven.plugins.annotations.Mojo; -import org.apache.maven.plugins.annotations.Parameter; -import org.apache.maven.plugins.annotations.ResolutionScope; +package org.apache.maven.plugin.coreit; import java.io.File; import java.net.MalformedURLException; @@ -31,6 +24,12 @@ import java.net.URL; import java.net.URLClassLoader; import java.util.List; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.plugins.annotations.ResolutionScope; + /** * Loads classes and/or resources from a custom class loader that holds the project dependencies and records the results * in a properties file. @@ -38,23 +37,23 @@ import java.util.List; * @author Benjamin Bentmann * */ -@Mojo( name = "load-dependencies", defaultPhase = LifecyclePhase.INITIALIZE, - requiresDependencyResolution = ResolutionScope.COMPILE ) -public class LoadDependenciesMojo - extends AbstractLoadMojo -{ +@Mojo( + name = "load-dependencies", + defaultPhase = LifecyclePhase.INITIALIZE, + requiresDependencyResolution = ResolutionScope.COMPILE) +public class LoadDependenciesMojo extends AbstractLoadMojo { /** * The project's class path to load classes/resources from. */ - @Parameter( defaultValue = "${project.compileClasspathElements}", readonly = true ) + @Parameter(defaultValue = "${project.compileClasspathElements}", readonly = true) private List classPath; /** * The path to the properties file used to track the results of the class/resource loading via the project class * loader. */ - @Parameter( property = "clsldr.projectClassLoaderOutput" ) + @Parameter(property = "clsldr.projectClassLoaderOutput") private File projectClassLoaderOutput; /** @@ -62,36 +61,26 @@ public class LoadDependenciesMojo * * @throws MojoExecutionException If the output file could not be created. */ - public void execute() - throws MojoExecutionException - { + public void execute() throws MojoExecutionException { URL[] urls = new URL[classPath.size()]; - for ( int i = 0; i < urls.length; i++ ) - { - try - { - urls[i] = new File( (String) classPath.get( i ) ).toURI().toURL(); - getLog().info( "[MAVEN-CORE-IT-LOG] Using " + urls[i] ); - } - catch ( MalformedURLException e ) - { - getLog().error( "[MAVEN-CORE-IT-LOG] Failed to convert to URL " + classPath.get( i ), e ); + for (int i = 0; i < urls.length; i++) { + try { + urls[i] = new File((String) classPath.get(i)).toURI().toURL(); + getLog().info("[MAVEN-CORE-IT-LOG] Using " + urls[i]); + } catch (MalformedURLException e) { + getLog().error("[MAVEN-CORE-IT-LOG] Failed to convert to URL " + classPath.get(i), e); } } - ClassLoader projectClassLoader = new URLClassLoader( urls, getClass().getClassLoader() ); + ClassLoader projectClassLoader = new URLClassLoader(urls, getClass().getClassLoader()); ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); - try - { - Thread.currentThread().setContextClassLoader( projectClassLoader ); + try { + Thread.currentThread().setContextClassLoader(projectClassLoader); - execute( projectClassLoaderOutput, projectClassLoader ); - } - finally - { - Thread.currentThread().setContextClassLoader( contextClassLoader ); + execute(projectClassLoaderOutput, projectClassLoader); + } finally { + Thread.currentThread().setContextClassLoader(contextClassLoader); } } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/maven-it-plugin-class-loader/src/main/java/org/apache/maven/plugin/coreit/LoadMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/maven-it-plugin-class-loader/src/main/java/org/apache/maven/plugin/coreit/LoadMojo.java index 2db404714a..df2d193a3b 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/maven-it-plugin-class-loader/src/main/java/org/apache/maven/plugin/coreit/LoadMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/maven-it-plugin-class-loader/src/main/java/org/apache/maven/plugin/coreit/LoadMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,38 +16,37 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; -import java.io.File; - /** * Loads classes and/or resources from the plugin class path and records the results in a properties file. * - * + * * @author Benjamin Bentmann * */ -@Mojo( name = "load", defaultPhase = LifecyclePhase.INITIALIZE ) -public class LoadMojo - extends AbstractLoadMojo -{ +@Mojo(name = "load", defaultPhase = LifecyclePhase.INITIALIZE) +public class LoadMojo extends AbstractLoadMojo { /** * The path to the properties file used to track the results of the class/resource loading via the plugin class * loader. */ - @Parameter( property = "clsldr.pluginClassLoaderOutput" ) + @Parameter(property = "clsldr.pluginClassLoaderOutput") private File pluginClassLoaderOutput; /** * The path to the properties file used to track the results of the class/resource loading via the thread's context * class loader. */ - @Parameter( property = "clsldr.contextClassLoaderOutput" ) + @Parameter(property = "clsldr.contextClassLoaderOutput") private File contextClassLoaderOutput; /** @@ -57,17 +54,12 @@ public class LoadMojo * * @throws MojoExecutionException If the output file could not be created. */ - public void execute() - throws MojoExecutionException - { - if ( pluginClassLoaderOutput != null ) - { - execute( pluginClassLoaderOutput, getClass().getClassLoader() ); + public void execute() throws MojoExecutionException { + if (pluginClassLoaderOutput != null) { + execute(pluginClassLoaderOutput, getClass().getClassLoader()); } - if ( contextClassLoaderOutput != null ) - { - execute( contextClassLoaderOutput, Thread.currentThread().getContextClassLoader() ); + if (contextClassLoaderOutput != null) { + execute(contextClassLoaderOutput, Thread.currentThread().getContextClassLoader()); } } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/maven-it-plugin-class-loader/src/main/java/org/apache/maven/plugin/coreit/PropertiesUtil.java b/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/maven-it-plugin-class-loader/src/main/java/org/apache/maven/plugin/coreit/PropertiesUtil.java index dbdff7ff15..a4c0479135 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/maven-it-plugin-class-loader/src/main/java/org/apache/maven/plugin/coreit/PropertiesUtil.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/maven-it-plugin-class-loader/src/main/java/org/apache/maven/plugin/coreit/PropertiesUtil.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; import java.io.File; import java.io.FileOutputStream; @@ -33,37 +32,24 @@ import org.apache.maven.plugin.MojoExecutionException; * @author Benjamin Bentmann * */ -class PropertiesUtil -{ +class PropertiesUtil { - public static void write( File outputFile, Properties props ) - throws MojoExecutionException - { + public static void write(File outputFile, Properties props) throws MojoExecutionException { OutputStream out = null; - try - { + try { outputFile.getParentFile().mkdirs(); - out = new FileOutputStream( outputFile ); - props.store( out, "MAVEN-CORE-IT-LOG" ); - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Output file could not be created: " + outputFile, e ); - } - finally - { - if ( out != null ) - { - try - { + out = new FileOutputStream(outputFile); + props.store(out, "MAVEN-CORE-IT-LOG"); + } catch (IOException e) { + throw new MojoExecutionException("Output file could not be created: " + outputFile, e); + } finally { + if (out != null) { + try { out.close(); - } - catch ( IOException e ) - { + } catch (IOException e) { // just ignore } } } } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/maven-it-plugin-class-loader/src/main/java/org/apache/maven/plugin/coreit/TestComponent.java b/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/maven-it-plugin-class-loader/src/main/java/org/apache/maven/plugin/coreit/TestComponent.java index 6adc9a4c2c..c3b1b292d9 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/maven-it-plugin-class-loader/src/main/java/org/apache/maven/plugin/coreit/TestComponent.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/maven-it-plugin-class-loader/src/main/java/org/apache/maven/plugin/coreit/TestComponent.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,11 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; /** * A simple interface for our test components. * * @author Benjamin Bentmann */ -public interface TestComponent -{ - -} +public interface TestComponent {} diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/pom.xml index 659d1019ef..a849452f3e 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-class-loader/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 - maven-it-plugins org.apache.maven.its.plugins + maven-it-plugins 2.1-SNAPSHOT @@ -39,4 +37,29 @@ under the License. dep-b dep-c + + + + + + com.diffplug.spotless + spotless-maven-plugin + + + + src/main/java/**/*.java + maven-it-plugin-class-loader/src/main/java/**/*.java + + + + + pom.xml + maven-it-plugin-class-loader/pom.xml + + + + + + + diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-configuration/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-configuration/pom.xml index 455295a128..315c17b42a 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-configuration/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-configuration/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 - maven-it-plugins org.apache.maven.its.plugins + maven-it-plugins 2.1-SNAPSHOT @@ -32,10 +30,8 @@ under the License. maven-plugin Maven IT Plugin :: Configuration - - A plugin that allows any configuration in the form of a DOM which allows inspection after - configuration processing inside Maven's core. - + A plugin that allows any configuration in the form of a DOM which allows inspection after + configuration processing inside Maven's core. 2001 @@ -60,4 +56,3 @@ under the License. - diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-configuration/src/main/java/org/apache/maven/plugin/coreit/AppendConfigMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-configuration/src/main/java/org/apache/maven/plugin/coreit/AppendConfigMojo.java index 7e1873b422..3535c99298 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-configuration/src/main/java/org/apache/maven/plugin/coreit/AppendConfigMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-configuration/src/main/java/org/apache/maven/plugin/coreit/AppendConfigMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; import java.io.File; import java.util.List; @@ -34,45 +33,43 @@ import org.apache.maven.plugins.annotations.Parameter; /** * Appends this mojo's configuration into a properties file. * - * + * * @author Benjamin Bentmann * */ -@Mojo( name = "append-config", defaultPhase = LifecyclePhase.VALIDATE ) -public class AppendConfigMojo - extends AbstractMojo -{ +@Mojo(name = "append-config", defaultPhase = LifecyclePhase.VALIDATE) +public class AppendConfigMojo extends AbstractMojo { /** * The current project's base directory, used for path alignment. */ - @Parameter( defaultValue = "${basedir}", readonly = true ) + @Parameter(defaultValue = "${basedir}", readonly = true) private File basedir; /** * The path to the properties file into which to save the mojo configuration. Note: This intentionally uses * another parameter name for the output file than {@link ConfigMojo}. */ - @Parameter( property = "config.outputFile" ) + @Parameter(property = "config.outputFile") private File outputFile; /** * A parameter with a constant default value. Note: This has intentionally a different default value than * the equally named parameter from {@link ConfigMojo}. */ - @Parameter( defaultValue = "test" ) + @Parameter(defaultValue = "test") private String defaultParam; /** * A simple parameter of type {@link java.lang.String}. */ - @Parameter( property = "config.stringParam" ) + @Parameter(property = "config.stringParam") private String stringParam; /** * A simple parameter of type {@link java.io.File}. */ - @Parameter( property = "config.fileParam" ) + @Parameter(property = "config.fileParam") private File fileParam; /** @@ -122,30 +119,26 @@ public class AppendConfigMojo * * @throws MojoExecutionException If the output file could not be created. */ - public void execute() - throws MojoExecutionException - { - getLog().info( "[MAVEN-CORE-IT-LOG] Using output file path: " + outputFile ); + public void execute() throws MojoExecutionException { + getLog().info("[MAVEN-CORE-IT-LOG] Using output file path: " + outputFile); - if ( outputFile == null ) - { - throw new MojoExecutionException( "Path name for output file has not been specified" ); + if (outputFile == null) { + throw new MojoExecutionException("Path name for output file has not been specified"); } - if ( !outputFile.isAbsolute() ) - { - outputFile = new File( basedir, outputFile.getPath() ).getAbsoluteFile(); + if (!outputFile.isAbsolute()) { + outputFile = new File(basedir, outputFile.getPath()).getAbsoluteFile(); } - Properties configProps = PropertiesUtil.read( outputFile ); + Properties configProps = PropertiesUtil.read(outputFile); - dumpConfiguration( configProps ); + dumpConfiguration(configProps); - getLog().info( "[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile); - PropertiesUtil.write( outputFile, configProps ); + PropertiesUtil.write(outputFile, configProps); - getLog().info( "[MAVEN-CORE-IT-LOG] Created output file: " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Created output file: " + outputFile); } /** @@ -153,22 +146,20 @@ public class AppendConfigMojo * * @param props The properties to dump the configuration into, must not be null. */ - private void dumpConfiguration( Properties props ) - { + private void dumpConfiguration(Properties props) { /* * NOTE: This intentionally does not dump the absolute path of a file to check the actual value that was * injected by Maven. */ - PropertiesUtil.serialize( props, "propertiesFile", outputFile ); - PropertiesUtil.serialize( props, "defaultParam", defaultParam ); - PropertiesUtil.serialize( props, "stringParam", stringParam ); - PropertiesUtil.serialize( props, "fileParam", fileParam ); - PropertiesUtil.serialize( props, "stringParams", stringParams ); - PropertiesUtil.serialize( props, "fileParams", fileParams ); - PropertiesUtil.serialize( props, "listParam", listParam ); - PropertiesUtil.serialize( props, "setParam", setParam ); - PropertiesUtil.serialize( props, "mapParam", mapParam ); - PropertiesUtil.serialize( props, "propertiesParam", propertiesParam ); + PropertiesUtil.serialize(props, "propertiesFile", outputFile); + PropertiesUtil.serialize(props, "defaultParam", defaultParam); + PropertiesUtil.serialize(props, "stringParam", stringParam); + PropertiesUtil.serialize(props, "fileParam", fileParam); + PropertiesUtil.serialize(props, "stringParams", stringParams); + PropertiesUtil.serialize(props, "fileParams", fileParams); + PropertiesUtil.serialize(props, "listParam", listParam); + PropertiesUtil.serialize(props, "setParam", setParam); + PropertiesUtil.serialize(props, "mapParam", mapParam); + PropertiesUtil.serialize(props, "propertiesParam", propertiesParam); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-configuration/src/main/java/org/apache/maven/plugin/coreit/Bean.java b/its/core-it-support/core-it-plugins/maven-it-plugin-configuration/src/main/java/org/apache/maven/plugin/coreit/Bean.java index 8529d3a8dc..df154e1c0a 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-configuration/src/main/java/org/apache/maven/plugin/coreit/Bean.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-configuration/src/main/java/org/apache/maven/plugin/coreit/Bean.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; /** * A bean to receive mojo configuration. @@ -25,8 +24,7 @@ package org.apache.maven.plugin.coreit; * @author Benjamin Bentmann * */ -public class Bean -{ +public class Bean { String fieldParam; @@ -34,22 +32,18 @@ public class Bean boolean setterCalled; - public void set( String value ) - { + public void set(String value) { fieldParam = value; setterCalled = true; } - public void setSetterParam( String value ) - { + public void setSetterParam(String value) { setterParam = value; setterCalled = true; } - public String toString() - { - return getClass().getName() + "[fieldParam=" + fieldParam + ", setterParam=" + setterParam - + ", setterCalled=" + setterCalled + "]"; + public String toString() { + return getClass().getName() + "[fieldParam=" + fieldParam + ", setterParam=" + setterParam + ", setterCalled=" + + setterCalled + "]"; } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-configuration/src/main/java/org/apache/maven/plugin/coreit/CliConfigMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-configuration/src/main/java/org/apache/maven/plugin/coreit/CliConfigMojo.java index 807f017bb7..cd2fc4217e 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-configuration/src/main/java/org/apache/maven/plugin/coreit/CliConfigMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-configuration/src/main/java/org/apache/maven/plugin/coreit/CliConfigMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; import java.io.File; import java.util.List; @@ -33,61 +32,59 @@ import org.apache.maven.plugins.annotations.Parameter; /** * Dumps this mojo's configuration into a properties file. * - * + * * @author Benjamin Bentmann * */ -@Mojo( name = "cli-config", defaultPhase = LifecyclePhase.VALIDATE ) -public class CliConfigMojo - extends AbstractMojo -{ +@Mojo(name = "cli-config", defaultPhase = LifecyclePhase.VALIDATE) +public class CliConfigMojo extends AbstractMojo { /** * The current project's base directory, used for path alignment. */ - @Parameter( defaultValue = "${basedir}", readonly = true ) + @Parameter(defaultValue = "${basedir}", readonly = true) private File basedir; /** * The path to the properties file into which to save the mojo configuration. */ - @Parameter( property = "config.propertiesFile" ) + @Parameter(property = "config.propertiesFile") private File propertiesFile; /** * A simple parameter of type {@link java.lang.String}. */ - @Parameter( property = "config.stringParam" ) + @Parameter(property = "config.stringParam") private String stringParam; /** * A simple parameter of type {@link java.io.File}. */ - @Parameter( property = "config.fileParam" ) + @Parameter(property = "config.fileParam") private File fileParam; /** * An array parameter of component type {@link java.lang.String}. */ - @Parameter( property = "config.stringParams" ) + @Parameter(property = "config.stringParams") private String[] stringParams; /** * An array parameter of component type {@link java.io.File}. */ - @Parameter( property = "config.fileParams" ) + @Parameter(property = "config.fileParams") private File[] fileParams; /** * A collection parameter of type {@link java.util.List}. */ - @Parameter( property = "config.listParam" ) + @Parameter(property = "config.listParam") private List listParam; /** * A collection parameter of type {@link java.util.Set}. */ - @Parameter( property = "config.setParam" ) + @Parameter(property = "config.setParam") private Set setParam; /** @@ -95,30 +92,26 @@ public class CliConfigMojo * * @throws MojoExecutionException If the output file could not be created. */ - public void execute() - throws MojoExecutionException - { - getLog().info( "[MAVEN-CORE-IT-LOG] Using output file path: " + propertiesFile ); + public void execute() throws MojoExecutionException { + getLog().info("[MAVEN-CORE-IT-LOG] Using output file path: " + propertiesFile); - if ( propertiesFile == null ) - { - throw new MojoExecutionException( "Path name for output file has not been specified" ); + if (propertiesFile == null) { + throw new MojoExecutionException("Path name for output file has not been specified"); } - if ( !propertiesFile.isAbsolute() ) - { - propertiesFile = new File( basedir, propertiesFile.getPath() ).getAbsoluteFile(); + if (!propertiesFile.isAbsolute()) { + propertiesFile = new File(basedir, propertiesFile.getPath()).getAbsoluteFile(); } Properties configProps = new Properties(); - dumpConfiguration( configProps ); + dumpConfiguration(configProps); - getLog().info( "[MAVEN-CORE-IT-LOG] Creating output file: " + propertiesFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Creating output file: " + propertiesFile); - PropertiesUtil.write( propertiesFile, configProps ); + PropertiesUtil.write(propertiesFile, configProps); - getLog().info( "[MAVEN-CORE-IT-LOG] Created output file: " + propertiesFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Created output file: " + propertiesFile); } /** @@ -126,19 +119,17 @@ public class CliConfigMojo * * @param props The properties to dump the configuration into, must not be null. */ - private void dumpConfiguration( Properties props ) - { + private void dumpConfiguration(Properties props) { /* * NOTE: This intentionally does not dump the absolute path of a file to check the actual value that was * injected by Maven. */ - PropertiesUtil.serialize( props, "propertiesFile", propertiesFile ); - PropertiesUtil.serialize( props, "stringParam", stringParam ); - PropertiesUtil.serialize( props, "fileParam", fileParam ); - PropertiesUtil.serialize( props, "stringParams", stringParams ); - PropertiesUtil.serialize( props, "fileParams", fileParams ); - PropertiesUtil.serialize( props, "listParam", listParam ); - PropertiesUtil.serialize( props, "setParam", setParam ); + PropertiesUtil.serialize(props, "propertiesFile", propertiesFile); + PropertiesUtil.serialize(props, "stringParam", stringParam); + PropertiesUtil.serialize(props, "fileParam", fileParam); + PropertiesUtil.serialize(props, "stringParams", stringParams); + PropertiesUtil.serialize(props, "fileParams", fileParams); + PropertiesUtil.serialize(props, "listParam", listParam); + PropertiesUtil.serialize(props, "setParam", setParam); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-configuration/src/main/java/org/apache/maven/plugin/coreit/ConfigMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-configuration/src/main/java/org/apache/maven/plugin/coreit/ConfigMojo.java index 1d7ba48bae..3b3fc8a47e 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-configuration/src/main/java/org/apache/maven/plugin/coreit/ConfigMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-configuration/src/main/java/org/apache/maven/plugin/coreit/ConfigMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugins.annotations.LifecyclePhase; -import org.apache.maven.plugins.annotations.Mojo; -import org.apache.maven.plugins.annotations.Parameter; -import org.codehaus.plexus.configuration.PlexusConfiguration; +package org.apache.maven.plugin.coreit; import java.io.File; import java.net.URI; @@ -35,135 +27,140 @@ import java.util.Map; import java.util.Properties; import java.util.Set; +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; +import org.codehaus.plexus.configuration.PlexusConfiguration; + /** * Dumps this mojo's configuration into a properties file. * * @author Benjamin Bentmann * - */ -@Mojo( name = "config", defaultPhase = LifecyclePhase.VALIDATE ) -public class ConfigMojo - extends AbstractMojo -{ + */ +@Mojo(name = "config", defaultPhase = LifecyclePhase.VALIDATE) +public class ConfigMojo extends AbstractMojo { /** * The current project's base directory, used for path alignment. */ - @Parameter( defaultValue = "${basedir}", readonly = true ) + @Parameter(defaultValue = "${basedir}", readonly = true) private File basedir; /** * The path to the properties file into which to save the mojo configuration. */ - @Parameter( property = "config.propertiesFile" ) + @Parameter(property = "config.propertiesFile") private File propertiesFile; /** * A parameter with an alias. */ - @Parameter( alias = "aliasParamLegacy" ) + @Parameter(alias = "aliasParamLegacy") private String aliasParam; /** * A parameter with a constant default value. */ - @Parameter( defaultValue = "maven-core-it" ) + @Parameter(defaultValue = "maven-core-it") private String defaultParam; /** * A parameter with a default value using multiple expressions. */ - @Parameter( defaultValue = "${project.groupId}:${project.artifactId}:${project.version}" ) + @Parameter(defaultValue = "${project.groupId}:${project.artifactId}:${project.version}") private String defaultParamWithExpression; /** * A parameter that combines all of the annotations. */ - @Parameter( alias = "fullyAnnotatedParam", property = "config.aliasDefaultExpressionParam", defaultValue = "test" ) + @Parameter(alias = "fullyAnnotatedParam", property = "config.aliasDefaultExpressionParam", defaultValue = "test") private String aliasDefaultExpressionParam; /** * A simple parameter of type {@link java.lang.Boolean}. */ - @Parameter( property = "config.booleanParam" ) + @Parameter(property = "config.booleanParam") private Boolean booleanParam; /** * A simple parameter of type {@link java.lang.Boolean#TYPE}. */ - @Parameter( property = "config.primitiveBooleanParam" ) + @Parameter(property = "config.primitiveBooleanParam") private boolean primitiveBooleanParam; /** * A simple parameter of type {@link java.lang.Byte}. */ - @Parameter( property = "config.byteParam" ) + @Parameter(property = "config.byteParam") private Byte byteParam; /** * A simple parameter of type {@link java.lang.Short}. */ - @Parameter( property = "config.shortParam" ) + @Parameter(property = "config.shortParam") private Short shortParam; /** * A simple parameter of type {@link java.lang.Integer}. */ - @Parameter( property = "config.integerParam" ) + @Parameter(property = "config.integerParam") private Integer integerParam; /** * A simple parameter of type {@link java.lang.Integer#TYPE}. */ - @Parameter( property = "config.primitiveIntegerParam" ) + @Parameter(property = "config.primitiveIntegerParam") private int primitiveIntegerParam; /** * A simple parameter of type {@link java.lang.Long}. */ - @Parameter( property = "config.longParam" ) + @Parameter(property = "config.longParam") private Long longParam; /** * A simple parameter of type {@link java.lang.Float}. */ - @Parameter( property = "config.floatParam" ) + @Parameter(property = "config.floatParam") private Float floatParam; /** * A simple parameter of type {@link java.lang.Double}. */ - @Parameter( property = "config.doubleParam" ) + @Parameter(property = "config.doubleParam") private Double doubleParam; /** * A simple parameter of type {@link java.lang.Character}. */ - @Parameter( property = "config.characterParam" ) + @Parameter(property = "config.characterParam") private Character characterParam; /** * A simple parameter of type {@link java.lang.String}. */ - @Parameter( property = "config.stringParam" ) + @Parameter(property = "config.stringParam") private String stringParam; /** * A simple parameter of type {@link java.io.File}. */ - @Parameter( property = "config.fileParam" ) + @Parameter(property = "config.fileParam") private File fileParam; /** * A simple parameter of type {@link java.util.Date}. */ - @Parameter( property = "config.dateParam" ) + @Parameter(property = "config.dateParam") private Date dateParam; /** * A simple parameter of type {@link java.net.URL}. */ - @Parameter( property = "config.urlParam" ) + @Parameter(property = "config.urlParam") private URL urlParam; /** @@ -218,7 +215,7 @@ public class ConfigMojo /** * A complex parameter with an alias. */ - @Parameter( alias = "aliasStringParamsLegacy" ) + @Parameter(alias = "aliasStringParamsLegacy") private String[] aliasStringParams; /** @@ -240,30 +237,26 @@ public class ConfigMojo * * @throws MojoExecutionException If the output file could not be created. */ - public void execute() - throws MojoExecutionException - { - getLog().info( "[MAVEN-CORE-IT-LOG] Using output file path: " + propertiesFile ); + public void execute() throws MojoExecutionException { + getLog().info("[MAVEN-CORE-IT-LOG] Using output file path: " + propertiesFile); - if ( propertiesFile == null ) - { - throw new MojoExecutionException( "Path name for output file has not been specified" ); + if (propertiesFile == null) { + throw new MojoExecutionException("Path name for output file has not been specified"); } - if ( !propertiesFile.isAbsolute() ) - { - propertiesFile = new File( basedir, propertiesFile.getPath() ).getAbsoluteFile(); + if (!propertiesFile.isAbsolute()) { + propertiesFile = new File(basedir, propertiesFile.getPath()).getAbsoluteFile(); } Properties configProps = new Properties(); - dumpConfiguration( configProps ); + dumpConfiguration(configProps); - getLog().info( "[MAVEN-CORE-IT-LOG] Creating output file: " + propertiesFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Creating output file: " + propertiesFile); - PropertiesUtil.write( propertiesFile, configProps ); + PropertiesUtil.write(propertiesFile, configProps); - getLog().info( "[MAVEN-CORE-IT-LOG] Created output file: " + propertiesFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Created output file: " + propertiesFile); } /** @@ -271,52 +264,47 @@ public class ConfigMojo * * @param props The properties to dump the configuration into, must not be null. */ - private void dumpConfiguration( Properties props ) - { + private void dumpConfiguration(Properties props) { /* * NOTE: This intentionally does not dump the absolute path of a file to check the actual value that was * injected by Maven. */ - PropertiesUtil.serialize( props, "propertiesFile", propertiesFile ); - PropertiesUtil.serialize( props, "aliasParam", aliasParam ); - PropertiesUtil.serialize( props, "defaultParam", defaultParam ); - PropertiesUtil.serialize( props, "defaultParamWithExpression", defaultParamWithExpression ); - PropertiesUtil.serialize( props, "aliasDefaultExpressionParam", aliasDefaultExpressionParam ); - PropertiesUtil.serialize( props, "booleanParam", booleanParam ); - if ( primitiveBooleanParam ) - { - PropertiesUtil.serialize( props, "primitiveBooleanParam", primitiveBooleanParam ); + PropertiesUtil.serialize(props, "propertiesFile", propertiesFile); + PropertiesUtil.serialize(props, "aliasParam", aliasParam); + PropertiesUtil.serialize(props, "defaultParam", defaultParam); + PropertiesUtil.serialize(props, "defaultParamWithExpression", defaultParamWithExpression); + PropertiesUtil.serialize(props, "aliasDefaultExpressionParam", aliasDefaultExpressionParam); + PropertiesUtil.serialize(props, "booleanParam", booleanParam); + if (primitiveBooleanParam) { + PropertiesUtil.serialize(props, "primitiveBooleanParam", primitiveBooleanParam); } - PropertiesUtil.serialize( props, "byteParam", byteParam ); - PropertiesUtil.serialize( props, "shortParam", shortParam ); - PropertiesUtil.serialize( props, "integerParam", integerParam ); - if ( primitiveIntegerParam != 0 ) - { - PropertiesUtil.serialize( props, "primitiveIntegerParam", primitiveIntegerParam ); + PropertiesUtil.serialize(props, "byteParam", byteParam); + PropertiesUtil.serialize(props, "shortParam", shortParam); + PropertiesUtil.serialize(props, "integerParam", integerParam); + if (primitiveIntegerParam != 0) { + PropertiesUtil.serialize(props, "primitiveIntegerParam", primitiveIntegerParam); } - PropertiesUtil.serialize( props, "longParam", longParam ); - PropertiesUtil.serialize( props, "floatParam", floatParam ); - PropertiesUtil.serialize( props, "doubleParam", doubleParam ); - PropertiesUtil.serialize( props, "characterParam", characterParam ); - PropertiesUtil.serialize( props, "stringParam", stringParam ); - PropertiesUtil.serialize( props, "fileParam", fileParam ); - PropertiesUtil.serialize( props, "dateParam", dateParam ); - PropertiesUtil.serialize( props, "urlParam", urlParam ); - PropertiesUtil.serialize( props, "uriParam", uriParam ); - PropertiesUtil.serialize( props, "stringParams", stringParams ); - PropertiesUtil.serialize( props, "fileParams", fileParams ); - PropertiesUtil.serialize( props, "listParam", listParam ); - PropertiesUtil.serialize( props, "setParam", setParam ); - PropertiesUtil.serialize( props, "mapParam", mapParam ); - PropertiesUtil.serialize( props, "propertiesParam", propertiesParam ); - PropertiesUtil.serialize( props, "aliasStringParams", aliasStringParams ); - PropertiesUtil.serialize( props, "domParam", domParam ); - if ( beanParam != null ) - { - PropertiesUtil.serialize( props, "beanParam.fieldParam", beanParam.fieldParam ); - PropertiesUtil.serialize( props, "beanParam.setterParam", beanParam.setterParam ); - PropertiesUtil.serialize( props, "beanParam.setterCalled", beanParam.setterCalled ); + PropertiesUtil.serialize(props, "longParam", longParam); + PropertiesUtil.serialize(props, "floatParam", floatParam); + PropertiesUtil.serialize(props, "doubleParam", doubleParam); + PropertiesUtil.serialize(props, "characterParam", characterParam); + PropertiesUtil.serialize(props, "stringParam", stringParam); + PropertiesUtil.serialize(props, "fileParam", fileParam); + PropertiesUtil.serialize(props, "dateParam", dateParam); + PropertiesUtil.serialize(props, "urlParam", urlParam); + PropertiesUtil.serialize(props, "uriParam", uriParam); + PropertiesUtil.serialize(props, "stringParams", stringParams); + PropertiesUtil.serialize(props, "fileParams", fileParams); + PropertiesUtil.serialize(props, "listParam", listParam); + PropertiesUtil.serialize(props, "setParam", setParam); + PropertiesUtil.serialize(props, "mapParam", mapParam); + PropertiesUtil.serialize(props, "propertiesParam", propertiesParam); + PropertiesUtil.serialize(props, "aliasStringParams", aliasStringParams); + PropertiesUtil.serialize(props, "domParam", domParam); + if (beanParam != null) { + PropertiesUtil.serialize(props, "beanParam.fieldParam", beanParam.fieldParam); + PropertiesUtil.serialize(props, "beanParam.setterParam", beanParam.setterParam); + PropertiesUtil.serialize(props, "beanParam.setterCalled", beanParam.setterCalled); } } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-configuration/src/main/java/org/apache/maven/plugin/coreit/CustomComponentConfigurator.java b/its/core-it-support/core-it-plugins/maven-it-plugin-configuration/src/main/java/org/apache/maven/plugin/coreit/CustomComponentConfigurator.java index e4336586b8..2991685464 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-configuration/src/main/java/org/apache/maven/plugin/coreit/CustomComponentConfigurator.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-configuration/src/main/java/org/apache/maven/plugin/coreit/CustomComponentConfigurator.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; import org.codehaus.plexus.classworlds.realm.ClassRealm; import org.codehaus.plexus.component.annotations.Component; @@ -34,26 +33,24 @@ import org.codehaus.plexus.configuration.PlexusConfiguration; * * @author Benjamin Bentmann */ -@Component ( role = org.codehaus.plexus.component.configurator.ComponentConfigurator.class, hint = "coreit" ) -public class CustomComponentConfigurator - extends AbstractComponentConfigurator -{ +@Component(role = org.codehaus.plexus.component.configurator.ComponentConfigurator.class, hint = "coreit") +public class CustomComponentConfigurator extends AbstractComponentConfigurator { @Override - public void configureComponent( Object component, PlexusConfiguration configuration, - ExpressionEvaluator expressionEvaluator, ClassRealm containerRealm, - ConfigurationListener listener ) - throws ComponentConfigurationException - { + public void configureComponent( + Object component, + PlexusConfiguration configuration, + ExpressionEvaluator expressionEvaluator, + ClassRealm containerRealm, + ConfigurationListener listener) + throws ComponentConfigurationException { ObjectWithFieldsConverter converter = new ObjectWithFieldsConverter(); - converter.processConfiguration( converterLookup, component, containerRealm, configuration, - expressionEvaluator, listener ); + converter.processConfiguration( + converterLookup, component, containerRealm, configuration, expressionEvaluator, listener); - if ( component instanceof CustomConfigMojo ) - { - ( (CustomConfigMojo) component ).customParam = "configured"; + if (component instanceof CustomConfigMojo) { + ((CustomConfigMojo) component).customParam = "configured"; } } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-configuration/src/main/java/org/apache/maven/plugin/coreit/CustomConfigMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-configuration/src/main/java/org/apache/maven/plugin/coreit/CustomConfigMojo.java index 82c1e8218f..f7f46d5b70 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-configuration/src/main/java/org/apache/maven/plugin/coreit/CustomConfigMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-configuration/src/main/java/org/apache/maven/plugin/coreit/CustomConfigMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; import java.io.File; import java.util.List; @@ -37,21 +36,19 @@ import org.apache.maven.plugins.annotations.Parameter; * @author Benjamin Bentmann * */ -@Mojo( name = "custom-config", defaultPhase = LifecyclePhase.VALIDATE, configurator = "coreit" ) -public class CustomConfigMojo - extends AbstractMojo -{ +@Mojo(name = "custom-config", defaultPhase = LifecyclePhase.VALIDATE, configurator = "coreit") +public class CustomConfigMojo extends AbstractMojo { /** * The current project's base directory, used for path alignment. */ - @Parameter( defaultValue = "${basedir}", readonly = true ) + @Parameter(defaultValue = "${basedir}", readonly = true) private File basedir; /** * The path to the properties file into which to save the mojo configuration. */ - @Parameter( property = "config.propertiesFile" ) + @Parameter(property = "config.propertiesFile") private File propertiesFile; /** @@ -64,19 +61,19 @@ public class CustomConfigMojo * A parameter with a constant default value. Note: This has intentionally a different default value than * the equally named parameter from {@link ConfigMojo}. */ - @Parameter( defaultValue = "test" ) + @Parameter(defaultValue = "test") private String defaultParam; /** * A simple parameter of type {@link java.lang.String}. */ - @Parameter( property = "config.stringParam" ) + @Parameter(property = "config.stringParam") private String stringParam; /** * A simple parameter of type {@link java.io.File}. */ - @Parameter( property = "config.fileParam" ) + @Parameter(property = "config.fileParam") private File fileParam; /** @@ -126,30 +123,26 @@ public class CustomConfigMojo * * @throws MojoExecutionException If the output file could not be created. */ - public void execute() - throws MojoExecutionException - { - getLog().info( "[MAVEN-CORE-IT-LOG] Using output file path: " + propertiesFile ); + public void execute() throws MojoExecutionException { + getLog().info("[MAVEN-CORE-IT-LOG] Using output file path: " + propertiesFile); - if ( propertiesFile == null ) - { - throw new MojoExecutionException( "Path name for output file has not been specified" ); + if (propertiesFile == null) { + throw new MojoExecutionException("Path name for output file has not been specified"); } - if ( !propertiesFile.isAbsolute() ) - { - propertiesFile = new File( basedir, propertiesFile.getPath() ).getAbsoluteFile(); + if (!propertiesFile.isAbsolute()) { + propertiesFile = new File(basedir, propertiesFile.getPath()).getAbsoluteFile(); } Properties configProps = new Properties(); - dumpConfiguration( configProps ); + dumpConfiguration(configProps); - getLog().info( "[MAVEN-CORE-IT-LOG] Creating output file: " + propertiesFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Creating output file: " + propertiesFile); - PropertiesUtil.write( propertiesFile, configProps ); + PropertiesUtil.write(propertiesFile, configProps); - getLog().info( "[MAVEN-CORE-IT-LOG] Created output file: " + propertiesFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Created output file: " + propertiesFile); } /** @@ -157,23 +150,21 @@ public class CustomConfigMojo * * @param props The properties to dump the configuration into, must not be null. */ - private void dumpConfiguration( Properties props ) - { + private void dumpConfiguration(Properties props) { /* * NOTE: This intentionally does not dump the absolute path of a file to check the actual value that was * injected by Maven. */ - PropertiesUtil.serialize( props, "propertiesFile", propertiesFile ); - PropertiesUtil.serialize( props, "customParam", customParam ); - PropertiesUtil.serialize( props, "defaultParam", defaultParam ); - PropertiesUtil.serialize( props, "stringParam", stringParam ); - PropertiesUtil.serialize( props, "fileParam", fileParam ); - PropertiesUtil.serialize( props, "stringParams", stringParams ); - PropertiesUtil.serialize( props, "fileParams", fileParams ); - PropertiesUtil.serialize( props, "listParam", listParam ); - PropertiesUtil.serialize( props, "setParam", setParam ); - PropertiesUtil.serialize( props, "mapParam", mapParam ); - PropertiesUtil.serialize( props, "propertiesParam", propertiesParam ); + PropertiesUtil.serialize(props, "propertiesFile", propertiesFile); + PropertiesUtil.serialize(props, "customParam", customParam); + PropertiesUtil.serialize(props, "defaultParam", defaultParam); + PropertiesUtil.serialize(props, "stringParam", stringParam); + PropertiesUtil.serialize(props, "fileParam", fileParam); + PropertiesUtil.serialize(props, "stringParams", stringParams); + PropertiesUtil.serialize(props, "fileParams", fileParams); + PropertiesUtil.serialize(props, "listParam", listParam); + PropertiesUtil.serialize(props, "setParam", setParam); + PropertiesUtil.serialize(props, "mapParam", mapParam); + PropertiesUtil.serialize(props, "propertiesParam", propertiesParam); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-configuration/src/main/java/org/apache/maven/plugin/coreit/DeprecatedConfigMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-configuration/src/main/java/org/apache/maven/plugin/coreit/DeprecatedConfigMojo.java index f94ec9fca3..ad8744aaf6 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-configuration/src/main/java/org/apache/maven/plugin/coreit/DeprecatedConfigMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-configuration/src/main/java/org/apache/maven/plugin/coreit/DeprecatedConfigMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; import java.io.File; import java.util.List; @@ -39,33 +38,31 @@ import org.apache.maven.plugins.annotations.Parameter; * @deprecated This goal is deprecated */ @Deprecated -@Mojo( name = "deprecated-config", defaultPhase = LifecyclePhase.VALIDATE ) -public class DeprecatedConfigMojo - extends AbstractMojo -{ +@Mojo(name = "deprecated-config", defaultPhase = LifecyclePhase.VALIDATE) +public class DeprecatedConfigMojo extends AbstractMojo { /** * The current project's base directory, used for path alignment. */ - @Parameter( defaultValue = "${basedir}", readonly = true ) + @Parameter(defaultValue = "${basedir}", readonly = true) private File basedir; /** * @deprecated bean read only */ - @Parameter( defaultValue = "${project.artifact}", readonly = true ) + @Parameter(defaultValue = "${project.artifact}", readonly = true) private Artifact deprecatedBeanReadOnly; /** * @deprecated bean */ - @Parameter( defaultValue = "${project.artifact}" ) + @Parameter(defaultValue = "${project.artifact}") private Artifact deprecatedBean; /** * The path to the properties file into which to save the mojo configuration. */ - @Parameter( defaultValue = "${project.build.directory}/config.properties" ) + @Parameter(defaultValue = "${project.build.directory}/config.properties") private File propertiesFile; /** @@ -83,7 +80,7 @@ public class DeprecatedConfigMojo * @deprecated */ @Deprecated - @Parameter( property = "config.deprecatedParam2" ) + @Parameter(property = "config.deprecatedParam2") private String deprecatedParam2; /** @@ -92,7 +89,7 @@ public class DeprecatedConfigMojo * @deprecated deprecated with constant value */ @Deprecated - @Parameter( defaultValue = "testValue" ) + @Parameter(defaultValue = "testValue") private String deprecatedParamWithDefaultConstant; /** @@ -101,21 +98,21 @@ public class DeprecatedConfigMojo * @deprecated deprecated with evaluate value */ @Deprecated - @Parameter( defaultValue = "${project.url}" ) + @Parameter(defaultValue = "${project.url}") private String deprecatedParamWithDefaultEvaluate; /** * @deprecated deprecated array */ @Deprecated - @Parameter( property = "config.deprecatedArray" ) + @Parameter(property = "config.deprecatedArray") private String[] deprecatedArray; /** * @deprecated deprecated array */ @Deprecated - @Parameter( defaultValue = "a1 ,a2, a3" ) + @Parameter(defaultValue = "a1 ,a2, a3") private String[] deprecatedArrayWithDefaults; /** @@ -136,14 +133,14 @@ public class DeprecatedConfigMojo * @deprecated deprecated list */ @Deprecated - @Parameter( property = "config.deprecatedList" ) + @Parameter(property = "config.deprecatedList") private List deprecatedList; /** * @deprecated deprecated list */ @Deprecated - @Parameter( defaultValue = "l1,l2,l3" ) + @Parameter(defaultValue = "l1,l2,l3") private List deprecatedListWithDefaults; /** @@ -151,30 +148,26 @@ public class DeprecatedConfigMojo * * @throws MojoExecutionException If the output file could not be created. */ - public void execute() - throws MojoExecutionException - { - getLog().info( "[MAVEN-CORE-IT-LOG] Using output file path: " + propertiesFile ); + public void execute() throws MojoExecutionException { + getLog().info("[MAVEN-CORE-IT-LOG] Using output file path: " + propertiesFile); - if ( propertiesFile == null ) - { - throw new MojoExecutionException( "Path name for output file has not been specified" ); + if (propertiesFile == null) { + throw new MojoExecutionException("Path name for output file has not been specified"); } - if ( !propertiesFile.isAbsolute() ) - { - propertiesFile = new File( basedir, propertiesFile.getPath() ).getAbsoluteFile(); + if (!propertiesFile.isAbsolute()) { + propertiesFile = new File(basedir, propertiesFile.getPath()).getAbsoluteFile(); } Properties configProps = new Properties(); - dumpConfiguration( configProps ); + dumpConfiguration(configProps); - getLog().info( "[MAVEN-CORE-IT-LOG] Creating output file: " + propertiesFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Creating output file: " + propertiesFile); - PropertiesUtil.write( propertiesFile, configProps ); + PropertiesUtil.write(propertiesFile, configProps); - getLog().info( "[MAVEN-CORE-IT-LOG] Created output file: " + propertiesFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Created output file: " + propertiesFile); } /** @@ -182,19 +175,17 @@ public class DeprecatedConfigMojo * * @param props The properties to dump the configuration into, must not be null. */ - @SuppressWarnings( "deprecation" ) - private void dumpConfiguration( Properties props ) - { - PropertiesUtil.serialize( props, "deprecatedParam", deprecatedParam ); - PropertiesUtil.serialize( props, "deprecatedParam2", deprecatedParam2 ); - PropertiesUtil.serialize( props, "deprecatedParamWithDefaultConstant", deprecatedParamWithDefaultConstant ); - PropertiesUtil.serialize( props, "deprecatedParamWithDefaultEvaluate", deprecatedParamWithDefaultEvaluate ); - PropertiesUtil.serialize( props, "deprecatedArray", deprecatedArray ); - PropertiesUtil.serialize( props, "deprecatedArrayWithDefaults", deprecatedArrayWithDefaults ); - PropertiesUtil.serialize( props, "deprecatedProperties", deprecatedProperties ); - PropertiesUtil.serialize( props, "deprecatedList", deprecatedList ); - PropertiesUtil.serialize( props, "deprecatedListWithDefaults", deprecatedListWithDefaults ); - PropertiesUtil.serialize( props, "deprecatedMap", deprecatedMap ); + @SuppressWarnings("deprecation") + private void dumpConfiguration(Properties props) { + PropertiesUtil.serialize(props, "deprecatedParam", deprecatedParam); + PropertiesUtil.serialize(props, "deprecatedParam2", deprecatedParam2); + PropertiesUtil.serialize(props, "deprecatedParamWithDefaultConstant", deprecatedParamWithDefaultConstant); + PropertiesUtil.serialize(props, "deprecatedParamWithDefaultEvaluate", deprecatedParamWithDefaultEvaluate); + PropertiesUtil.serialize(props, "deprecatedArray", deprecatedArray); + PropertiesUtil.serialize(props, "deprecatedArrayWithDefaults", deprecatedArrayWithDefaults); + PropertiesUtil.serialize(props, "deprecatedProperties", deprecatedProperties); + PropertiesUtil.serialize(props, "deprecatedList", deprecatedList); + PropertiesUtil.serialize(props, "deprecatedListWithDefaults", deprecatedListWithDefaults); + PropertiesUtil.serialize(props, "deprecatedMap", deprecatedMap); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-configuration/src/main/java/org/apache/maven/plugin/coreit/PropertiesUtil.java b/its/core-it-support/core-it-plugins/maven-it-plugin-configuration/src/main/java/org/apache/maven/plugin/coreit/PropertiesUtil.java index caf27d83bc..7d29f7b026 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-configuration/src/main/java/org/apache/maven/plugin/coreit/PropertiesUtil.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-configuration/src/main/java/org/apache/maven/plugin/coreit/PropertiesUtil.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,9 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.plugin.MojoExecutionException; -import org.codehaus.plexus.configuration.PlexusConfiguration; +package org.apache.maven.plugin.coreit; import java.io.File; import java.io.FileInputStream; @@ -37,42 +33,32 @@ import java.util.Iterator; import java.util.Map; import java.util.Properties; +import org.apache.maven.plugin.MojoExecutionException; +import org.codehaus.plexus.configuration.PlexusConfiguration; + /** * Assists in handling properties. * * @author Benjamin Bentmann */ -class PropertiesUtil -{ +class PropertiesUtil { - public static Properties read( File inputFile ) - throws MojoExecutionException - { + public static Properties read(File inputFile) throws MojoExecutionException { Properties props = new Properties(); - if ( inputFile.exists() ) - { + if (inputFile.exists()) { InputStream is = null; - try - { - is = new FileInputStream( inputFile ); - props.load( is ); - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Input file " + inputFile + " could not be read: " + e.getMessage(), - e ); - } - finally - { - if ( is != null ) - { - try - { + try { + is = new FileInputStream(inputFile); + props.load(is); + } catch (IOException e) { + throw new MojoExecutionException( + "Input file " + inputFile + " could not be read: " + e.getMessage(), e); + } finally { + if (is != null) { + try { is.close(); - } - catch ( IOException e ) - { + } catch (IOException e) { // just ignore } } @@ -82,109 +68,78 @@ class PropertiesUtil return props; } - public static void write( File outputFile, Properties props ) - throws MojoExecutionException - { + public static void write(File outputFile, Properties props) throws MojoExecutionException { OutputStream os = null; - try - { + try { outputFile.getParentFile().mkdirs(); - os = new FileOutputStream( outputFile ); - props.store( os, "MAVEN-CORE-IT-LOG" ); - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Output file " + outputFile + " could not be created: " + e.getMessage(), - e ); - } - finally - { - if ( os != null ) - { - try - { + os = new FileOutputStream(outputFile); + props.store(os, "MAVEN-CORE-IT-LOG"); + } catch (IOException e) { + throw new MojoExecutionException( + "Output file " + outputFile + " could not be created: " + e.getMessage(), e); + } finally { + if (os != null) { + try { os.close(); - } - catch ( IOException e ) - { + } catch (IOException e) { // just ignore } } } } - public static void serialize( Properties props, String key, Object value ) - { - if ( value != null && value.getClass().isArray() ) - { - props.setProperty( key, Integer.toString( Array.getLength( value ) ) ); - for ( int i = Array.getLength( value ) - 1; i >= 0; i-- ) - { - serialize( props, key + "." + i, Array.get( value, i ) ); + public static void serialize(Properties props, String key, Object value) { + if (value != null && value.getClass().isArray()) { + props.setProperty(key, Integer.toString(Array.getLength(value))); + for (int i = Array.getLength(value) - 1; i >= 0; i--) { + serialize(props, key + "." + i, Array.get(value, i)); } - } - else if ( value instanceof Collection ) - { + } else if (value instanceof Collection) { Collection collection = (Collection) value; - props.setProperty( key, Integer.toString( collection.size() ) ); + props.setProperty(key, Integer.toString(collection.size())); int i = 0; - for ( Iterator it = collection.iterator(); it.hasNext(); i++ ) - { - serialize( props, key + "." + i, it.next() ); + for (Iterator it = collection.iterator(); it.hasNext(); i++) { + serialize(props, key + "." + i, it.next()); } - } - else if ( value instanceof Map ) - { + } else if (value instanceof Map) { Map map = (Map) value; - props.setProperty( key, Integer.toString( map.size() ) ); + props.setProperty(key, Integer.toString(map.size())); int i = 0; - for ( Iterator it = map.keySet().iterator(); it.hasNext(); i++ ) - { + for (Iterator it = map.keySet().iterator(); it.hasNext(); i++) { Object k = it.next(); - Object v = map.get( k ); - serialize( props, key + "." + k, v ); + Object v = map.get(k); + serialize(props, key + "." + k, v); } - } - else if ( value instanceof PlexusConfiguration ) - { + } else if (value instanceof PlexusConfiguration) { PlexusConfiguration config = (PlexusConfiguration) value; - String val = config.getValue( null ); - if ( val != null ) - { - props.setProperty( key + ".value", val ); + String val = config.getValue(null); + if (val != null) { + props.setProperty(key + ".value", val); } String[] attributes = config.getAttributeNames(); - props.setProperty( key + ".attributes", Integer.toString( attributes.length ) ); - for ( int i = attributes.length - 1; i >= 0; i-- ) - { - props.setProperty( key + ".attributes." + attributes[i], config.getAttribute( attributes[i], "" ) ); + props.setProperty(key + ".attributes", Integer.toString(attributes.length)); + for (int i = attributes.length - 1; i >= 0; i--) { + props.setProperty(key + ".attributes." + attributes[i], config.getAttribute(attributes[i], "")); } PlexusConfiguration children[] = config.getChildren(); - props.setProperty( key + ".children", Integer.toString( children.length ) ); + props.setProperty(key + ".children", Integer.toString(children.length)); Map indices = new HashMap<>(); - for ( PlexusConfiguration child : children ) - { + for (PlexusConfiguration child : children) { String name = child.getName(); - Integer index = indices.get( name ); - if ( index == null ) - { + Integer index = indices.get(name); + if (index == null) { index = 0; } - serialize( props, key + ".children." + name + "." + index, child ); - indices.put( name, index + 1 ); + serialize(props, key + ".children." + name + "." + index, child); + indices.put(name, index + 1); } - } - else if ( value instanceof Date ) - { - props.setProperty( key, new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" ).format( (Date) value ) ); - } - else if ( value != null ) - { - props.setProperty( key, value.toString() ); + } else if (value instanceof Date) { + props.setProperty(key, new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format((Date) value)); + } else if (value != null) { + props.setProperty(key, value.toString()); } } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-configuration/src/main/java/org/apache/maven/plugin/coreit/ReadOnlyConfigMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-configuration/src/main/java/org/apache/maven/plugin/coreit/ReadOnlyConfigMojo.java index 5b7405e631..b25920fa0a 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-configuration/src/main/java/org/apache/maven/plugin/coreit/ReadOnlyConfigMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-configuration/src/main/java/org/apache/maven/plugin/coreit/ReadOnlyConfigMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugins.annotations.LifecyclePhase; @@ -29,30 +28,28 @@ import org.apache.maven.plugins.annotations.Parameter; * * @author Slawomir Jaranowski */ -@Mojo( name = "read-only-config", defaultPhase = LifecyclePhase.VALIDATE ) -public class ReadOnlyConfigMojo extends AbstractMojo -{ +@Mojo(name = "read-only-config", defaultPhase = LifecyclePhase.VALIDATE) +public class ReadOnlyConfigMojo extends AbstractMojo { /** * Only such has sense ... */ - @Parameter( defaultValue = "${project.version}", readonly = true ) + @Parameter(defaultValue = "${project.version}", readonly = true) String readOnlyWithDefault; /** * strange definition ... but possible */ - @Parameter( readonly = true ) + @Parameter(readonly = true) private String readOnlyWithOutDefaults; - @Parameter( property = "project.version", readonly = true ) + @Parameter(property = "project.version", readonly = true) String readOnlyWithProperty; - @Parameter( property = "user.property", readonly = true ) + @Parameter(property = "user.property", readonly = true) String readOnlyWithUserProperty; @Override - public void execute() - { - getLog().info( "[MAVEN-CORE-IT-LOG]" ); + public void execute() { + getLog().info("[MAVEN-CORE-IT-LOG]"); } } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-configuration/src/main/java/org/apache/maven/plugin/coreit/RequiredConfigMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-configuration/src/main/java/org/apache/maven/plugin/coreit/RequiredConfigMojo.java index 5e48e1432e..17addb5360 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-configuration/src/main/java/org/apache/maven/plugin/coreit/RequiredConfigMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-configuration/src/main/java/org/apache/maven/plugin/coreit/RequiredConfigMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; import java.io.File; import java.util.Properties; @@ -31,36 +30,34 @@ import org.apache.maven.plugins.annotations.Parameter; /** * Dumps this mojo's configuration into a properties file. * - * + * * @author Benjamin Bentmann */ -@Mojo( name = "required-config", defaultPhase = LifecyclePhase.VALIDATE ) -public class RequiredConfigMojo - extends AbstractMojo -{ +@Mojo(name = "required-config", defaultPhase = LifecyclePhase.VALIDATE) +public class RequiredConfigMojo extends AbstractMojo { /** * The current project's base directory, used for path alignment. */ - @Parameter( defaultValue = "${basedir}", readonly = true ) + @Parameter(defaultValue = "${basedir}", readonly = true) private File basedir; /** * The path to the properties file into which to save the mojo configuration. */ - @Parameter( property = "config.propertiesFile" ) + @Parameter(property = "config.propertiesFile") private File propertiesFile; /** * A required parameter to be set via plugin configuration in POM or system property from CLI. */ - @Parameter( property = "config.requiredParam", required = true ) + @Parameter(property = "config.requiredParam", required = true) private String requiredParam; /** * A required parameter that defaults to a non-mandatory value from the POM. */ - @Parameter( defaultValue = "${project.url}", required = true ) + @Parameter(defaultValue = "${project.url}", required = true) private String requiredParamWithDefault; /** @@ -68,30 +65,26 @@ public class RequiredConfigMojo * * @throws MojoExecutionException If the output file could not be created. */ - public void execute() - throws MojoExecutionException - { - getLog().info( "[MAVEN-CORE-IT-LOG] Using output file path: " + propertiesFile ); + public void execute() throws MojoExecutionException { + getLog().info("[MAVEN-CORE-IT-LOG] Using output file path: " + propertiesFile); - if ( propertiesFile == null ) - { - throw new MojoExecutionException( "Path name for output file has not been specified" ); + if (propertiesFile == null) { + throw new MojoExecutionException("Path name for output file has not been specified"); } - if ( !propertiesFile.isAbsolute() ) - { - propertiesFile = new File( basedir, propertiesFile.getPath() ).getAbsoluteFile(); + if (!propertiesFile.isAbsolute()) { + propertiesFile = new File(basedir, propertiesFile.getPath()).getAbsoluteFile(); } Properties configProps = new Properties(); - dumpConfiguration( configProps ); + dumpConfiguration(configProps); - getLog().info( "[MAVEN-CORE-IT-LOG] Creating output file: " + propertiesFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Creating output file: " + propertiesFile); - PropertiesUtil.write( propertiesFile, configProps ); + PropertiesUtil.write(propertiesFile, configProps); - getLog().info( "[MAVEN-CORE-IT-LOG] Created output file: " + propertiesFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Created output file: " + propertiesFile); } /** @@ -99,10 +92,8 @@ public class RequiredConfigMojo * * @param props The properties to dump the configuration into, must not be null. */ - private void dumpConfiguration( Properties props ) - { - PropertiesUtil.serialize( props, "requiredParam", requiredParam ); - PropertiesUtil.serialize( props, "requiredParamWithDefault", requiredParamWithDefault ); + private void dumpConfiguration(Properties props) { + PropertiesUtil.serialize(props, "requiredParam", requiredParam); + PropertiesUtil.serialize(props, "requiredParamWithDefault", requiredParamWithDefault); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-configuration/src/main/java/org/apache/maven/plugin/coreit/TouchMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-configuration/src/main/java/org/apache/maven/plugin/coreit/TouchMojo.java index 5cdf0e6626..5cdcfa6584 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-configuration/src/main/java/org/apache/maven/plugin/coreit/TouchMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-configuration/src/main/java/org/apache/maven/plugin/coreit/TouchMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; import java.io.File; import java.io.IOException; @@ -33,41 +32,30 @@ import org.apache.maven.plugins.annotations.Parameter; * * @author Slawomir Jaranowski */ -@Mojo( name = "touch", defaultPhase = LifecyclePhase.VALIDATE ) -public class TouchMojo - extends AbstractMojo -{ - @Parameter( defaultValue = "${project.build.directory}" ) +@Mojo(name = "touch", defaultPhase = LifecyclePhase.VALIDATE) +public class TouchMojo extends AbstractMojo { + @Parameter(defaultValue = "${project.build.directory}") private File outputDirectory; - @Parameter( alias = "validParameterAlias" ) + @Parameter(alias = "validParameterAlias") private String validParameter; - public void execute() - throws MojoExecutionException - { - - getLog().info( "[MAVEN-CORE-IT-LOG] Using output directory " + outputDirectory ); - touch( outputDirectory, "touch.txt" ); + public void execute() throws MojoExecutionException { + getLog().info("[MAVEN-CORE-IT-LOG] Using output directory " + outputDirectory); + touch(outputDirectory, "touch.txt"); } - static void touch( File dir, String file ) - throws MojoExecutionException - { - try - { - if ( !dir.exists() ) - { + static void touch(File dir, String file) throws MojoExecutionException { + try { + if (!dir.exists()) { dir.mkdirs(); } - File touch = new File( dir, file ); + File touch = new File(dir, file); touch.createNewFile(); - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Error touching file", e ); + } catch (IOException e) { + throw new MojoExecutionException("Error touching file", e); } } } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-context-passing/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-context-passing/pom.xml index f90f53a67e..0ce541a22c 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-context-passing/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-context-passing/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 - maven-it-plugins org.apache.maven.its.plugins + maven-it-plugins 2.1-SNAPSHOT diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-context-passing/src/main/java/org/apache/maven/plugin/coreit/CatchMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-context-passing/src/main/java/org/apache/maven/plugin/coreit/CatchMojo.java index b1817b83e5..b0789f3a54 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-context-passing/src/main/java/org/apache/maven/plugin/coreit/CatchMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-context-passing/src/main/java/org/apache/maven/plugin/coreit/CatchMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,81 +16,65 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugins.annotations.Mojo; -import org.apache.maven.plugins.annotations.Parameter; +package org.apache.maven.plugin.coreit; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.Writer; +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; + /** * "Catch" a parameter "thrown" by the ThrowMojo through the plugin context, and * write a file based on it's value to the build output directory. * */ -@Mojo( name = "catch" ) -public class CatchMojo - extends AbstractMojo -{ +@Mojo(name = "catch") +public class CatchMojo extends AbstractMojo { /** */ - @Parameter( defaultValue = "${project.build.directory}", readonly = true, required = true ) + @Parameter(defaultValue = "${project.build.directory}", readonly = true, required = true) private File outDir; - public File getOutDir() - { + public File getOutDir() { return outDir; } - public void setOutDir( File outDir ) - { + public void setOutDir(File outDir) { this.outDir = outDir; } - public void execute() - throws MojoExecutionException - { - String value = (String) getPluginContext().get( ThrowMojo.THROWN_PARAMETER ); + public void execute() throws MojoExecutionException { + String value = (String) getPluginContext().get(ThrowMojo.THROWN_PARAMETER); - if ( !outDir.exists() ) - { + if (!outDir.exists()) { outDir.mkdirs(); } - File outfile = new File( outDir, value ); + File outfile = new File(outDir, value); Writer writer = null; - try - { - writer = new FileWriter( outfile ); + try { + writer = new FileWriter(outfile); - writer.write( value ); + writer.write(value); writer.flush(); - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Cannot write output file: " + outfile, e ); - } - finally - { - if ( writer != null ) - { - try - { + } catch (IOException e) { + throw new MojoExecutionException("Cannot write output file: " + outfile, e); + } finally { + if (writer != null) { + try { writer.close(); - } - catch ( IOException e ) - { + } catch (IOException e) { // ignore } } } } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-context-passing/src/main/java/org/apache/maven/plugin/coreit/ThrowMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-context-passing/src/main/java/org/apache/maven/plugin/coreit/ThrowMojo.java index 4ef764a210..c78b6c4175 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-context-passing/src/main/java/org/apache/maven/plugin/coreit/ThrowMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-context-passing/src/main/java/org/apache/maven/plugin/coreit/ThrowMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; @@ -29,32 +28,25 @@ import org.apache.maven.plugins.annotations.Parameter; * pick up and process. * */ -@Mojo( name = "throw" ) -public class ThrowMojo - extends AbstractMojo -{ +@Mojo(name = "throw") +public class ThrowMojo extends AbstractMojo { public static final String THROWN_PARAMETER = "throw-parameter"; /** */ - @Parameter( property = "value", defaultValue = "thrown" ) + @Parameter(property = "value", defaultValue = "thrown") private String value; - public void setValue( String value ) - { + public void setValue(String value) { this.value = value; } - public String getValue() - { + public String getValue() { return value; } - public void execute() - throws MojoExecutionException - { - getPluginContext().put( THROWN_PARAMETER, value ); + public void execute() throws MojoExecutionException { + getPluginContext().put(THROWN_PARAMETER, value); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-clean-plugin/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-clean-plugin/pom.xml index f73697dc26..9889663118 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-clean-plugin/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-clean-plugin/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 @@ -34,10 +32,8 @@ under the License. maven-plugin Maven IT Clean Plugin Stub - - A test plugin that has the same coordinates and goals as the Maven Clean Plugin. Its goals only create marker - files to check the principle invocation of the goals via the build lifecycle binding. - + A test plugin that has the same coordinates and goals as the Maven Clean Plugin. Its goals only create marker + files to check the principle invocation of the goals via the build lifecycle binding. 2008 diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-clean-plugin/src/main/java/org/apache/maven/plugin/coreit/CleanMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-clean-plugin/src/main/java/org/apache/maven/plugin/coreit/CleanMojo.java index aaf2d3e0fc..ec70b87b2e 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-clean-plugin/src/main/java/org/apache/maven/plugin/coreit/CleanMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-clean-plugin/src/main/java/org/apache/maven/plugin/coreit/CleanMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,10 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; +import java.io.IOException; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; @@ -27,25 +29,20 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; -import java.io.File; -import java.io.IOException; - /** * Creates a text file in the project base directory. * - * + * * @author Benjamin Bentmann * */ -@Mojo( name = "clean", defaultPhase = LifecyclePhase.CLEAN ) -public class CleanMojo - extends AbstractMojo -{ +@Mojo(name = "clean", defaultPhase = LifecyclePhase.CLEAN) +public class CleanMojo extends AbstractMojo { /** * The current Maven project. */ - @Parameter( defaultValue = "${project}", required = true, readonly = true ) + @Parameter(defaultValue = "${project}", required = true, readonly = true) private MavenProject project; /** @@ -61,35 +58,27 @@ public class CleanMojo * @throws MojoExecutionException If the output file could not be created. * @throws MojoFailureException If the output file has not been set. */ - public void execute() - throws MojoExecutionException, MojoFailureException - { - getLog().info( "[MAVEN-CORE-IT-LOG] Using output file path: " + pathname ); + public void execute() throws MojoExecutionException, MojoFailureException { + getLog().info("[MAVEN-CORE-IT-LOG] Using output file path: " + pathname); - if ( pathname == null || pathname.length() <= 0 ) - { - throw new MojoFailureException( "Path name for output file has not been specified" ); + if (pathname == null || pathname.length() <= 0) { + throw new MojoFailureException("Path name for output file has not been specified"); } - File outputFile = new File( pathname ); - if ( !outputFile.isAbsolute() ) - { - outputFile = new File( project.getBasedir(), pathname ).getAbsoluteFile(); + File outputFile = new File(pathname); + if (!outputFile.isAbsolute()) { + outputFile = new File(project.getBasedir(), pathname).getAbsoluteFile(); } - getLog().info( "[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile); - try - { - outputFile.getParentFile().mkdirs(); - outputFile.createNewFile(); - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Output file could not be created: " + pathname, e ); + try { + outputFile.getParentFile().mkdirs(); + outputFile.createNewFile(); + } catch (IOException e) { + throw new MojoExecutionException("Output file could not be created: " + pathname, e); } - getLog().info( "[MAVEN-CORE-IT-LOG] Created output file: " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Created output file: " + outputFile); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-compiler-plugin/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-compiler-plugin/pom.xml index 98a9a00090..fe1f67d622 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-compiler-plugin/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-compiler-plugin/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 @@ -34,10 +32,8 @@ under the License. maven-plugin Maven IT Compiler Plugin Stub - - A test plugin that has the same coordinates and goals as the Maven Compiler Plugin. Its goals only create marker - files to check the principle invocation of the goals via the build lifecycle binding. - + A test plugin that has the same coordinates and goals as the Maven Compiler Plugin. Its goals only create marker + files to check the principle invocation of the goals via the build lifecycle binding. 2008 diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/coreit/CompileMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/coreit/CompileMojo.java index 79e8e63a75..17dbb9b77b 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/coreit/CompileMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/coreit/CompileMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,10 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; +import java.io.IOException; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; @@ -27,25 +29,20 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; -import java.io.File; -import java.io.IOException; - /** * Creates a text file in the project base directory. * - * + * * @author Benjamin Bentmann * */ -@Mojo( name = "compile", defaultPhase = LifecyclePhase.COMPILE ) -public class CompileMojo - extends AbstractMojo -{ +@Mojo(name = "compile", defaultPhase = LifecyclePhase.COMPILE) +public class CompileMojo extends AbstractMojo { /** * The current Maven project. */ - @Parameter( defaultValue = "${project}", required = true, readonly = true ) + @Parameter(defaultValue = "${project}", required = true, readonly = true) private MavenProject project; /** @@ -61,35 +58,27 @@ public class CompileMojo * @throws MojoExecutionException If the output file could not be created. * @throws MojoFailureException If the output file has not been set. */ - public void execute() - throws MojoExecutionException, MojoFailureException - { - getLog().info( "[MAVEN-CORE-IT-LOG] Using output file path: " + pathname ); + public void execute() throws MojoExecutionException, MojoFailureException { + getLog().info("[MAVEN-CORE-IT-LOG] Using output file path: " + pathname); - if ( pathname == null || pathname.length() <= 0 ) - { - throw new MojoFailureException( "Path name for output file has not been specified" ); + if (pathname == null || pathname.length() <= 0) { + throw new MojoFailureException("Path name for output file has not been specified"); } - File outputFile = new File( pathname ); - if ( !outputFile.isAbsolute() ) - { - outputFile = new File( project.getBasedir(), pathname ).getAbsoluteFile(); + File outputFile = new File(pathname); + if (!outputFile.isAbsolute()) { + outputFile = new File(project.getBasedir(), pathname).getAbsoluteFile(); } - getLog().info( "[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile); - try - { - outputFile.getParentFile().mkdirs(); - outputFile.createNewFile(); - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Output file could not be created: " + pathname, e ); + try { + outputFile.getParentFile().mkdirs(); + outputFile.createNewFile(); + } catch (IOException e) { + throw new MojoExecutionException("Output file could not be created: " + pathname, e); } - getLog().info( "[MAVEN-CORE-IT-LOG] Created output file: " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Created output file: " + outputFile); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/coreit/TestCompileMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/coreit/TestCompileMojo.java index 700322a14c..dd3d216cae 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/coreit/TestCompileMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/coreit/TestCompileMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,10 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; +import java.io.IOException; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; @@ -27,25 +29,20 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; -import java.io.File; -import java.io.IOException; - /** * Creates a text file in the project base directory. * - * + * * @author Benjamin Bentmann * */ -@Mojo( name = "testCompile", defaultPhase = LifecyclePhase.TEST_COMPILE ) -public class TestCompileMojo - extends AbstractMojo -{ +@Mojo(name = "testCompile", defaultPhase = LifecyclePhase.TEST_COMPILE) +public class TestCompileMojo extends AbstractMojo { /** * The current Maven project. */ - @Parameter( defaultValue = "${project}", required = true, readonly = true ) + @Parameter(defaultValue = "${project}", required = true, readonly = true) private MavenProject project; /** @@ -61,35 +58,27 @@ public class TestCompileMojo * @throws MojoExecutionException If the output file could not be created. * @throws MojoFailureException If the output file has not been set. */ - public void execute() - throws MojoExecutionException, MojoFailureException - { - getLog().info( "[MAVEN-CORE-IT-LOG] Using output file path: " + pathname ); + public void execute() throws MojoExecutionException, MojoFailureException { + getLog().info("[MAVEN-CORE-IT-LOG] Using output file path: " + pathname); - if ( pathname == null || pathname.length() <= 0 ) - { - throw new MojoFailureException( "Path name for output file has not been specified" ); + if (pathname == null || pathname.length() <= 0) { + throw new MojoFailureException("Path name for output file has not been specified"); } - File outputFile = new File( pathname ); - if ( !outputFile.isAbsolute() ) - { - outputFile = new File( project.getBasedir(), pathname ).getAbsoluteFile(); + File outputFile = new File(pathname); + if (!outputFile.isAbsolute()) { + outputFile = new File(project.getBasedir(), pathname).getAbsoluteFile(); } - getLog().info( "[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile); - try - { - outputFile.getParentFile().mkdirs(); - outputFile.createNewFile(); - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Output file could not be created: " + pathname, e ); + try { + outputFile.getParentFile().mkdirs(); + outputFile.createNewFile(); + } catch (IOException e) { + throw new MojoExecutionException("Output file could not be created: " + pathname, e); } - getLog().info( "[MAVEN-CORE-IT-LOG] Created output file: " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Created output file: " + outputFile); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-deploy-plugin/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-deploy-plugin/pom.xml index 5210978ba8..b048637337 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-deploy-plugin/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-deploy-plugin/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 @@ -34,10 +32,8 @@ under the License. maven-plugin Maven IT Deploy Plugin Stub - - A test plugin that has the same coordinates and goals as the Maven Deploy Plugin. Its goals only create marker - files to check the principle invocation of the goals via the build lifecycle binding. - + A test plugin that has the same coordinates and goals as the Maven Deploy Plugin. Its goals only create marker + files to check the principle invocation of the goals via the build lifecycle binding. 2008 diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/coreit/DeployMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/coreit/DeployMojo.java index 6061ff2f18..a76b27f4cd 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/coreit/DeployMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/coreit/DeployMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,10 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; +import java.io.IOException; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; @@ -27,25 +29,20 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; -import java.io.File; -import java.io.IOException; - /** * Creates a text file in the project base directory. * - * + * * @author Benjamin Bentmann * */ -@Mojo( name = "deploy", defaultPhase = LifecyclePhase.DEPLOY ) -public class DeployMojo - extends AbstractMojo -{ +@Mojo(name = "deploy", defaultPhase = LifecyclePhase.DEPLOY) +public class DeployMojo extends AbstractMojo { /** * The current Maven project. */ - @Parameter( defaultValue = "${project}", required = true, readonly = true ) + @Parameter(defaultValue = "${project}", required = true, readonly = true) private MavenProject project; /** @@ -61,35 +58,27 @@ public class DeployMojo * @throws MojoExecutionException If the output file could not be created. * @throws MojoFailureException If the output file has not been set. */ - public void execute() - throws MojoExecutionException, MojoFailureException - { - getLog().info( "[MAVEN-CORE-IT-LOG] Using output file path: " + pathname ); + public void execute() throws MojoExecutionException, MojoFailureException { + getLog().info("[MAVEN-CORE-IT-LOG] Using output file path: " + pathname); - if ( pathname == null || pathname.length() <= 0 ) - { - throw new MojoFailureException( "Path name for output file has not been specified" ); + if (pathname == null || pathname.length() <= 0) { + throw new MojoFailureException("Path name for output file has not been specified"); } - File outputFile = new File( pathname ); - if ( !outputFile.isAbsolute() ) - { - outputFile = new File( project.getBasedir(), pathname ).getAbsoluteFile(); + File outputFile = new File(pathname); + if (!outputFile.isAbsolute()) { + outputFile = new File(project.getBasedir(), pathname).getAbsoluteFile(); } - getLog().info( "[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile); - try - { - outputFile.getParentFile().mkdirs(); - outputFile.createNewFile(); - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Output file could not be created: " + pathname, e ); + try { + outputFile.getParentFile().mkdirs(); + outputFile.createNewFile(); + } catch (IOException e) { + throw new MojoExecutionException("Output file could not be created: " + pathname, e); } - getLog().info( "[MAVEN-CORE-IT-LOG] Created output file: " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Created output file: " + outputFile); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-ear-plugin/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-ear-plugin/pom.xml index 2def80657a..02b8721258 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-ear-plugin/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-ear-plugin/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 @@ -34,10 +32,8 @@ under the License. maven-plugin Maven IT EAR Plugin Stub - - A test plugin that has the same coordinates and goals as the Maven EAR Plugin. Its goals only create marker - files to check the principle invocation of the goals via the build lifecycle binding. - + A test plugin that has the same coordinates and goals as the Maven EAR Plugin. Its goals only create marker + files to check the principle invocation of the goals via the build lifecycle binding. 2008 diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-ear-plugin/src/main/java/org/apache/maven/plugin/coreit/EarMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-ear-plugin/src/main/java/org/apache/maven/plugin/coreit/EarMojo.java index e23658f83e..56629d4933 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-ear-plugin/src/main/java/org/apache/maven/plugin/coreit/EarMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-ear-plugin/src/main/java/org/apache/maven/plugin/coreit/EarMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,10 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; +import java.io.IOException; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; @@ -27,25 +29,20 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; -import java.io.File; -import java.io.IOException; - /** * Creates a text file in the project base directory. * - * + * * @author Benjamin Bentmann * */ -@Mojo( name = "ear", defaultPhase = LifecyclePhase.PACKAGE ) -public class EarMojo - extends AbstractMojo -{ +@Mojo(name = "ear", defaultPhase = LifecyclePhase.PACKAGE) +public class EarMojo extends AbstractMojo { /** * The current Maven project. */ - @Parameter( defaultValue = "${project}", required = true, readonly = true ) + @Parameter(defaultValue = "${project}", required = true, readonly = true) private MavenProject project; /** @@ -61,35 +58,27 @@ public class EarMojo * @throws MojoExecutionException If the output file could not be created. * @throws MojoFailureException If the output file has not been set. */ - public void execute() - throws MojoExecutionException, MojoFailureException - { - getLog().info( "[MAVEN-CORE-IT-LOG] Using output file path: " + pathname ); + public void execute() throws MojoExecutionException, MojoFailureException { + getLog().info("[MAVEN-CORE-IT-LOG] Using output file path: " + pathname); - if ( pathname == null || pathname.length() <= 0 ) - { - throw new MojoFailureException( "Path name for output file has not been specified" ); + if (pathname == null || pathname.length() <= 0) { + throw new MojoFailureException("Path name for output file has not been specified"); } - File outputFile = new File( pathname ); - if ( !outputFile.isAbsolute() ) - { - outputFile = new File( project.getBasedir(), pathname ).getAbsoluteFile(); + File outputFile = new File(pathname); + if (!outputFile.isAbsolute()) { + outputFile = new File(project.getBasedir(), pathname).getAbsoluteFile(); } - getLog().info( "[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile); - try - { - outputFile.getParentFile().mkdirs(); - outputFile.createNewFile(); - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Output file could not be created: " + pathname, e ); + try { + outputFile.getParentFile().mkdirs(); + outputFile.createNewFile(); + } catch (IOException e) { + throw new MojoExecutionException("Output file could not be created: " + pathname, e); } - getLog().info( "[MAVEN-CORE-IT-LOG] Created output file: " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Created output file: " + outputFile); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-ear-plugin/src/main/java/org/apache/maven/plugin/coreit/GenerateApplicationXmlMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-ear-plugin/src/main/java/org/apache/maven/plugin/coreit/GenerateApplicationXmlMojo.java index 7916a99bab..3ce9072a63 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-ear-plugin/src/main/java/org/apache/maven/plugin/coreit/GenerateApplicationXmlMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-ear-plugin/src/main/java/org/apache/maven/plugin/coreit/GenerateApplicationXmlMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,10 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; +import java.io.IOException; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; @@ -27,25 +29,20 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; -import java.io.File; -import java.io.IOException; - /** * Creates a text file in the project base directory. * - * + * * @author Benjamin Bentmann * */ -@Mojo( name = "generate-application-xml", defaultPhase = LifecyclePhase.GENERATE_RESOURCES ) -public class GenerateApplicationXmlMojo - extends AbstractMojo -{ +@Mojo(name = "generate-application-xml", defaultPhase = LifecyclePhase.GENERATE_RESOURCES) +public class GenerateApplicationXmlMojo extends AbstractMojo { /** * The current Maven project. */ - @Parameter( defaultValue = "${project}", required = true, readonly = true ) + @Parameter(defaultValue = "${project}", required = true, readonly = true) private MavenProject project; /** @@ -61,35 +58,27 @@ public class GenerateApplicationXmlMojo * @throws MojoExecutionException If the output file could not be created. * @throws MojoFailureException If the output file has not been set. */ - public void execute() - throws MojoExecutionException, MojoFailureException - { - getLog().info( "[MAVEN-CORE-IT-LOG] Using output file path: " + pathname ); + public void execute() throws MojoExecutionException, MojoFailureException { + getLog().info("[MAVEN-CORE-IT-LOG] Using output file path: " + pathname); - if ( pathname == null || pathname.length() <= 0 ) - { - throw new MojoFailureException( "Path name for output file has not been specified" ); + if (pathname == null || pathname.length() <= 0) { + throw new MojoFailureException("Path name for output file has not been specified"); } - File outputFile = new File( pathname ); - if ( !outputFile.isAbsolute() ) - { - outputFile = new File( project.getBasedir(), pathname ).getAbsoluteFile(); + File outputFile = new File(pathname); + if (!outputFile.isAbsolute()) { + outputFile = new File(project.getBasedir(), pathname).getAbsoluteFile(); } - getLog().info( "[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile); - try - { - outputFile.getParentFile().mkdirs(); - outputFile.createNewFile(); - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Output file could not be created: " + pathname, e ); + try { + outputFile.getParentFile().mkdirs(); + outputFile.createNewFile(); + } catch (IOException e) { + throw new MojoExecutionException("Output file could not be created: " + pathname, e); } - getLog().info( "[MAVEN-CORE-IT-LOG] Created output file: " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Created output file: " + outputFile); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-ejb-plugin/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-ejb-plugin/pom.xml index b51e9abf34..0fcbbd1dea 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-ejb-plugin/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-ejb-plugin/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 @@ -34,10 +32,8 @@ under the License. maven-plugin Maven IT EJB Plugin Stub - - A test plugin that has the same coordinates and goals as the Maven EJB Plugin. Its goals only create marker - files to check the principle invocation of the goals via the build lifecycle binding. - + A test plugin that has the same coordinates and goals as the Maven EJB Plugin. Its goals only create marker + files to check the principle invocation of the goals via the build lifecycle binding. 2008 diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-ejb-plugin/src/main/java/org/apache/maven/plugin/coreit/EjbMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-ejb-plugin/src/main/java/org/apache/maven/plugin/coreit/EjbMojo.java index b7de2aac4c..9a98643afe 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-ejb-plugin/src/main/java/org/apache/maven/plugin/coreit/EjbMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-ejb-plugin/src/main/java/org/apache/maven/plugin/coreit/EjbMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,10 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; +import java.io.IOException; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; @@ -27,25 +29,20 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; -import java.io.File; -import java.io.IOException; - /** * Creates a text file in the project base directory. * - * + * * @author Benjamin Bentmann * */ -@Mojo( name = "ejb", defaultPhase = LifecyclePhase.PACKAGE ) -public class EjbMojo - extends AbstractMojo -{ +@Mojo(name = "ejb", defaultPhase = LifecyclePhase.PACKAGE) +public class EjbMojo extends AbstractMojo { /** * The current Maven project. */ - @Parameter( defaultValue = "${project}", required = true, readonly = true ) + @Parameter(defaultValue = "${project}", required = true, readonly = true) private MavenProject project; /** @@ -61,35 +58,27 @@ public class EjbMojo * @throws MojoExecutionException If the output file could not be created. * @throws MojoFailureException If the output file has not been set. */ - public void execute() - throws MojoExecutionException, MojoFailureException - { - getLog().info( "[MAVEN-CORE-IT-LOG] Using output file path: " + pathname ); + public void execute() throws MojoExecutionException, MojoFailureException { + getLog().info("[MAVEN-CORE-IT-LOG] Using output file path: " + pathname); - if ( pathname == null || pathname.length() <= 0 ) - { - throw new MojoFailureException( "Path name for output file has not been specified" ); + if (pathname == null || pathname.length() <= 0) { + throw new MojoFailureException("Path name for output file has not been specified"); } - File outputFile = new File( pathname ); - if ( !outputFile.isAbsolute() ) - { - outputFile = new File( project.getBasedir(), pathname ).getAbsoluteFile(); + File outputFile = new File(pathname); + if (!outputFile.isAbsolute()) { + outputFile = new File(project.getBasedir(), pathname).getAbsoluteFile(); } - getLog().info( "[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile); - try - { - outputFile.getParentFile().mkdirs(); - outputFile.createNewFile(); - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Output file could not be created: " + pathname, e ); + try { + outputFile.getParentFile().mkdirs(); + outputFile.createNewFile(); + } catch (IOException e) { + throw new MojoExecutionException("Output file could not be created: " + pathname, e); } - getLog().info( "[MAVEN-CORE-IT-LOG] Created output file: " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Created output file: " + outputFile); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-install-plugin/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-install-plugin/pom.xml index 17c11084dc..597c16e73d 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-install-plugin/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-install-plugin/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 @@ -34,10 +32,8 @@ under the License. maven-plugin Maven IT Install Plugin Stub - - A test plugin that has the same coordinates and goals as the Maven Install Plugin. Its goals only create marker - files to check the principle invocation of the goals via the build lifecycle binding. - + A test plugin that has the same coordinates and goals as the Maven Install Plugin. Its goals only create marker + files to check the principle invocation of the goals via the build lifecycle binding. 2008 diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-install-plugin/src/main/java/org/apache/maven/plugin/coreit/InstallMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-install-plugin/src/main/java/org/apache/maven/plugin/coreit/InstallMojo.java index 5207da8c70..75a78a21b0 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-install-plugin/src/main/java/org/apache/maven/plugin/coreit/InstallMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-install-plugin/src/main/java/org/apache/maven/plugin/coreit/InstallMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,10 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; +import java.io.IOException; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; @@ -27,25 +29,20 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; -import java.io.File; -import java.io.IOException; - /** * Creates a text file in the project base directory. * - * + * * @author Benjamin Bentmann * */ -@Mojo( name = "install", defaultPhase = LifecyclePhase.INSTALL ) -public class InstallMojo - extends AbstractMojo -{ +@Mojo(name = "install", defaultPhase = LifecyclePhase.INSTALL) +public class InstallMojo extends AbstractMojo { /** * The current Maven project. */ - @Parameter( defaultValue = "${project}", required = true, readonly = true ) + @Parameter(defaultValue = "${project}", required = true, readonly = true) private MavenProject project; /** @@ -61,35 +58,27 @@ public class InstallMojo * @throws MojoExecutionException If the output file could not be created. * @throws MojoFailureException If the output file has not been set. */ - public void execute() - throws MojoExecutionException, MojoFailureException - { - getLog().info( "[MAVEN-CORE-IT-LOG] Using output file path: " + pathname ); + public void execute() throws MojoExecutionException, MojoFailureException { + getLog().info("[MAVEN-CORE-IT-LOG] Using output file path: " + pathname); - if ( pathname == null || pathname.length() <= 0 ) - { - throw new MojoFailureException( "Path name for output file has not been specified" ); + if (pathname == null || pathname.length() <= 0) { + throw new MojoFailureException("Path name for output file has not been specified"); } - File outputFile = new File( pathname ); - if ( !outputFile.isAbsolute() ) - { - outputFile = new File( project.getBasedir(), pathname ).getAbsoluteFile(); + File outputFile = new File(pathname); + if (!outputFile.isAbsolute()) { + outputFile = new File(project.getBasedir(), pathname).getAbsoluteFile(); } - getLog().info( "[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile); - try - { - outputFile.getParentFile().mkdirs(); - outputFile.createNewFile(); - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Output file could not be created: " + pathname, e ); + try { + outputFile.getParentFile().mkdirs(); + outputFile.createNewFile(); + } catch (IOException e) { + throw new MojoExecutionException("Output file could not be created: " + pathname, e); } - getLog().info( "[MAVEN-CORE-IT-LOG] Created output file: " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Created output file: " + outputFile); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-jar-plugin/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-jar-plugin/pom.xml index 3d74ea1b4a..98477de631 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-jar-plugin/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-jar-plugin/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 @@ -34,10 +32,8 @@ under the License. maven-plugin Maven IT JAR Plugin Stub - - A test plugin that has the same coordinates and goals as the Maven JAR Plugin. Its goals only create marker - files to check the principle invocation of the goals via the build lifecycle binding. - + A test plugin that has the same coordinates and goals as the Maven JAR Plugin. Its goals only create marker + files to check the principle invocation of the goals via the build lifecycle binding. 2008 diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-jar-plugin/src/main/java/org/apache/maven/plugin/coreit/JarMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-jar-plugin/src/main/java/org/apache/maven/plugin/coreit/JarMojo.java index e61c2a7fc5..3c456da35f 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-jar-plugin/src/main/java/org/apache/maven/plugin/coreit/JarMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-jar-plugin/src/main/java/org/apache/maven/plugin/coreit/JarMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,10 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; +import java.io.IOException; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; @@ -27,25 +29,20 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; -import java.io.File; -import java.io.IOException; - /** * Creates a text file in the project base directory. * - * + * * @author Benjamin Bentmann * */ -@Mojo( name = "jar", defaultPhase = LifecyclePhase.PACKAGE ) -public class JarMojo - extends AbstractMojo -{ +@Mojo(name = "jar", defaultPhase = LifecyclePhase.PACKAGE) +public class JarMojo extends AbstractMojo { /** * The current Maven project. */ - @Parameter( defaultValue = "${project}", required = true, readonly = true ) + @Parameter(defaultValue = "${project}", required = true, readonly = true) private MavenProject project; /** @@ -61,35 +58,27 @@ public class JarMojo * @throws MojoExecutionException If the output file could not be created. * @throws MojoFailureException If the output file has not been set. */ - public void execute() - throws MojoExecutionException, MojoFailureException - { - getLog().info( "[MAVEN-CORE-IT-LOG] Using output file path: " + pathname ); + public void execute() throws MojoExecutionException, MojoFailureException { + getLog().info("[MAVEN-CORE-IT-LOG] Using output file path: " + pathname); - if ( pathname == null || pathname.length() <= 0 ) - { - throw new MojoFailureException( "Path name for output file has not been specified" ); + if (pathname == null || pathname.length() <= 0) { + throw new MojoFailureException("Path name for output file has not been specified"); } - File outputFile = new File( pathname ); - if ( !outputFile.isAbsolute() ) - { - outputFile = new File( project.getBasedir(), pathname ).getAbsoluteFile(); + File outputFile = new File(pathname); + if (!outputFile.isAbsolute()) { + outputFile = new File(project.getBasedir(), pathname).getAbsoluteFile(); } - getLog().info( "[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile); - try - { - outputFile.getParentFile().mkdirs(); - outputFile.createNewFile(); - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Output file could not be created: " + pathname, e ); + try { + outputFile.getParentFile().mkdirs(); + outputFile.createNewFile(); + } catch (IOException e) { + throw new MojoExecutionException("Output file could not be created: " + pathname, e); } - getLog().info( "[MAVEN-CORE-IT-LOG] Created output file: " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Created output file: " + outputFile); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-javadoc-plugin/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-javadoc-plugin/pom.xml index 9e5477a636..4634113698 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-javadoc-plugin/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-javadoc-plugin/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 @@ -34,10 +32,8 @@ under the License. maven-plugin Maven IT Javadoc Plugin Stub - - A test plugin that has the same coordinates and goals as the Maven Javadoc Plugin. Its goals only create marker - files to check the principle invocation of the goals via the build lifecycle binding. - + A test plugin that has the same coordinates and goals as the Maven Javadoc Plugin. Its goals only create marker + files to check the principle invocation of the goals via the build lifecycle binding. 2008 diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/coreit/JarMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/coreit/JarMojo.java index 409466fb6c..948dbc8fbb 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/coreit/JarMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/coreit/JarMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,10 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; +import java.io.IOException; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; @@ -27,25 +29,20 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; -import java.io.File; -import java.io.IOException; - /** * Creates a text file in the project base directory. * - * + * * @author Benjamin Bentmann * */ -@Mojo( name = "jar", defaultPhase = LifecyclePhase.PACKAGE ) -public class JarMojo - extends AbstractMojo -{ +@Mojo(name = "jar", defaultPhase = LifecyclePhase.PACKAGE) +public class JarMojo extends AbstractMojo { /** * The current Maven project. */ - @Parameter( defaultValue = "${project}", required = true, readonly = true ) + @Parameter(defaultValue = "${project}", required = true, readonly = true) private MavenProject project; /** @@ -61,35 +58,27 @@ public class JarMojo * @throws MojoExecutionException If the output file could not be created. * @throws MojoFailureException If the output file has not been set. */ - public void execute() - throws MojoExecutionException, MojoFailureException - { - getLog().info( "[MAVEN-CORE-IT-LOG] Using output file path: " + pathname ); + public void execute() throws MojoExecutionException, MojoFailureException { + getLog().info("[MAVEN-CORE-IT-LOG] Using output file path: " + pathname); - if ( pathname == null || pathname.length() <= 0 ) - { - throw new MojoFailureException( "Path name for output file has not been specified" ); + if (pathname == null || pathname.length() <= 0) { + throw new MojoFailureException("Path name for output file has not been specified"); } - File outputFile = new File( pathname ); - if ( !outputFile.isAbsolute() ) - { - outputFile = new File( project.getBasedir(), pathname ).getAbsoluteFile(); + File outputFile = new File(pathname); + if (!outputFile.isAbsolute()) { + outputFile = new File(project.getBasedir(), pathname).getAbsoluteFile(); } - getLog().info( "[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile); - try - { - outputFile.getParentFile().mkdirs(); - outputFile.createNewFile(); - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Output file could not be created: " + pathname, e ); + try { + outputFile.getParentFile().mkdirs(); + outputFile.createNewFile(); + } catch (IOException e) { + throw new MojoExecutionException("Output file could not be created: " + pathname, e); } - getLog().info( "[MAVEN-CORE-IT-LOG] Created output file: " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Created output file: " + outputFile); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-plugin-plugin/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-plugin-plugin/pom.xml index 609d1309e7..49a3045be4 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-plugin-plugin/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-plugin-plugin/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 @@ -34,10 +32,8 @@ under the License. maven-plugin Maven IT Plugin Plugin Stub - - A test plugin that has the same coordinates and goals as the Maven Plugin Plugin. Its goals only create marker - files to check the principle invocation of the goals via the build lifecycle binding. - + A test plugin that has the same coordinates and goals as the Maven Plugin Plugin. Its goals only create marker + files to check the principle invocation of the goals via the build lifecycle binding. 2008 diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/coreit/AddPluginArtifactMetadataMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/coreit/AddPluginArtifactMetadataMojo.java index ac260b3fef..a054cd90f9 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/coreit/AddPluginArtifactMetadataMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/coreit/AddPluginArtifactMetadataMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,10 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; +import java.io.IOException; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; @@ -27,25 +29,20 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; -import java.io.File; -import java.io.IOException; - /** * Creates a text file in the project base directory. * - * + * * @author Benjamin Bentmann * */ -@Mojo( name = "addPluginArtifactMetadata", defaultPhase = LifecyclePhase.PACKAGE ) -public class AddPluginArtifactMetadataMojo - extends AbstractMojo -{ +@Mojo(name = "addPluginArtifactMetadata", defaultPhase = LifecyclePhase.PACKAGE) +public class AddPluginArtifactMetadataMojo extends AbstractMojo { /** * The current Maven project. */ - @Parameter( defaultValue = "${project}", required = true, readonly = true ) + @Parameter(defaultValue = "${project}", required = true, readonly = true) private MavenProject project; /** @@ -61,35 +58,27 @@ public class AddPluginArtifactMetadataMojo * @throws MojoExecutionException If the output file could not be created. * @throws MojoFailureException If the output file has not been set. */ - public void execute() - throws MojoExecutionException, MojoFailureException - { - getLog().info( "[MAVEN-CORE-IT-LOG] Using output file path: " + pathname ); + public void execute() throws MojoExecutionException, MojoFailureException { + getLog().info("[MAVEN-CORE-IT-LOG] Using output file path: " + pathname); - if ( pathname == null || pathname.length() <= 0 ) - { - throw new MojoFailureException( "Path name for output file has not been specified" ); + if (pathname == null || pathname.length() <= 0) { + throw new MojoFailureException("Path name for output file has not been specified"); } - File outputFile = new File( pathname ); - if ( !outputFile.isAbsolute() ) - { - outputFile = new File( project.getBasedir(), pathname ).getAbsoluteFile(); + File outputFile = new File(pathname); + if (!outputFile.isAbsolute()) { + outputFile = new File(project.getBasedir(), pathname).getAbsoluteFile(); } - getLog().info( "[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile); - try - { - outputFile.getParentFile().mkdirs(); - outputFile.createNewFile(); - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Output file could not be created: " + pathname, e ); + try { + outputFile.getParentFile().mkdirs(); + outputFile.createNewFile(); + } catch (IOException e) { + throw new MojoExecutionException("Output file could not be created: " + pathname, e); } - getLog().info( "[MAVEN-CORE-IT-LOG] Created output file: " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Created output file: " + outputFile); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/coreit/DescriptorMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/coreit/DescriptorMojo.java index b4a54fccc1..a851911f20 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/coreit/DescriptorMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/coreit/DescriptorMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,10 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; +import java.io.IOException; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; @@ -27,25 +29,20 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; -import java.io.File; -import java.io.IOException; - /** * Creates a text file in the project base directory. * - * + * * @author Benjamin Bentmann * */ -@Mojo( name = "descriptor", defaultPhase = LifecyclePhase.GENERATE_RESOURCES ) -public class DescriptorMojo - extends AbstractMojo -{ +@Mojo(name = "descriptor", defaultPhase = LifecyclePhase.GENERATE_RESOURCES) +public class DescriptorMojo extends AbstractMojo { /** * The current Maven project. */ - @Parameter( defaultValue = "${project}", required = true, readonly = true ) + @Parameter(defaultValue = "${project}", required = true, readonly = true) private MavenProject project; /** @@ -61,35 +58,27 @@ public class DescriptorMojo * @throws MojoExecutionException If the output file could not be created. * @throws MojoFailureException If the output file has not been set. */ - public void execute() - throws MojoExecutionException, MojoFailureException - { - getLog().info( "[MAVEN-CORE-IT-LOG] Using output file path: " + pathname ); + public void execute() throws MojoExecutionException, MojoFailureException { + getLog().info("[MAVEN-CORE-IT-LOG] Using output file path: " + pathname); - if ( pathname == null || pathname.length() <= 0 ) - { - throw new MojoFailureException( "Path name for output file has not been specified" ); + if (pathname == null || pathname.length() <= 0) { + throw new MojoFailureException("Path name for output file has not been specified"); } - File outputFile = new File( pathname ); - if ( !outputFile.isAbsolute() ) - { - outputFile = new File( project.getBasedir(), pathname ).getAbsoluteFile(); + File outputFile = new File(pathname); + if (!outputFile.isAbsolute()) { + outputFile = new File(project.getBasedir(), pathname).getAbsoluteFile(); } - getLog().info( "[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile); - try - { - outputFile.getParentFile().mkdirs(); - outputFile.createNewFile(); - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Output file could not be created: " + pathname, e ); + try { + outputFile.getParentFile().mkdirs(); + outputFile.createNewFile(); + } catch (IOException e) { + throw new MojoExecutionException("Output file could not be created: " + pathname, e); } - getLog().info( "[MAVEN-CORE-IT-LOG] Created output file: " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Created output file: " + outputFile); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/coreit/UpdateRegistryMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/coreit/UpdateRegistryMojo.java index 942876500a..699d7440bf 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/coreit/UpdateRegistryMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/coreit/UpdateRegistryMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,10 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; +import java.io.IOException; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; @@ -27,25 +29,20 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; -import java.io.File; -import java.io.IOException; - /** * Creates a text file in the project base directory. * - * + * * @author Benjamin Bentmann * */ -@Mojo( name = "updateRegistry", defaultPhase = LifecyclePhase.INSTALL ) -public class UpdateRegistryMojo - extends AbstractMojo -{ +@Mojo(name = "updateRegistry", defaultPhase = LifecyclePhase.INSTALL) +public class UpdateRegistryMojo extends AbstractMojo { /** * The current Maven project. */ - @Parameter( defaultValue = "${project}", required = true, readonly = true ) + @Parameter(defaultValue = "${project}", required = true, readonly = true) private MavenProject project; /** @@ -61,35 +58,27 @@ public class UpdateRegistryMojo * @throws MojoExecutionException If the output file could not be created. * @throws MojoFailureException If the output file has not been set. */ - public void execute() - throws MojoExecutionException, MojoFailureException - { - getLog().info( "[MAVEN-CORE-IT-LOG] Using output file path: " + pathname ); + public void execute() throws MojoExecutionException, MojoFailureException { + getLog().info("[MAVEN-CORE-IT-LOG] Using output file path: " + pathname); - if ( pathname == null || pathname.length() <= 0 ) - { - throw new MojoFailureException( "Path name for output file has not been specified" ); + if (pathname == null || pathname.length() <= 0) { + throw new MojoFailureException("Path name for output file has not been specified"); } - File outputFile = new File( pathname ); - if ( !outputFile.isAbsolute() ) - { - outputFile = new File( project.getBasedir(), pathname ).getAbsoluteFile(); + File outputFile = new File(pathname); + if (!outputFile.isAbsolute()) { + outputFile = new File(project.getBasedir(), pathname).getAbsoluteFile(); } - getLog().info( "[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile); - try - { - outputFile.getParentFile().mkdirs(); - outputFile.createNewFile(); - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Output file could not be created: " + pathname, e ); + try { + outputFile.getParentFile().mkdirs(); + outputFile.createNewFile(); + } catch (IOException e) { + throw new MojoExecutionException("Output file could not be created: " + pathname, e); } - getLog().info( "[MAVEN-CORE-IT-LOG] Created output file: " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Created output file: " + outputFile); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-rar-plugin/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-rar-plugin/pom.xml index 1f0c263064..203460f0c0 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-rar-plugin/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-rar-plugin/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 @@ -34,10 +32,8 @@ under the License. maven-plugin Maven IT RAR Plugin Stub - - A test plugin that has the same coordinates and goals as the Maven RAR Plugin. Its goals only create marker - files to check the principle invocation of the goals via the build lifecycle binding. - + A test plugin that has the same coordinates and goals as the Maven RAR Plugin. Its goals only create marker + files to check the principle invocation of the goals via the build lifecycle binding. 2008 diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-rar-plugin/src/main/java/org/apache/maven/plugin/coreit/RarMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-rar-plugin/src/main/java/org/apache/maven/plugin/coreit/RarMojo.java index d1bda7ccfd..14777f405e 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-rar-plugin/src/main/java/org/apache/maven/plugin/coreit/RarMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-rar-plugin/src/main/java/org/apache/maven/plugin/coreit/RarMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,10 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; +import java.io.IOException; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; @@ -27,25 +29,20 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; -import java.io.File; -import java.io.IOException; - /** * Creates a text file in the project base directory. * - * + * * @author Benjamin Bentmann * */ -@Mojo( name = "rar", defaultPhase = LifecyclePhase.PACKAGE ) -public class RarMojo - extends AbstractMojo -{ +@Mojo(name = "rar", defaultPhase = LifecyclePhase.PACKAGE) +public class RarMojo extends AbstractMojo { /** * The current Maven project. */ - @Parameter( defaultValue = "${project}", required = true, readonly = true ) + @Parameter(defaultValue = "${project}", required = true, readonly = true) private MavenProject project; /** @@ -61,35 +58,27 @@ public class RarMojo * @throws MojoExecutionException If the output file could not be created. * @throws MojoFailureException If the output file has not been set. */ - public void execute() - throws MojoExecutionException, MojoFailureException - { - getLog().info( "[MAVEN-CORE-IT-LOG] Using output file path: " + pathname ); + public void execute() throws MojoExecutionException, MojoFailureException { + getLog().info("[MAVEN-CORE-IT-LOG] Using output file path: " + pathname); - if ( pathname == null || pathname.length() <= 0 ) - { - throw new MojoFailureException( "Path name for output file has not been specified" ); + if (pathname == null || pathname.length() <= 0) { + throw new MojoFailureException("Path name for output file has not been specified"); } - File outputFile = new File( pathname ); - if ( !outputFile.isAbsolute() ) - { - outputFile = new File( project.getBasedir(), pathname ).getAbsoluteFile(); + File outputFile = new File(pathname); + if (!outputFile.isAbsolute()) { + outputFile = new File(project.getBasedir(), pathname).getAbsoluteFile(); } - getLog().info( "[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile); - try - { - outputFile.getParentFile().mkdirs(); - outputFile.createNewFile(); - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Output file could not be created: " + pathname, e ); + try { + outputFile.getParentFile().mkdirs(); + outputFile.createNewFile(); + } catch (IOException e) { + throw new MojoExecutionException("Output file could not be created: " + pathname, e); } - getLog().info( "[MAVEN-CORE-IT-LOG] Created output file: " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Created output file: " + outputFile); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-resources-plugin/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-resources-plugin/pom.xml index 7e57001cd0..634c3ef1d0 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-resources-plugin/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-resources-plugin/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 @@ -34,10 +32,8 @@ under the License. maven-plugin Maven IT Resources Plugin Stub - - A test plugin that has the same coordinates and goals as the Maven Resources Plugin. Its goals only create marker - files to check the principle invocation of the goals via the build lifecycle binding. - + A test plugin that has the same coordinates and goals as the Maven Resources Plugin. Its goals only create marker + files to check the principle invocation of the goals via the build lifecycle binding. 2008 diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-resources-plugin/src/main/java/org/apache/maven/plugin/coreit/ResourcesMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-resources-plugin/src/main/java/org/apache/maven/plugin/coreit/ResourcesMojo.java index 956d68e513..a4efc5736e 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-resources-plugin/src/main/java/org/apache/maven/plugin/coreit/ResourcesMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-resources-plugin/src/main/java/org/apache/maven/plugin/coreit/ResourcesMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,12 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; @@ -27,26 +31,19 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStreamWriter; - /** * Creates a text file in the project base directory. * * @author Benjamin Bentmann * - */ -@Mojo( name = "resources", defaultPhase = LifecyclePhase.PROCESS_RESOURCES ) -public class ResourcesMojo - extends AbstractMojo -{ + */ +@Mojo(name = "resources", defaultPhase = LifecyclePhase.PROCESS_RESOURCES) +public class ResourcesMojo extends AbstractMojo { /** * The current Maven project. */ - @Parameter( defaultValue = "${project}", required = true, readonly = true ) + @Parameter(defaultValue = "${project}", required = true, readonly = true) private MavenProject project; /** @@ -70,50 +67,38 @@ public class ResourcesMojo * @throws MojoExecutionException If the output file could not be created. * @throws MojoFailureException If the output file has not been set. */ - public void execute() - throws MojoExecutionException, MojoFailureException - { - getLog().info( "[MAVEN-CORE-IT-LOG] Using output file path: " + pathname ); + public void execute() throws MojoExecutionException, MojoFailureException { + getLog().info("[MAVEN-CORE-IT-LOG] Using output file path: " + pathname); - if ( pathname == null || pathname.length() <= 0 ) - { - throw new MojoFailureException( "Path name for output file has not been specified" ); + if (pathname == null || pathname.length() <= 0) { + throw new MojoFailureException("Path name for output file has not been specified"); } - File outputFile = new File( pathname ); - if ( !outputFile.isAbsolute() ) - { - outputFile = new File( project.getBasedir(), pathname ).getAbsoluteFile(); + File outputFile = new File(pathname); + if (!outputFile.isAbsolute()) { + outputFile = new File(project.getBasedir(), pathname).getAbsoluteFile(); } - getLog().info( "[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile); - try - { + try { outputFile.getParentFile().mkdirs(); - if ( message != null && message.length() > 0 ) - { - getLog().info( "[MAVEN-CORE-IT-LOG] " + message ); + if (message != null && message.length() > 0) { + getLog().info("[MAVEN-CORE-IT-LOG] " + message); - try ( OutputStreamWriter writer = new OutputStreamWriter( new FileOutputStream( outputFile, true ), - "UTF-8" ) ) - { - writer.write( message ); - writer.write( "\n" ); + try (OutputStreamWriter writer = + new OutputStreamWriter(new FileOutputStream(outputFile, true), "UTF-8")) { + writer.write(message); + writer.write("\n"); } - } - else - { + } else { outputFile.createNewFile(); } - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Output file could not be created: " + pathname, e ); + } catch (IOException e) { + throw new MojoExecutionException("Output file could not be created: " + pathname, e); } - getLog().info( "[MAVEN-CORE-IT-LOG] Created output file: " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Created output file: " + outputFile); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-resources-plugin/src/main/java/org/apache/maven/plugin/coreit/TestResourcesMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-resources-plugin/src/main/java/org/apache/maven/plugin/coreit/TestResourcesMojo.java index e258111b85..af1f7be7fe 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-resources-plugin/src/main/java/org/apache/maven/plugin/coreit/TestResourcesMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-resources-plugin/src/main/java/org/apache/maven/plugin/coreit/TestResourcesMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,10 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; +import java.io.IOException; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; @@ -27,25 +29,20 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; -import java.io.File; -import java.io.IOException; - /** * Creates a text file in the project base directory. * - * + * * @author Benjamin Bentmann * */ -@Mojo( name = "testResources", defaultPhase = LifecyclePhase.PROCESS_TEST_RESOURCES ) -public class TestResourcesMojo - extends AbstractMojo -{ +@Mojo(name = "testResources", defaultPhase = LifecyclePhase.PROCESS_TEST_RESOURCES) +public class TestResourcesMojo extends AbstractMojo { /** * The current Maven project. */ - @Parameter( defaultValue = "${project}", required = true, readonly = true ) + @Parameter(defaultValue = "${project}", required = true, readonly = true) private MavenProject project; /** @@ -61,35 +58,27 @@ public class TestResourcesMojo * @throws MojoExecutionException If the output file could not be created. * @throws MojoFailureException If the output file has not been set. */ - public void execute() - throws MojoExecutionException, MojoFailureException - { - getLog().info( "[MAVEN-CORE-IT-LOG] Using output file path: " + pathname ); + public void execute() throws MojoExecutionException, MojoFailureException { + getLog().info("[MAVEN-CORE-IT-LOG] Using output file path: " + pathname); - if ( pathname == null || pathname.length() <= 0 ) - { - throw new MojoFailureException( "Path name for output file has not been specified" ); + if (pathname == null || pathname.length() <= 0) { + throw new MojoFailureException("Path name for output file has not been specified"); } - File outputFile = new File( pathname ); - if ( !outputFile.isAbsolute() ) - { - outputFile = new File( project.getBasedir(), pathname ).getAbsoluteFile(); + File outputFile = new File(pathname); + if (!outputFile.isAbsolute()) { + outputFile = new File(project.getBasedir(), pathname).getAbsoluteFile(); } - getLog().info( "[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile); - try - { - outputFile.getParentFile().mkdirs(); - outputFile.createNewFile(); - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Output file could not be created: " + pathname, e ); + try { + outputFile.getParentFile().mkdirs(); + outputFile.createNewFile(); + } catch (IOException e) { + throw new MojoExecutionException("Output file could not be created: " + pathname, e); } - getLog().info( "[MAVEN-CORE-IT-LOG] Created output file: " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Created output file: " + outputFile); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-site-plugin/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-site-plugin/pom.xml index f5030b9c82..8367e8edcd 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-site-plugin/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-site-plugin/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 @@ -34,10 +32,8 @@ under the License. maven-plugin Maven IT Site Plugin Stub - - A test plugin that has the same coordinates and goals as the Maven Site Plugin. Its goals only create marker - files to check the principle invocation of the goals via the build lifecycle binding. - + A test plugin that has the same coordinates and goals as the Maven Site Plugin. Its goals only create marker + files to check the principle invocation of the goals via the build lifecycle binding. 2008 diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-site-plugin/src/main/java/org/apache/maven/plugin/coreit/AttachDescriptorMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-site-plugin/src/main/java/org/apache/maven/plugin/coreit/AttachDescriptorMojo.java index a2af26a33b..ac097c685c 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-site-plugin/src/main/java/org/apache/maven/plugin/coreit/AttachDescriptorMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-site-plugin/src/main/java/org/apache/maven/plugin/coreit/AttachDescriptorMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,10 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; +import java.io.IOException; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; @@ -27,25 +29,20 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; -import java.io.File; -import java.io.IOException; - /** * Creates a text file in the project base directory. * - * + * * @author Benjamin Bentmann * */ -@Mojo( name = "attach-descriptor", defaultPhase = LifecyclePhase.PACKAGE ) -public class AttachDescriptorMojo - extends AbstractMojo -{ +@Mojo(name = "attach-descriptor", defaultPhase = LifecyclePhase.PACKAGE) +public class AttachDescriptorMojo extends AbstractMojo { /** * The current Maven project. */ - @Parameter( defaultValue = "${project}", required = true, readonly = true ) + @Parameter(defaultValue = "${project}", required = true, readonly = true) private MavenProject project; /** @@ -61,35 +58,27 @@ public class AttachDescriptorMojo * @throws MojoExecutionException If the output file could not be created. * @throws MojoFailureException If the output file has not been set. */ - public void execute() - throws MojoExecutionException, MojoFailureException - { - getLog().info( "[MAVEN-CORE-IT-LOG] Using output file path: " + pathname ); + public void execute() throws MojoExecutionException, MojoFailureException { + getLog().info("[MAVEN-CORE-IT-LOG] Using output file path: " + pathname); - if ( pathname == null || pathname.length() <= 0 ) - { - throw new MojoFailureException( "Path name for output file has not been specified" ); + if (pathname == null || pathname.length() <= 0) { + throw new MojoFailureException("Path name for output file has not been specified"); } - File outputFile = new File( pathname ); - if ( !outputFile.isAbsolute() ) - { - outputFile = new File( project.getBasedir(), pathname ).getAbsoluteFile(); + File outputFile = new File(pathname); + if (!outputFile.isAbsolute()) { + outputFile = new File(project.getBasedir(), pathname).getAbsoluteFile(); } - getLog().info( "[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile); - try - { - outputFile.getParentFile().mkdirs(); - outputFile.createNewFile(); - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Output file could not be created: " + pathname, e ); + try { + outputFile.getParentFile().mkdirs(); + outputFile.createNewFile(); + } catch (IOException e) { + throw new MojoExecutionException("Output file could not be created: " + pathname, e); } - getLog().info( "[MAVEN-CORE-IT-LOG] Created output file: " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Created output file: " + outputFile); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-site-plugin/src/main/java/org/apache/maven/plugin/coreit/DeployMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-site-plugin/src/main/java/org/apache/maven/plugin/coreit/DeployMojo.java index 4667e7080c..6570d573e2 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-site-plugin/src/main/java/org/apache/maven/plugin/coreit/DeployMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-site-plugin/src/main/java/org/apache/maven/plugin/coreit/DeployMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,10 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; +import java.io.IOException; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; @@ -27,25 +29,20 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; -import java.io.File; -import java.io.IOException; - /** * Creates a text file in the project base directory. * - * + * * @author Benjamin Bentmann * */ -@Mojo( name = "deploy", defaultPhase = LifecyclePhase.SITE_DEPLOY ) -public class DeployMojo - extends AbstractMojo -{ +@Mojo(name = "deploy", defaultPhase = LifecyclePhase.SITE_DEPLOY) +public class DeployMojo extends AbstractMojo { /** * The current Maven project. */ - @Parameter( defaultValue = "${project}", required = true, readonly = true ) + @Parameter(defaultValue = "${project}", required = true, readonly = true) private MavenProject project; /** @@ -61,35 +58,27 @@ public class DeployMojo * @throws MojoExecutionException If the output file could not be created. * @throws MojoFailureException If the output file has not been set. */ - public void execute() - throws MojoExecutionException, MojoFailureException - { - getLog().info( "[MAVEN-CORE-IT-LOG] Using output file path: " + pathname ); + public void execute() throws MojoExecutionException, MojoFailureException { + getLog().info("[MAVEN-CORE-IT-LOG] Using output file path: " + pathname); - if ( pathname == null || pathname.length() <= 0 ) - { - throw new MojoFailureException( "Path name for output file has not been specified" ); + if (pathname == null || pathname.length() <= 0) { + throw new MojoFailureException("Path name for output file has not been specified"); } - File outputFile = new File( pathname ); - if ( !outputFile.isAbsolute() ) - { - outputFile = new File( project.getBasedir(), pathname ).getAbsoluteFile(); + File outputFile = new File(pathname); + if (!outputFile.isAbsolute()) { + outputFile = new File(project.getBasedir(), pathname).getAbsoluteFile(); } - getLog().info( "[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile); - try - { - outputFile.getParentFile().mkdirs(); - outputFile.createNewFile(); - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Output file could not be created: " + pathname, e ); + try { + outputFile.getParentFile().mkdirs(); + outputFile.createNewFile(); + } catch (IOException e) { + throw new MojoExecutionException("Output file could not be created: " + pathname, e); } - getLog().info( "[MAVEN-CORE-IT-LOG] Created output file: " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Created output file: " + outputFile); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-site-plugin/src/main/java/org/apache/maven/plugin/coreit/SiteMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-site-plugin/src/main/java/org/apache/maven/plugin/coreit/SiteMojo.java index 24bdff840c..da0450f0c4 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-site-plugin/src/main/java/org/apache/maven/plugin/coreit/SiteMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-site-plugin/src/main/java/org/apache/maven/plugin/coreit/SiteMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,10 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; +import java.io.IOException; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; @@ -27,25 +29,20 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; -import java.io.File; -import java.io.IOException; - /** * Creates a text file in the project base directory. * - * + * * @author Benjamin Bentmann * */ -@Mojo( name = "site", defaultPhase = LifecyclePhase.SITE ) -public class SiteMojo - extends AbstractMojo -{ +@Mojo(name = "site", defaultPhase = LifecyclePhase.SITE) +public class SiteMojo extends AbstractMojo { /** * The current Maven project. */ - @Parameter( defaultValue = "${project}", required = true, readonly = true ) + @Parameter(defaultValue = "${project}", required = true, readonly = true) private MavenProject project; /** @@ -61,35 +58,27 @@ public class SiteMojo * @throws MojoExecutionException If the output file could not be created. * @throws MojoFailureException If the output file has not been set. */ - public void execute() - throws MojoExecutionException, MojoFailureException - { - getLog().info( "[MAVEN-CORE-IT-LOG] Using output file path: " + pathname ); + public void execute() throws MojoExecutionException, MojoFailureException { + getLog().info("[MAVEN-CORE-IT-LOG] Using output file path: " + pathname); - if ( pathname == null || pathname.length() <= 0 ) - { - throw new MojoFailureException( "Path name for output file has not been specified" ); + if (pathname == null || pathname.length() <= 0) { + throw new MojoFailureException("Path name for output file has not been specified"); } - File outputFile = new File( pathname ); - if ( !outputFile.isAbsolute() ) - { - outputFile = new File( project.getBasedir(), pathname ).getAbsoluteFile(); + File outputFile = new File(pathname); + if (!outputFile.isAbsolute()) { + outputFile = new File(project.getBasedir(), pathname).getAbsoluteFile(); } - getLog().info( "[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile); - try - { - outputFile.getParentFile().mkdirs(); - outputFile.createNewFile(); - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Output file could not be created: " + pathname, e ); + try { + outputFile.getParentFile().mkdirs(); + outputFile.createNewFile(); + } catch (IOException e) { + throw new MojoExecutionException("Output file could not be created: " + pathname, e); } - getLog().info( "[MAVEN-CORE-IT-LOG] Created output file: " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Created output file: " + outputFile); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-source-plugin/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-source-plugin/pom.xml index 78b44f987c..75f32cf59e 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-source-plugin/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-source-plugin/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 @@ -34,10 +32,8 @@ under the License. maven-plugin Maven IT Source Plugin Stub - - A test plugin that has the same coordinates and goals as the Maven Source Plugin. Its goals only create marker - files to check the principle invocation of the goals via the build lifecycle binding. - + A test plugin that has the same coordinates and goals as the Maven Source Plugin. Its goals only create marker + files to check the principle invocation of the goals via the build lifecycle binding. 2008 diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-source-plugin/src/main/java/org/apache/maven/plugin/coreit/JarMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-source-plugin/src/main/java/org/apache/maven/plugin/coreit/JarMojo.java index 87f0f79a93..926bb00046 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-source-plugin/src/main/java/org/apache/maven/plugin/coreit/JarMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-source-plugin/src/main/java/org/apache/maven/plugin/coreit/JarMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,10 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; +import java.io.IOException; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; @@ -27,25 +29,20 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; -import java.io.File; -import java.io.IOException; - /** * Creates a text file in the project base directory. * - * + * * @author Benjamin Bentmann * */ -@Mojo( name = "jar", defaultPhase = LifecyclePhase.PACKAGE ) -public class JarMojo - extends AbstractMojo -{ +@Mojo(name = "jar", defaultPhase = LifecyclePhase.PACKAGE) +public class JarMojo extends AbstractMojo { /** * The current Maven project. */ - @Parameter( defaultValue = "${project}", required = true, readonly = true ) + @Parameter(defaultValue = "${project}", required = true, readonly = true) private MavenProject project; /** @@ -61,35 +58,27 @@ public class JarMojo * @throws MojoExecutionException If the output file could not be created. * @throws MojoFailureException If the output file has not been set. */ - public void execute() - throws MojoExecutionException, MojoFailureException - { - getLog().info( "[MAVEN-CORE-IT-LOG] Using output file path: " + pathname ); + public void execute() throws MojoExecutionException, MojoFailureException { + getLog().info("[MAVEN-CORE-IT-LOG] Using output file path: " + pathname); - if ( pathname == null || pathname.length() <= 0 ) - { - throw new MojoFailureException( "Path name for output file has not been specified" ); + if (pathname == null || pathname.length() <= 0) { + throw new MojoFailureException("Path name for output file has not been specified"); } - File outputFile = new File( pathname ); - if ( !outputFile.isAbsolute() ) - { - outputFile = new File( project.getBasedir(), pathname ).getAbsoluteFile(); + File outputFile = new File(pathname); + if (!outputFile.isAbsolute()) { + outputFile = new File(project.getBasedir(), pathname).getAbsoluteFile(); } - getLog().info( "[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile); - try - { - outputFile.getParentFile().mkdirs(); - outputFile.createNewFile(); - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Output file could not be created: " + pathname, e ); + try { + outputFile.getParentFile().mkdirs(); + outputFile.createNewFile(); + } catch (IOException e) { + throw new MojoExecutionException("Output file could not be created: " + pathname, e); } - getLog().info( "[MAVEN-CORE-IT-LOG] Created output file: " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Created output file: " + outputFile); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-source-plugin/src/main/java/org/apache/maven/plugin/coreit/JarNoFork.java b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-source-plugin/src/main/java/org/apache/maven/plugin/coreit/JarNoFork.java index e80864b172..06eebde308 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-source-plugin/src/main/java/org/apache/maven/plugin/coreit/JarNoFork.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-source-plugin/src/main/java/org/apache/maven/plugin/coreit/JarNoFork.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; @@ -25,8 +24,6 @@ import org.apache.maven.plugins.annotations.Mojo; /** * Creates a text file in the project base directory. * - */ -@Mojo( name = "jar-no-fork", defaultPhase = LifecyclePhase.PACKAGE ) -public class JarNoFork extends JarMojo -{ -} + */ +@Mojo(name = "jar-no-fork", defaultPhase = LifecyclePhase.PACKAGE) +public class JarNoFork extends JarMojo {} diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-surefire-plugin/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-surefire-plugin/pom.xml index 6f8f707eba..30f2b225c5 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-surefire-plugin/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-surefire-plugin/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 @@ -34,10 +32,8 @@ under the License. maven-plugin Maven IT Surefire Plugin Stub - - A test plugin that has the same coordinates and goals as the Maven Surefire Plugin. Its goals only create marker - files to check the principle invocation of the goals via the build lifecycle binding. - + A test plugin that has the same coordinates and goals as the Maven Surefire Plugin. Its goals only create marker + files to check the principle invocation of the goals via the build lifecycle binding. 2008 diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/coreit/TestMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/coreit/TestMojo.java index da82018570..615041e6dc 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/coreit/TestMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/coreit/TestMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,10 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; +import java.io.IOException; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; @@ -27,25 +29,20 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; -import java.io.File; -import java.io.IOException; - /** * Creates a text file in the project base directory. * - * + * * @author Benjamin Bentmann * */ -@Mojo( name = "test", defaultPhase = LifecyclePhase.TEST ) -public class TestMojo - extends AbstractMojo -{ +@Mojo(name = "test", defaultPhase = LifecyclePhase.TEST) +public class TestMojo extends AbstractMojo { /** * The current Maven project. */ - @Parameter( defaultValue = "${project}", required = true, readonly = true ) + @Parameter(defaultValue = "${project}", required = true, readonly = true) private MavenProject project; /** @@ -61,35 +58,27 @@ public class TestMojo * @throws MojoExecutionException If the output file could not be created. * @throws MojoFailureException If the output file has not been set. */ - public void execute() - throws MojoExecutionException, MojoFailureException - { - getLog().info( "[MAVEN-CORE-IT-LOG] Using output file path: " + pathname ); + public void execute() throws MojoExecutionException, MojoFailureException { + getLog().info("[MAVEN-CORE-IT-LOG] Using output file path: " + pathname); - if ( pathname == null || pathname.length() <= 0 ) - { - throw new MojoFailureException( "Path name for output file has not been specified" ); + if (pathname == null || pathname.length() <= 0) { + throw new MojoFailureException("Path name for output file has not been specified"); } - File outputFile = new File( pathname ); - if ( !outputFile.isAbsolute() ) - { - outputFile = new File( project.getBasedir(), pathname ).getAbsoluteFile(); + File outputFile = new File(pathname); + if (!outputFile.isAbsolute()) { + outputFile = new File(project.getBasedir(), pathname).getAbsoluteFile(); } - getLog().info( "[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile); - try - { - outputFile.getParentFile().mkdirs(); - outputFile.createNewFile(); - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Output file could not be created: " + pathname, e ); + try { + outputFile.getParentFile().mkdirs(); + outputFile.createNewFile(); + } catch (IOException e) { + throw new MojoExecutionException("Output file could not be created: " + pathname, e); } - getLog().info( "[MAVEN-CORE-IT-LOG] Created output file: " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Created output file: " + outputFile); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-war-plugin/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-war-plugin/pom.xml index 3f6732ac20..f1de491ec7 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-war-plugin/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-war-plugin/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 @@ -34,10 +32,8 @@ under the License. maven-plugin Maven IT WAR Plugin Stub - - A test plugin that has the same coordinates and goals as the Maven WAR Plugin. Its goals only create marker - files to check the principle invocation of the goals via the build lifecycle binding. - + A test plugin that has the same coordinates and goals as the Maven WAR Plugin. Its goals only create marker + files to check the principle invocation of the goals via the build lifecycle binding. 2008 diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-war-plugin/src/main/java/org/apache/maven/plugin/coreit/WarMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-war-plugin/src/main/java/org/apache/maven/plugin/coreit/WarMojo.java index c984afea15..847510188e 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-war-plugin/src/main/java/org/apache/maven/plugin/coreit/WarMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-war-plugin/src/main/java/org/apache/maven/plugin/coreit/WarMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,10 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; +import java.io.IOException; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; @@ -27,25 +29,20 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; -import java.io.File; -import java.io.IOException; - /** * Creates a text file in the project base directory. * - * + * * @author Benjamin Bentmann * */ -@Mojo( name = "war", defaultPhase = LifecyclePhase.PACKAGE ) -public class WarMojo - extends AbstractMojo -{ +@Mojo(name = "war", defaultPhase = LifecyclePhase.PACKAGE) +public class WarMojo extends AbstractMojo { /** * The current Maven project. */ - @Parameter( defaultValue = "${project}", required = true, readonly = true ) + @Parameter(defaultValue = "${project}", required = true, readonly = true) private MavenProject project; /** @@ -61,35 +58,27 @@ public class WarMojo * @throws MojoExecutionException If the output file could not be created. * @throws MojoFailureException If the output file has not been set. */ - public void execute() - throws MojoExecutionException, MojoFailureException - { - getLog().info( "[MAVEN-CORE-IT-LOG] Using output file path: " + pathname ); + public void execute() throws MojoExecutionException, MojoFailureException { + getLog().info("[MAVEN-CORE-IT-LOG] Using output file path: " + pathname); - if ( pathname == null || pathname.length() <= 0 ) - { - throw new MojoFailureException( "Path name for output file has not been specified" ); + if (pathname == null || pathname.length() <= 0) { + throw new MojoFailureException("Path name for output file has not been specified"); } - File outputFile = new File( pathname ); - if ( !outputFile.isAbsolute() ) - { - outputFile = new File( project.getBasedir(), pathname ).getAbsoluteFile(); + File outputFile = new File(pathname); + if (!outputFile.isAbsolute()) { + outputFile = new File(project.getBasedir(), pathname).getAbsoluteFile(); } - getLog().info( "[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile); - try - { - outputFile.getParentFile().mkdirs(); - outputFile.createNewFile(); - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Output file could not be created: " + pathname, e ); + try { + outputFile.getParentFile().mkdirs(); + outputFile.createNewFile(); + } catch (IOException e) { + throw new MojoExecutionException("Output file could not be created: " + pathname, e); } - getLog().info( "[MAVEN-CORE-IT-LOG] Created output file: " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Created output file: " + outputFile); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/pom.xml index 5e9b260f30..d58dea9996 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 - maven-it-plugins org.apache.maven.its.plugins + maven-it-plugins 2.1-SNAPSHOT @@ -32,10 +30,8 @@ under the License. pom Maven ITs :: Core Plugin Stubs - - Collection of test plugins that have the same coordinates and goals as the Core Maven Plugins. Their goals only create marker - files to check the principle invocation of the goals via the build lifecycle binding. - + Collection of test plugins that have the same coordinates and goals as the Core Maven Plugins. Their goals only create marker + files to check the principle invocation of the goals via the build lifecycle binding. maven-clean-plugin diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-collection/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-collection/pom.xml index 74da6292c1..1c18159de1 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-collection/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-collection/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 - maven-it-plugins org.apache.maven.its.plugins + maven-it-plugins 2.1-SNAPSHOT @@ -32,10 +30,8 @@ under the License. maven-plugin Maven IT Plugin :: Dependency Collection - - A test plugin that provides several goals which employ @requiresDependencyCollection with different scopes. If - desired, the resulting artifact identifiers can be written to a text file. - + A test plugin that provides several goals which employ @requiresDependencyCollection with different scopes. If + desired, the resulting artifact identifiers can be written to a text file. 2008 diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-collection/src/main/java/org/apache/maven/plugin/coreit/AbstractDependencyMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-collection/src/main/java/org/apache/maven/plugin/coreit/AbstractDependencyMojo.java index bd33f40f08..7473c48d35 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-collection/src/main/java/org/apache/maven/plugin/coreit/AbstractDependencyMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-collection/src/main/java/org/apache/maven/plugin/coreit/AbstractDependencyMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,12 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugins.annotations.Parameter; -import org.apache.maven.project.MavenProject; +package org.apache.maven.plugin.coreit; import java.io.BufferedWriter; import java.io.File; @@ -32,20 +25,24 @@ import java.io.IOException; import java.io.OutputStreamWriter; import java.util.Collection; +import org.apache.maven.artifact.Artifact; +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.project.MavenProject; + /** * Provides common services for all mojos of this plugin. * * @author Benjamin Bentmann * */ -public abstract class AbstractDependencyMojo - extends AbstractMojo -{ +public abstract class AbstractDependencyMojo extends AbstractMojo { /** * The current Maven project. */ - @Parameter( defaultValue = "${project}", required = true, readonly = true ) + @Parameter(defaultValue = "${project}", required = true, readonly = true) protected MavenProject project; /** @@ -56,56 +53,41 @@ public abstract class AbstractDependencyMojo * @param artifacts The list of artifacts to write to the file, may be null. * @throws MojoExecutionException If the output file could not be written. */ - protected void writeArtifacts( String pathname, Collection artifacts ) - throws MojoExecutionException - { - if ( pathname == null || pathname.length() <= 0 ) - { + protected void writeArtifacts(String pathname, Collection artifacts) throws MojoExecutionException { + if (pathname == null || pathname.length() <= 0) { return; } - File file = resolveFile( pathname ); + File file = resolveFile(pathname); - getLog().info( "[MAVEN-CORE-IT-LOG] Dumping artifact list: " + file ); + getLog().info("[MAVEN-CORE-IT-LOG] Dumping artifact list: " + file); BufferedWriter writer = null; - try - { + try { file.getParentFile().mkdirs(); - writer = new BufferedWriter( new OutputStreamWriter( new FileOutputStream( file ), "UTF-8" ) ); + writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF-8")); - if ( artifacts != null ) - { - for ( Object artifact1 : artifacts ) - { + if (artifacts != null) { + for (Object artifact1 : artifacts) { Artifact artifact = (Artifact) artifact1; - writer.write( artifact.getId() ); + writer.write(artifact.getId()); String optional = ""; - if ( artifact.isOptional() ) - { + if (artifact.isOptional()) { optional = " (optional)"; - writer.write( optional ); + writer.write(optional); } writer.newLine(); - getLog().info( "[MAVEN-CORE-IT-LOG] " + artifact.getId() + optional ); + getLog().info("[MAVEN-CORE-IT-LOG] " + artifact.getId() + optional); } } - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Failed to write artifact list", e ); - } - finally - { - if ( writer != null ) - { - try - { + } catch (IOException e) { + throw new MojoExecutionException("Failed to write artifact list", e); + } finally { + if (writer != null) { + try { writer.close(); - } - catch ( IOException e ) - { + } catch (IOException e) { // just ignore } } @@ -113,21 +95,17 @@ public abstract class AbstractDependencyMojo } // NOTE: We don't want to test path translation here so resolve relative path manually for robustness - private File resolveFile( String pathname ) - { + private File resolveFile(String pathname) { File file = null; - if ( pathname != null ) - { - file = new File( pathname ); + if (pathname != null) { + file = new File(pathname); - if ( !file.isAbsolute() ) - { - file = new File( project.getBasedir(), pathname ); + if (!file.isAbsolute()) { + file = new File(project.getBasedir(), pathname); } } return file; } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-collection/src/main/java/org/apache/maven/plugin/coreit/AggregateTestMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-collection/src/main/java/org/apache/maven/plugin/coreit/AggregateTestMojo.java index b5d58637d9..9a8b90164c 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-collection/src/main/java/org/apache/maven/plugin/coreit/AggregateTestMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-collection/src/main/java/org/apache/maven/plugin/coreit/AggregateTestMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,9 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.util.List; import org.apache.maven.artifact.DependencyResolutionRequiredException; import org.apache.maven.plugin.MojoExecutionException; @@ -26,8 +27,6 @@ import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.plugins.annotations.ResolutionScope; import org.apache.maven.project.MavenProject; -import java.util.List; - /** * Combines dependency collection with aggregation. The path parameters of this mojo support the token * @artifactId@ to dynamically adjust the output file for each project in the reactor whose @@ -35,10 +34,8 @@ import java.util.List; * * @author Benjamin Bentmann */ -@Mojo( name = "aggregate-test", requiresDependencyCollection = ResolutionScope.TEST, aggregator = true ) -public class AggregateTestMojo - extends AbstractDependencyMojo -{ +@Mojo(name = "aggregate-test", requiresDependencyCollection = ResolutionScope.TEST, aggregator = true) +public class AggregateTestMojo extends AbstractDependencyMojo { /** * The path to the output file for the project artifacts, relative to the project base directory. Each line of this @@ -46,13 +43,13 @@ public class AggregateTestMojo * disk. Unlike the test artifacts, the collection of project artifacts additionally contains those artifacts that * do not contribute to the class path. */ - @Parameter( property = "depres.projectArtifacts" ) + @Parameter(property = "depres.projectArtifacts") private String projectArtifacts; /** * The Maven projects in the reactor. */ - @Parameter( defaultValue = "${reactorProjects}", readonly = true ) + @Parameter(defaultValue = "${reactorProjects}", readonly = true) private List reactorProjects; /** @@ -60,36 +57,27 @@ public class AggregateTestMojo * * @throws MojoExecutionException If the output file could not be created or any dependency could not be resolved. */ - public void execute() - throws MojoExecutionException - { - try - { - for ( MavenProject project : reactorProjects ) - { - writeArtifacts( filter( projectArtifacts, project ), project.getArtifacts() ); + public void execute() throws MojoExecutionException { + try { + for (MavenProject project : reactorProjects) { + writeArtifacts(filter(projectArtifacts, project), project.getArtifacts()); // NOTE: We can't make any assumptions about the class path but as a minimum it must not cause an // exception project.getTestClasspathElements(); } - } - catch ( DependencyResolutionRequiredException e ) - { - throw new MojoExecutionException( "Failed to resolve dependencies", e ); + } catch (DependencyResolutionRequiredException e) { + throw new MojoExecutionException("Failed to resolve dependencies", e); } } - private String filter( String filename, MavenProject project ) - { + private String filter(String filename, MavenProject project) { String result = filename; - if ( filename != null ) - { - result = result.replaceAll( "@artifactId@", project.getArtifactId() ); + if (filename != null) { + result = result.replaceAll("@artifactId@", project.getArtifactId()); } return result; } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-collection/src/main/java/org/apache/maven/plugin/coreit/CompileMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-collection/src/main/java/org/apache/maven/plugin/coreit/CompileMojo.java index a39d921bb9..8d61f604f1 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-collection/src/main/java/org/apache/maven/plugin/coreit/CompileMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-collection/src/main/java/org/apache/maven/plugin/coreit/CompileMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; import org.apache.maven.artifact.DependencyResolutionRequiredException; import org.apache.maven.plugin.MojoExecutionException; @@ -31,10 +30,8 @@ import org.apache.maven.plugins.annotations.ResolutionScope; * @author Benjamin Bentmann * */ -@Mojo( name = "compile", requiresDependencyCollection = ResolutionScope.COMPILE ) -public class CompileMojo - extends AbstractDependencyMojo -{ +@Mojo(name = "compile", requiresDependencyCollection = ResolutionScope.COMPILE) +public class CompileMojo extends AbstractDependencyMojo { /** * The path to the output file for the project artifacts, relative to the project base directory. Each line of this @@ -42,7 +39,7 @@ public class CompileMojo * disk. Unlike the compile artifacts, the collection of project artifacts additionally contains those artifacts * that do not contribute to the class path. */ - @Parameter( property = "depres.projectArtifacts" ) + @Parameter(property = "depres.projectArtifacts") private String projectArtifacts; /** @@ -50,7 +47,7 @@ public class CompileMojo * UTF-8 encoded file specifies an artifact identifier. If not specified, the artifact list will not be written to * disk. */ - @Parameter( property = "depres.compileArtifacts" ) + @Parameter(property = "depres.compileArtifacts") private String compileArtifacts; /** @@ -58,21 +55,15 @@ public class CompileMojo * * @throws MojoExecutionException If the output file could not be created or any dependency could not be resolved. */ - public void execute() - throws MojoExecutionException - { - try - { - writeArtifacts( projectArtifacts, project.getArtifacts() ); - writeArtifacts( compileArtifacts, project.getCompileArtifacts() ); + public void execute() throws MojoExecutionException { + try { + writeArtifacts(projectArtifacts, project.getArtifacts()); + writeArtifacts(compileArtifacts, project.getCompileArtifacts()); // NOTE: We can't make any assumptions about the class path but as a minimum it must not cause an exception project.getCompileClasspathElements(); - } - catch ( DependencyResolutionRequiredException e ) - { - throw new MojoExecutionException( "Failed to resolve dependencies", e ); + } catch (DependencyResolutionRequiredException e) { + throw new MojoExecutionException("Failed to resolve dependencies", e); } } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-collection/src/main/java/org/apache/maven/plugin/coreit/RuntimeMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-collection/src/main/java/org/apache/maven/plugin/coreit/RuntimeMojo.java index b1892f016f..39af72bee3 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-collection/src/main/java/org/apache/maven/plugin/coreit/RuntimeMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-collection/src/main/java/org/apache/maven/plugin/coreit/RuntimeMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; import org.apache.maven.artifact.DependencyResolutionRequiredException; import org.apache.maven.plugin.MojoExecutionException; @@ -31,10 +30,8 @@ import org.apache.maven.plugins.annotations.ResolutionScope; * @author Benjamin Bentmann * */ -@Mojo( name = "runtime", requiresDependencyCollection = ResolutionScope.RUNTIME ) -public class RuntimeMojo - extends AbstractDependencyMojo -{ +@Mojo(name = "runtime", requiresDependencyCollection = ResolutionScope.RUNTIME) +public class RuntimeMojo extends AbstractDependencyMojo { /** * The path to the output file for the project artifacts, relative to the project base directory. Each line of this @@ -42,7 +39,7 @@ public class RuntimeMojo * disk. Unlike the runtime artifacts, the collection of project artifacts additionally contains those artifacts * that do not contribute to the class path. */ - @Parameter( property = "depres.projectArtifacts" ) + @Parameter(property = "depres.projectArtifacts") private String projectArtifacts; /** @@ -50,7 +47,7 @@ public class RuntimeMojo * UTF-8 encoded file specifies an artifact identifier. If not specified, the artifact list will not be written to * disk. */ - @Parameter( property = "depres.runtimeArtifacts" ) + @Parameter(property = "depres.runtimeArtifacts") private String runtimeArtifacts; /** @@ -58,21 +55,15 @@ public class RuntimeMojo * * @throws MojoExecutionException If the output file could not be created or any dependency could not be resolved. */ - public void execute() - throws MojoExecutionException - { - try - { - writeArtifacts( projectArtifacts, project.getArtifacts() ); - writeArtifacts( runtimeArtifacts, project.getRuntimeArtifacts() ); + public void execute() throws MojoExecutionException { + try { + writeArtifacts(projectArtifacts, project.getArtifacts()); + writeArtifacts(runtimeArtifacts, project.getRuntimeArtifacts()); // NOTE: We can't make any assumptions about the class path but as a minimum it must not cause an exception project.getRuntimeClasspathElements(); - } - catch ( DependencyResolutionRequiredException e ) - { - throw new MojoExecutionException( "Failed to resolve dependencies", e ); + } catch (DependencyResolutionRequiredException e) { + throw new MojoExecutionException("Failed to resolve dependencies", e); } } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-collection/src/main/java/org/apache/maven/plugin/coreit/TestMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-collection/src/main/java/org/apache/maven/plugin/coreit/TestMojo.java index cfd76cda63..573316d03e 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-collection/src/main/java/org/apache/maven/plugin/coreit/TestMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-collection/src/main/java/org/apache/maven/plugin/coreit/TestMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; import org.apache.maven.artifact.DependencyResolutionRequiredException; import org.apache.maven.plugin.MojoExecutionException; @@ -31,10 +30,8 @@ import org.apache.maven.plugins.annotations.ResolutionScope; * @author Benjamin Bentmann * */ -@Mojo( name = "test", requiresDependencyCollection = ResolutionScope.TEST ) -public class TestMojo - extends AbstractDependencyMojo -{ +@Mojo(name = "test", requiresDependencyCollection = ResolutionScope.TEST) +public class TestMojo extends AbstractDependencyMojo { /** * The path to the output file for the project artifacts, relative to the project base directory. Each line of this @@ -42,7 +39,7 @@ public class TestMojo * disk. Unlike the test artifacts, the collection of project artifacts additionally contains those artifacts that * do not contribute to the class path. */ - @Parameter( property = "depres.projectArtifacts" ) + @Parameter(property = "depres.projectArtifacts") private String projectArtifacts; /** @@ -50,7 +47,7 @@ public class TestMojo * UTF-8 encoded file specifies an artifact identifier. If not specified, the artifact list will not be written to * disk. */ - @Parameter( property = "depres.testArtifacts" ) + @Parameter(property = "depres.testArtifacts") private String testArtifacts; /** @@ -58,21 +55,15 @@ public class TestMojo * * @throws MojoExecutionException If the output file could not be created or any dependency could not be resolved. */ - public void execute() - throws MojoExecutionException - { - try - { - writeArtifacts( projectArtifacts, project.getArtifacts() ); - writeArtifacts( testArtifacts, project.getTestArtifacts() ); + public void execute() throws MojoExecutionException { + try { + writeArtifacts(projectArtifacts, project.getArtifacts()); + writeArtifacts(testArtifacts, project.getTestArtifacts()); // NOTE: We can't make any assumptions about the class path but as a minimum it must not cause an exception project.getTestClasspathElements(); - } - catch ( DependencyResolutionRequiredException e ) - { - throw new MojoExecutionException( "Failed to resolve dependencies", e ); + } catch (DependencyResolutionRequiredException e) { + throw new MojoExecutionException("Failed to resolve dependencies", e); } } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/pom.xml index 897056c133..973f9c5c3c 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 - maven-it-plugins org.apache.maven.its.plugins + maven-it-plugins 2.1-SNAPSHOT @@ -32,10 +30,8 @@ under the License. maven-plugin Maven IT Plugin :: Dependency Resolution - - A test plugin that provides several goals which employ @requiresDependencyResolution with different scopes. If - desired, the resulting class path or artifact identifiers can be written to a text file. - + A test plugin that provides several goals which employ @requiresDependencyResolution with different scopes. If + desired, the resulting class path or artifact identifiers can be written to a text file. 2008 diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/src/main/java/org/apache/maven/plugin/coreit/AbstractDependencyMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/src/main/java/org/apache/maven/plugin/coreit/AbstractDependencyMojo.java index fc082634c8..58b9e53d02 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/src/main/java/org/apache/maven/plugin/coreit/AbstractDependencyMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/src/main/java/org/apache/maven/plugin/coreit/AbstractDependencyMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,12 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugins.annotations.Parameter; -import org.apache.maven.project.MavenProject; +package org.apache.maven.plugin.coreit; import java.io.BufferedWriter; import java.io.File; @@ -37,20 +30,24 @@ import java.security.NoSuchAlgorithmException; import java.util.Collection; import java.util.Properties; +import org.apache.maven.artifact.Artifact; +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.project.MavenProject; + /** * Provides common services for all mojos of this plugin. * * @author Benjamin Bentmann * */ -public abstract class AbstractDependencyMojo - extends AbstractMojo -{ +public abstract class AbstractDependencyMojo extends AbstractMojo { /** * The current Maven project. */ - @Parameter( defaultValue = "${project}", required = true, readonly = true ) + @Parameter(defaultValue = "${project}", required = true, readonly = true) protected MavenProject project; /** @@ -60,7 +57,7 @@ public abstract class AbstractDependencyMojo * as directory separator. For non-positive values, the full/absolute path is returned, using the platform-specific * separator. */ - @Parameter( property = "depres.significantPathLevels" ) + @Parameter(property = "depres.significantPathLevels") private int significantPathLevels; /** @@ -71,65 +68,49 @@ public abstract class AbstractDependencyMojo * @param artifacts The list of artifacts to write to the file, may be null. * @throws MojoExecutionException If the output file could not be written. */ - protected void writeArtifacts( String pathname, Collection artifacts ) - throws MojoExecutionException - { - if ( pathname == null || pathname.length() <= 0 ) - { + protected void writeArtifacts(String pathname, Collection artifacts) throws MojoExecutionException { + if (pathname == null || pathname.length() <= 0) { return; } - File file = resolveFile( pathname ); + File file = resolveFile(pathname); - getLog().info( "[MAVEN-CORE-IT-LOG] Dumping artifact list: " + file ); + getLog().info("[MAVEN-CORE-IT-LOG] Dumping artifact list: " + file); BufferedWriter writer = null; - try - { + try { file.getParentFile().mkdirs(); - writer = new BufferedWriter( new OutputStreamWriter( new FileOutputStream( file ), "UTF-8" ) ); + writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF-8")); - if ( artifacts != null ) - { - for ( Object artifact1 : artifacts ) - { + if (artifacts != null) { + for (Object artifact1 : artifacts) { Artifact artifact = (Artifact) artifact1; - String id = getId( artifact ); - writer.write( id ); + String id = getId(artifact); + writer.write(id); String optional = ""; - if ( artifact.isOptional() ) - { + if (artifact.isOptional()) { optional = " (optional)"; - writer.write( optional ); + writer.write(optional); } writer.newLine(); - getLog().info( "[MAVEN-CORE-IT-LOG] " + id + optional ); + getLog().info("[MAVEN-CORE-IT-LOG] " + id + optional); } } - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Failed to write artifact list", e ); - } - finally - { - if ( writer != null ) - { - try - { + } catch (IOException e) { + throw new MojoExecutionException("Failed to write artifact list", e); + } finally { + if (writer != null) { + try { writer.close(); - } - catch ( IOException e ) - { + } catch (IOException e) { // just ignore } } } } - private String getId( Artifact artifact ) - { + private String getId(Artifact artifact) { artifact.isSnapshot(); // decouple from MNG-2961 return artifact.getId(); } @@ -142,231 +123,179 @@ public abstract class AbstractDependencyMojo * @param classPath The list of class path elements to write to the file, may be null. * @throws MojoExecutionException If the output file could not be written. */ - protected void writeClassPath( String pathname, Collection classPath ) - throws MojoExecutionException - { - if ( pathname == null || pathname.length() <= 0 ) - { + protected void writeClassPath(String pathname, Collection classPath) throws MojoExecutionException { + if (pathname == null || pathname.length() <= 0) { return; } - File file = resolveFile( pathname ); + File file = resolveFile(pathname); - getLog().info( "[MAVEN-CORE-IT-LOG] Dumping class path: " + file ); + getLog().info("[MAVEN-CORE-IT-LOG] Dumping class path: " + file); BufferedWriter writer = null; - try - { + try { file.getParentFile().mkdirs(); - writer = new BufferedWriter( new OutputStreamWriter( new FileOutputStream( file ), "UTF-8" ) ); + writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF-8")); - if ( classPath != null ) - { - for ( Object aClassPath : classPath ) - { + if (classPath != null) { + for (Object aClassPath : classPath) { String element = aClassPath.toString(); - writer.write( stripLeadingDirs( element, significantPathLevels ) ); + writer.write(stripLeadingDirs(element, significantPathLevels)); writer.newLine(); - getLog().info( "[MAVEN-CORE-IT-LOG] " + element ); + getLog().info("[MAVEN-CORE-IT-LOG] " + element); } } - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Failed to write class path list", e ); - } - finally - { - if ( writer != null ) - { - try - { + } catch (IOException e) { + throw new MojoExecutionException("Failed to write class path list", e); + } finally { + if (writer != null) { + try { writer.close(); - } - catch ( IOException e ) - { + } catch (IOException e) { // just ignore } } } } - protected void writeClassPathChecksums( String pathname, Collection classPath ) - throws MojoExecutionException - { - if ( pathname == null || pathname.length() <= 0 ) - { + protected void writeClassPathChecksums(String pathname, Collection classPath) throws MojoExecutionException { + if (pathname == null || pathname.length() <= 0) { return; } - File file = resolveFile( pathname ); + File file = resolveFile(pathname); - getLog().info( "[MAVEN-CORE-IT-LOG] Dumping class path checksums: " + file ); + getLog().info("[MAVEN-CORE-IT-LOG] Dumping class path checksums: " + file); Properties checksums = new Properties(); - if ( classPath != null ) - { - for ( Object aClassPath : classPath ) - { + if (classPath != null) { + for (Object aClassPath : classPath) { String element = aClassPath.toString(); - File jarFile = new File( element ); + File jarFile = new File(element); - if ( !jarFile.isFile() ) - { - getLog().info( "[MAVEN-CORE-IT-LOG] ( no file ) < " + element ); + if (!jarFile.isFile()) { + getLog().info("[MAVEN-CORE-IT-LOG] ( no file ) < " + element); continue; } - String key = stripLeadingDirs( element, significantPathLevels ); + String key = stripLeadingDirs(element, significantPathLevels); String hash; - try - { - hash = calcChecksum( jarFile ); - } - catch ( NoSuchAlgorithmException e ) - { - throw new MojoExecutionException( "Failed to lookup message digest", e ); - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Failed to calculate checksum for " + jarFile, e ); + try { + hash = calcChecksum(jarFile); + } catch (NoSuchAlgorithmException e) { + throw new MojoExecutionException("Failed to lookup message digest", e); + } catch (IOException e) { + throw new MojoExecutionException("Failed to calculate checksum for " + jarFile, e); } - checksums.setProperty( key, hash ); + checksums.setProperty(key, hash); - getLog().info( "[MAVEN-CORE-IT-LOG] " + hash + " < " + element ); + getLog().info("[MAVEN-CORE-IT-LOG] " + hash + " < " + element); } } FileOutputStream os = null; - try - { + try { file.getParentFile().mkdirs(); - os = new FileOutputStream( file ); + os = new FileOutputStream(file); - checksums.store( os, "MAVEN-CORE-IT" ); - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Failed to write class path checksums", e ); - } - finally - { - if ( os != null ) - { - try - { + checksums.store(os, "MAVEN-CORE-IT"); + } catch (IOException e) { + throw new MojoExecutionException("Failed to write class path checksums", e); + } finally { + if (os != null) { + try { os.close(); - } - catch ( IOException e ) - { + } catch (IOException e) { // just ignore } } } } - private String calcChecksum( File jarFile ) - throws IOException, NoSuchAlgorithmException - { - MessageDigest digester = MessageDigest.getInstance( "SHA-1" ); + private String calcChecksum(File jarFile) throws IOException, NoSuchAlgorithmException { + MessageDigest digester = MessageDigest.getInstance("SHA-1"); - try ( FileInputStream is = new FileInputStream( jarFile ) ) - { - DigestInputStream dis = new DigestInputStream( is, digester ); + try (FileInputStream is = new FileInputStream(jarFile)) { + DigestInputStream dis = new DigestInputStream(is, digester); - for ( byte[] buffer = new byte[1024 * 4]; dis.read( buffer ) >= 0; ) - { + for (byte[] buffer = new byte[1024 * 4]; dis.read(buffer) >= 0; ) { // just read it } } byte[] digest = digester.digest(); - StringBuilder hash = new StringBuilder( digest.length * 2 ); + StringBuilder hash = new StringBuilder(digest.length * 2); - for ( byte aDigest : digest ) - { - @SuppressWarnings( "checkstyle:magicnumber" ) int b = aDigest & 0xFF; + for (byte aDigest : digest) { + @SuppressWarnings("checkstyle:magicnumber") + int b = aDigest & 0xFF; - if ( b < 0x10 ) - { - hash.append( '0' ); + if (b < 0x10) { + hash.append('0'); } - hash.append( Integer.toHexString( b ) ); + hash.append(Integer.toHexString(b)); } return hash.toString(); } - private String stripLeadingDirs( String path, int significantPathLevels ) - { + private String stripLeadingDirs(String path, int significantPathLevels) { String result; - if ( significantPathLevels > 0 ) - { + if (significantPathLevels > 0) { result = ""; - File file = new File( path ); - for ( int i = 0; i < significantPathLevels && file != null; i++ ) - { - if ( result.length() > 0 ) - { + File file = new File(path); + for (int i = 0; i < significantPathLevels && file != null; i++) { + if (result.length() > 0) { // NOTE: Always use forward slash here to ease platform-independent testing result = '/' + result; } result = file.getName() + result; file = file.getParentFile(); } - } - else - { + } else { result = path; } return result; } // NOTE: We don't want to test path translation here so resolve relative path manually for robustness - private File resolveFile( String pathname ) - { + private File resolveFile(String pathname) { File file = null; - if ( pathname != null ) - { - if ( pathname.contains( "@idx@" ) ) - { + if (pathname != null) { + if (pathname.contains("@idx@")) { // helps to distinguished forked executions of the same mojo - pathname = pathname.replaceAll( "@idx@", String.valueOf( nextCounter() ) ); + pathname = pathname.replaceAll("@idx@", String.valueOf(nextCounter())); } - file = new File( pathname ); + file = new File(pathname); - if ( !file.isAbsolute() ) - { - file = new File( project.getBasedir(), pathname ); + if (!file.isAbsolute()) { + file = new File(project.getBasedir(), pathname); } } return file; } - private int nextCounter() - { + private int nextCounter() { int counter = 0; String key = getClass().getName(); - synchronized ( System.class ) - { - counter = Integer.getInteger( key, 0 ); - System.setProperty( key, Integer.toString( counter + 1 ) ); + synchronized (System.class) { + counter = Integer.getInteger(key, 0); + System.setProperty(key, Integer.toString(counter + 1)); } return counter; } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/src/main/java/org/apache/maven/plugin/coreit/AggregateTestMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/src/main/java/org/apache/maven/plugin/coreit/AggregateTestMojo.java index ade5bf0394..6ba62ce656 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/src/main/java/org/apache/maven/plugin/coreit/AggregateTestMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/src/main/java/org/apache/maven/plugin/coreit/AggregateTestMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,9 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.util.List; import org.apache.maven.artifact.DependencyResolutionRequiredException; import org.apache.maven.plugin.MojoExecutionException; @@ -26,8 +27,6 @@ import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.plugins.annotations.ResolutionScope; import org.apache.maven.project.MavenProject; -import java.util.List; - /** * Combines dependency resolution with aggregation. The path parameters of this mojo support the token * @artifactId@ to dynamically adjust the output file for each project in the reactor whose @@ -35,10 +34,8 @@ import java.util.List; * * @author Benjamin Bentmann */ -@Mojo( name = "aggregate-test", requiresDependencyResolution = ResolutionScope.TEST, aggregator = true ) -public class AggregateTestMojo - extends AbstractDependencyMojo -{ +@Mojo(name = "aggregate-test", requiresDependencyResolution = ResolutionScope.TEST, aggregator = true) +public class AggregateTestMojo extends AbstractDependencyMojo { /** * The path to the output file for the project artifacts, relative to the project base directory. Each line of this @@ -46,7 +43,7 @@ public class AggregateTestMojo * disk. Unlike the test artifacts, the collection of project artifacts additionally contains those artifacts that * do not contribute to the class path. */ - @Parameter( property = "depres.projectArtifacts" ) + @Parameter(property = "depres.projectArtifacts") private String projectArtifacts; /** @@ -54,7 +51,7 @@ public class AggregateTestMojo * this UTF-8 encoded file specifies the absolute path to a class path element. If not specified, the class path * will not be written to disk. */ - @Parameter( property = "depres.testClassPath" ) + @Parameter(property = "depres.testClassPath") private String testClassPath; /** @@ -62,13 +59,13 @@ public class AggregateTestMojo * directory. The (trimmed) path to a JAR is used as the property key, the property value is the SHA-1 hash of the * JAR. If not specified, the class path checksums will not be calculated. */ - @Parameter( property = "depres.testClassPathChecksums" ) + @Parameter(property = "depres.testClassPathChecksums") private String testClassPathChecksums; /** * The Maven projects in the reactor. */ - @Parameter( defaultValue = "${reactorProjects}", readonly = true ) + @Parameter(defaultValue = "${reactorProjects}", readonly = true) private List reactorProjects; /** @@ -76,35 +73,25 @@ public class AggregateTestMojo * * @throws MojoExecutionException If the output file could not be created or any dependency could not be resolved. */ - public void execute() - throws MojoExecutionException - { - try - { - for ( MavenProject project : reactorProjects ) - { - writeArtifacts( filter( projectArtifacts, project ), project.getArtifacts() ); - writeClassPath( filter( testClassPath, project ), project.getTestClasspathElements() ); - writeClassPathChecksums( filter( testClassPathChecksums, project ), - project.getTestClasspathElements() ); + public void execute() throws MojoExecutionException { + try { + for (MavenProject project : reactorProjects) { + writeArtifacts(filter(projectArtifacts, project), project.getArtifacts()); + writeClassPath(filter(testClassPath, project), project.getTestClasspathElements()); + writeClassPathChecksums(filter(testClassPathChecksums, project), project.getTestClasspathElements()); } - } - catch ( DependencyResolutionRequiredException e ) - { - throw new MojoExecutionException( "Failed to resolve dependencies", e ); + } catch (DependencyResolutionRequiredException e) { + throw new MojoExecutionException("Failed to resolve dependencies", e); } } - private String filter( String filename, MavenProject project ) - { + private String filter(String filename, MavenProject project) { String result = filename; - if ( filename != null ) - { - result = result.replaceAll( "@artifactId@", project.getArtifactId() ); + if (filename != null) { + result = result.replaceAll("@artifactId@", project.getArtifactId()); } return result; } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/src/main/java/org/apache/maven/plugin/coreit/CompileMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/src/main/java/org/apache/maven/plugin/coreit/CompileMojo.java index cca2c25880..0fcda0c947 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/src/main/java/org/apache/maven/plugin/coreit/CompileMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/src/main/java/org/apache/maven/plugin/coreit/CompileMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; import org.apache.maven.artifact.DependencyResolutionRequiredException; import org.apache.maven.plugin.MojoExecutionException; @@ -33,10 +32,8 @@ import org.apache.maven.plugins.annotations.ResolutionScope; * @author Benjamin Bentmann * */ -@Mojo( name = "compile", requiresDependencyResolution = ResolutionScope.COMPILE ) -public class CompileMojo - extends AbstractDependencyMojo -{ +@Mojo(name = "compile", requiresDependencyResolution = ResolutionScope.COMPILE) +public class CompileMojo extends AbstractDependencyMojo { /** * The path to the output file for the project artifacts, relative to the project base directory. Each line of this @@ -44,7 +41,7 @@ public class CompileMojo * disk. Unlike the compile artifacts, the collection of project artifacts additionally contains those artifacts * that do not contribute to the class path. */ - @Parameter( property = "depres.projectArtifacts" ) + @Parameter(property = "depres.projectArtifacts") private String projectArtifacts; /** @@ -52,7 +49,7 @@ public class CompileMojo * UTF-8 encoded file specifies an artifact identifier. If not specified, the artifact list will not be written to * disk. */ - @Parameter( property = "depres.compileArtifacts" ) + @Parameter(property = "depres.compileArtifacts") private String compileArtifacts; /** @@ -60,7 +57,7 @@ public class CompileMojo * this UTF-8 encoded file specifies the absolute path to a class path element. If not specified, the class path * will not be written to disk. */ - @Parameter( property = "depres.compileClassPath" ) + @Parameter(property = "depres.compileClassPath") private String compileClassPath; /** @@ -68,7 +65,7 @@ public class CompileMojo * base directory. The (trimmed) path to a JAR is used as the property key, the property value is the SHA-1 hash of * the JAR. If not specified, the class path checksums will not be calculated. */ - @Parameter( property = "depres.compileClassPathChecksums" ) + @Parameter(property = "depres.compileClassPathChecksums") private String compileClassPathChecksums; /** @@ -76,20 +73,14 @@ public class CompileMojo * * @throws MojoExecutionException If the output file could not be created or any dependency could not be resolved. */ - public void execute() - throws MojoExecutionException - { - try - { - writeArtifacts( projectArtifacts, project.getArtifacts() ); - writeArtifacts( compileArtifacts, project.getCompileArtifacts() ); - writeClassPath( compileClassPath, project.getCompileClasspathElements() ); - writeClassPathChecksums( compileClassPathChecksums, project.getCompileClasspathElements() ); - } - catch ( DependencyResolutionRequiredException e ) - { - throw new MojoExecutionException( "Failed to resolve dependencies", e ); + public void execute() throws MojoExecutionException { + try { + writeArtifacts(projectArtifacts, project.getArtifacts()); + writeArtifacts(compileArtifacts, project.getCompileArtifacts()); + writeClassPath(compileClassPath, project.getCompileClasspathElements()); + writeClassPathChecksums(compileClassPathChecksums, project.getCompileClasspathElements()); + } catch (DependencyResolutionRequiredException e) { + throw new MojoExecutionException("Failed to resolve dependencies", e); } } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/src/main/java/org/apache/maven/plugin/coreit/CompileRuntimeMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/src/main/java/org/apache/maven/plugin/coreit/CompileRuntimeMojo.java index 367e15341d..f1d2868cbe 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/src/main/java/org/apache/maven/plugin/coreit/CompileRuntimeMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/src/main/java/org/apache/maven/plugin/coreit/CompileRuntimeMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; import org.apache.maven.artifact.DependencyResolutionRequiredException; import org.apache.maven.plugin.MojoExecutionException; @@ -33,10 +32,8 @@ import org.apache.maven.plugins.annotations.ResolutionScope; * @author Benjamin Bentmann * */ -@Mojo( name = "compile-runtime", requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME ) -public class CompileRuntimeMojo - extends AbstractDependencyMojo -{ +@Mojo(name = "compile-runtime", requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME) +public class CompileRuntimeMojo extends AbstractDependencyMojo { /** * The path to the output file for the project artifacts, relative to the project base directory. Each line of this @@ -44,7 +41,7 @@ public class CompileRuntimeMojo * disk. Unlike the compile artifacts, the collection of project artifacts additionally contains those artifacts * that do not contribute to the class path. */ - @Parameter( property = "depres.projectArtifacts" ) + @Parameter(property = "depres.projectArtifacts") private String projectArtifacts; /** @@ -52,7 +49,7 @@ public class CompileRuntimeMojo * UTF-8 encoded file specifies an artifact identifier. If not specified, the artifact list will not be written to * disk. */ - @Parameter( property = "depres.compileArtifacts" ) + @Parameter(property = "depres.compileArtifacts") private String compileArtifacts; /** @@ -60,7 +57,7 @@ public class CompileRuntimeMojo * this UTF-8 encoded file specifies the absolute path to a class path element. If not specified, the class path * will not be written to disk. */ - @Parameter( property = "depres.compileClassPath" ) + @Parameter(property = "depres.compileClassPath") private String compileClassPath; /** @@ -68,7 +65,7 @@ public class CompileRuntimeMojo * base directory. The (trimmed) path to a JAR is used as the property key, the property value is the SHA-1 hash of * the JAR. If not specified, the class path checksums will not be calculated. */ - @Parameter( property = "depres.compileClassPathChecksums" ) + @Parameter(property = "depres.compileClassPathChecksums") private String compileClassPathChecksums; /** @@ -76,7 +73,7 @@ public class CompileRuntimeMojo * UTF-8 encoded file specifies an artifact identifier. If not specified, the artifact list will not be written to * disk. */ - @Parameter( property = "depres.runtimeArtifacts" ) + @Parameter(property = "depres.runtimeArtifacts") private String runtimeArtifacts; /** @@ -84,7 +81,7 @@ public class CompileRuntimeMojo * this UTF-8 encoded file specifies the absolute path to a class path element. If not specified, the class path * will not be written to disk. */ - @Parameter( property = "depres.runtimeClassPath" ) + @Parameter(property = "depres.runtimeClassPath") private String runtimeClassPath; /** @@ -92,7 +89,7 @@ public class CompileRuntimeMojo * base directory. The (trimmed) path to a JAR is used as the property key, the property value is the SHA-1 hash of * the JAR. If not specified, the class path checksums will not be calculated. */ - @Parameter( property = "depres.runtimeClassPathChecksums" ) + @Parameter(property = "depres.runtimeClassPathChecksums") private String runtimeClassPathChecksums; /** @@ -100,23 +97,17 @@ public class CompileRuntimeMojo * * @throws MojoExecutionException If the output file could not be created or any dependency could not be resolved. */ - public void execute() - throws MojoExecutionException - { - try - { - writeArtifacts( projectArtifacts, project.getArtifacts() ); - writeArtifacts( compileArtifacts, project.getCompileArtifacts() ); - writeClassPath( compileClassPath, project.getCompileClasspathElements() ); - writeClassPathChecksums( compileClassPathChecksums, project.getCompileClasspathElements() ); - writeArtifacts( runtimeArtifacts, project.getRuntimeArtifacts() ); - writeClassPath( runtimeClassPath, project.getRuntimeClasspathElements() ); - writeClassPathChecksums( runtimeClassPathChecksums, project.getRuntimeClasspathElements() ); - } - catch ( DependencyResolutionRequiredException e ) - { - throw new MojoExecutionException( "Failed to resolve dependencies", e ); + public void execute() throws MojoExecutionException { + try { + writeArtifacts(projectArtifacts, project.getArtifacts()); + writeArtifacts(compileArtifacts, project.getCompileArtifacts()); + writeClassPath(compileClassPath, project.getCompileClasspathElements()); + writeClassPathChecksums(compileClassPathChecksums, project.getCompileClasspathElements()); + writeArtifacts(runtimeArtifacts, project.getRuntimeArtifacts()); + writeClassPath(runtimeClassPath, project.getRuntimeClasspathElements()); + writeClassPathChecksums(runtimeClassPathChecksums, project.getRuntimeClasspathElements()); + } catch (DependencyResolutionRequiredException e) { + throw new MojoExecutionException("Failed to resolve dependencies", e); } } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/src/main/java/org/apache/maven/plugin/coreit/ForkTestMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/src/main/java/org/apache/maven/plugin/coreit/ForkTestMojo.java index 189bfea434..39d8876b45 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/src/main/java/org/apache/maven/plugin/coreit/ForkTestMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/src/main/java/org/apache/maven/plugin/coreit/ForkTestMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; @@ -30,21 +29,16 @@ import org.apache.maven.plugins.annotations.Mojo; * @author Benjamin Bentmann * */ -@Mojo( name = "fork-test" ) -@Execute( goal = "test" ) -public class ForkTestMojo - extends AbstractMojo -{ +@Mojo(name = "fork-test") +@Execute(goal = "test") +public class ForkTestMojo extends AbstractMojo { /** * Runs this mojo. * * @throws MojoExecutionException If an error occured. */ - public void execute() - throws MojoExecutionException - { - getLog().info( "[MAVEN-CORE-IT-LOG] Forked test mojo" ); + public void execute() throws MojoExecutionException { + getLog().info("[MAVEN-CORE-IT-LOG] Forked test mojo"); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/src/main/java/org/apache/maven/plugin/coreit/InjectMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/src/main/java/org/apache/maven/plugin/coreit/InjectMojo.java index e7a8328e19..695d068ffa 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/src/main/java/org/apache/maven/plugin/coreit/InjectMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/src/main/java/org/apache/maven/plugin/coreit/InjectMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,12 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.util.Arrays; +import java.util.Collection; +import java.util.LinkedHashSet; +import java.util.Set; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.factory.ArtifactFactory; @@ -28,21 +32,14 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.Set; - /** * Injects artifacts from the plugin into the dependency artifacts of the project. * * @author Benjamin Bentmann * */ -@Mojo( name = "inject" ) -public class InjectMojo - extends AbstractMojo -{ +@Mojo(name = "inject") +public class InjectMojo extends AbstractMojo { /** * The version-less keys in the form groupId:artifactId of the plugin artifacts to inject into @@ -53,13 +50,13 @@ public class InjectMojo /** */ - @Parameter( defaultValue = "${plugin.artifacts}", readonly = true ) + @Parameter(defaultValue = "${plugin.artifacts}", readonly = true) private Collection pluginArtifacts; /** * The current Maven project. */ - @Parameter( defaultValue = "${project}", readonly = true, required = true ) + @Parameter(defaultValue = "${project}", readonly = true, required = true) private MavenProject project; /** @@ -73,53 +70,46 @@ public class InjectMojo * * @throws MojoExecutionException If an error occured. */ - public void execute() - throws MojoExecutionException - { + public void execute() throws MojoExecutionException { Set artifactKeys = new LinkedHashSet(); - if ( artifacts != null ) - { - artifactKeys.addAll( Arrays.asList( artifacts ) ); + if (artifacts != null) { + artifactKeys.addAll(Arrays.asList(artifacts)); } Set dependencyArtifacts = project.getDependencyArtifacts(); - if ( dependencyArtifacts != null ) - { - dependencyArtifacts = new LinkedHashSet( dependencyArtifacts ); - } - else - { + if (dependencyArtifacts != null) { + dependencyArtifacts = new LinkedHashSet(dependencyArtifacts); + } else { dependencyArtifacts = new LinkedHashSet(); } - for ( Object pluginArtifact : pluginArtifacts ) - { + for (Object pluginArtifact : pluginArtifacts) { Artifact artifact = (Artifact) pluginArtifact; String artifactKey = artifact.getGroupId() + ':' + artifact.getArtifactId(); - if ( artifactKeys.remove( artifactKey ) ) - { - artifact = - factory.createArtifact( artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), - Artifact.SCOPE_COMPILE, artifact.getType() ); + if (artifactKeys.remove(artifactKey)) { + artifact = factory.createArtifact( + artifact.getGroupId(), + artifact.getArtifactId(), + artifact.getVersion(), + Artifact.SCOPE_COMPILE, + artifact.getType()); - getLog().info( "[MAVEN-CORE-IT-LOG] Injecting dependency artifact " + artifact ); + getLog().info("[MAVEN-CORE-IT-LOG] Injecting dependency artifact " + artifact); - dependencyArtifacts.add( artifact ); + dependencyArtifacts.add(artifact); } } - project.setDependencyArtifacts( dependencyArtifacts ); + project.setDependencyArtifacts(dependencyArtifacts); - getLog().info( "[MAVEN-CORE-IT-LOG] Set dependency artifacts to " + dependencyArtifacts ); + getLog().info("[MAVEN-CORE-IT-LOG] Set dependency artifacts to " + dependencyArtifacts); - if ( !artifactKeys.isEmpty() ) - { - getLog().warn( "[MAVEN-CORE-IT-LOG] These artifacts were not found " + artifactKeys ); + if (!artifactKeys.isEmpty()) { + getLog().warn("[MAVEN-CORE-IT-LOG] These artifacts were not found " + artifactKeys); } } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/src/main/java/org/apache/maven/plugin/coreit/ResolveOneDependencyMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/src/main/java/org/apache/maven/plugin/coreit/ResolveOneDependencyMojo.java index 87f32760ef..7f8ce248ad 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/src/main/java/org/apache/maven/plugin/coreit/ResolveOneDependencyMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/src/main/java/org/apache/maven/plugin/coreit/ResolveOneDependencyMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,11 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; +import java.util.HashSet; +import java.util.Set; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.factory.ArtifactFactory; @@ -35,42 +38,36 @@ import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.plugins.annotations.ResolutionScope; import org.apache.maven.project.MavenProject; -import java.io.File; -import java.util.HashSet; -import java.util.Set; - /** * Attempts to resolve a single artifact from dependencies, and logs the results for the Verifier to look at. * * @author bimargulies */ -@Mojo( name = "resolve-one-dependency", requiresDependencyResolution = ResolutionScope.RUNTIME ) -public class ResolveOneDependencyMojo - extends AbstractDependencyMojo -{ +@Mojo(name = "resolve-one-dependency", requiresDependencyResolution = ResolutionScope.RUNTIME) +public class ResolveOneDependencyMojo extends AbstractDependencyMojo { /** * Group ID of the artifact to resolve. */ - @Parameter( required = true ) + @Parameter(required = true) private String groupId; /** * Artifact ID of the artifact to resolve. */ - @Parameter( required = true ) + @Parameter(required = true) private String artifactId; /** * Version of the artifact to resolve. */ - @Parameter( required = true ) + @Parameter(required = true) private String version; /** * Type of the artifact to resolve. */ - @Parameter( required = true ) + @Parameter(required = true) private String type; /** @@ -82,12 +79,12 @@ public class ResolveOneDependencyMojo /** * The scope to resolve for. */ - @Parameter( required = true ) + @Parameter(required = true) private String scope; /** */ - @Parameter( defaultValue = "${project}", required = true ) + @Parameter(defaultValue = "${project}", required = true) MavenProject project; /** @@ -103,7 +100,7 @@ public class ResolveOneDependencyMojo /** * The Maven session. */ - @Parameter( defaultValue = "${session}", required = true, readonly = true ) + @Parameter(defaultValue = "${session}", required = true, readonly = true) private MavenSession session; /** @@ -117,69 +114,57 @@ public class ResolveOneDependencyMojo * * @throws MojoExecutionException If the output file could not be created or any dependency could not be resolved. */ - public void execute() - throws MojoExecutionException - { + public void execute() throws MojoExecutionException { Artifact projectArtifact = project.getArtifact(); - if ( projectArtifact == null ) - { - projectArtifact = artifactFactory.createProjectArtifact( project.getGroupId(), project.getArtifactId(), - project.getVersion() ); + if (projectArtifact == null) { + projectArtifact = artifactFactory.createProjectArtifact( + project.getGroupId(), project.getArtifactId(), project.getVersion()); } Set depArtifacts = new HashSet(); Artifact artifact = - artifactFactory.createArtifactWithClassifier( groupId, artifactId, version, type, classifier ); - depArtifacts.add( artifact ); + artifactFactory.createArtifactWithClassifier(groupId, artifactId, version, type, classifier); + depArtifacts.add(artifact); - ScopeArtifactFilter scopeFilter = new ScopeArtifactFilter( scope ); + ScopeArtifactFilter scopeFilter = new ScopeArtifactFilter(scope); ArtifactResolutionResult result; - try - { - result = resolver.resolveTransitively( depArtifacts, projectArtifact, project.getManagedVersionMap(), - session.getLocalRepository(), - project.getRemoteArtifactRepositories(), metadataSource, - scopeFilter ); - } - catch ( ArtifactResolutionException e ) - { - throw new MojoExecutionException( "RESOLVE-ONE-DEPENDENCY ArtifactResolutionException exception ", e ); - } - catch ( ArtifactNotFoundException e ) - { - throw new MojoExecutionException( "RESOLVE-ONE-DEPENDENCY ArtifactNotFoundException exception ", e ); + try { + result = resolver.resolveTransitively( + depArtifacts, + projectArtifact, + project.getManagedVersionMap(), + session.getLocalRepository(), + project.getRemoteArtifactRepositories(), + metadataSource, + scopeFilter); + } catch (ArtifactResolutionException e) { + throw new MojoExecutionException("RESOLVE-ONE-DEPENDENCY ArtifactResolutionException exception ", e); + } catch (ArtifactNotFoundException e) { + throw new MojoExecutionException("RESOLVE-ONE-DEPENDENCY ArtifactNotFoundException exception ", e); } - if ( result == null ) - { - getLog().info( "RESOLVE-ONE-DEPENDENCY null result" ); - } - else - { + if (result == null) { + getLog().info("RESOLVE-ONE-DEPENDENCY null result"); + } else { Set resolvedArtifacts = result.getArtifacts(); /* * Assume that the user of this is not interested in transitive deps and such, just report the one. */ - for ( Object resolvedArtifact : resolvedArtifacts ) - { + for (Object resolvedArtifact : resolvedArtifacts) { Artifact a = (Artifact) resolvedArtifact; - if ( a.equals( artifact ) ) - { + if (a.equals(artifact)) { File file = a.getFile(); - if ( file == null ) - { - getLog().info( " RESOLVE-ONE-DEPENDENCY " + a.toString() + " $ NO-FILE" ); - } - else - { - getLog().info( " RESOLVE-ONE-DEPENDENCY " + a.toString() + " $ " + file.getAbsolutePath() ); + if (file == null) { + getLog().info(" RESOLVE-ONE-DEPENDENCY " + a.toString() + " $ NO-FILE"); + } else { + getLog().info(" RESOLVE-ONE-DEPENDENCY " + a.toString() + " $ " + file.getAbsolutePath()); } return; } } - getLog().info( " RESOLVE-ONE-DEPENDENCY " + artifact.toString() + " $ NOT-RESOLVED" ); + getLog().info(" RESOLVE-ONE-DEPENDENCY " + artifact.toString() + " $ NOT-RESOLVED"); } } } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/src/main/java/org/apache/maven/plugin/coreit/RuntimeMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/src/main/java/org/apache/maven/plugin/coreit/RuntimeMojo.java index f4ee93087c..19b0d22f57 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/src/main/java/org/apache/maven/plugin/coreit/RuntimeMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/src/main/java/org/apache/maven/plugin/coreit/RuntimeMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; import org.apache.maven.artifact.DependencyResolutionRequiredException; import org.apache.maven.plugin.MojoExecutionException; @@ -33,10 +32,8 @@ import org.apache.maven.plugins.annotations.ResolutionScope; * @author Benjamin Bentmann * */ -@Mojo( name = "runtime", requiresDependencyResolution = ResolutionScope.RUNTIME ) -public class RuntimeMojo - extends AbstractDependencyMojo -{ +@Mojo(name = "runtime", requiresDependencyResolution = ResolutionScope.RUNTIME) +public class RuntimeMojo extends AbstractDependencyMojo { /** * The path to the output file for the project artifacts, relative to the project base directory. Each line of this @@ -44,7 +41,7 @@ public class RuntimeMojo * disk. Unlike the runtime artifacts, the collection of project artifacts additionally contains those artifacts * that do not contribute to the class path. */ - @Parameter( property = "depres.projectArtifacts" ) + @Parameter(property = "depres.projectArtifacts") private String projectArtifacts; /** @@ -52,7 +49,7 @@ public class RuntimeMojo * UTF-8 encoded file specifies an artifact identifier. If not specified, the artifact list will not be written to * disk. */ - @Parameter( property = "depres.runtimeArtifacts" ) + @Parameter(property = "depres.runtimeArtifacts") private String runtimeArtifacts; /** @@ -60,7 +57,7 @@ public class RuntimeMojo * this UTF-8 encoded file specifies the absolute path to a class path element. If not specified, the class path * will not be written to disk. */ - @Parameter( property = "depres.runtimeClassPath" ) + @Parameter(property = "depres.runtimeClassPath") private String runtimeClassPath; /** @@ -68,7 +65,7 @@ public class RuntimeMojo * base directory. The (trimmed) path to a JAR is used as the property key, the property value is the SHA-1 hash of * the JAR. If not specified, the class path checksums will not be calculated. */ - @Parameter( property = "depres.runtimeClassPathChecksums" ) + @Parameter(property = "depres.runtimeClassPathChecksums") private String runtimeClassPathChecksums; /** @@ -76,20 +73,14 @@ public class RuntimeMojo * * @throws MojoExecutionException If the output file could not be created or any dependency could not be resolved. */ - public void execute() - throws MojoExecutionException - { - try - { - writeArtifacts( projectArtifacts, project.getArtifacts() ); - writeArtifacts( runtimeArtifacts, project.getRuntimeArtifacts() ); - writeClassPath( runtimeClassPath, project.getRuntimeClasspathElements() ); - writeClassPathChecksums( runtimeClassPathChecksums, project.getRuntimeClasspathElements() ); - } - catch ( DependencyResolutionRequiredException e ) - { - throw new MojoExecutionException( "Failed to resolve dependencies", e ); + public void execute() throws MojoExecutionException { + try { + writeArtifacts(projectArtifacts, project.getArtifacts()); + writeArtifacts(runtimeArtifacts, project.getRuntimeArtifacts()); + writeClassPath(runtimeClassPath, project.getRuntimeClasspathElements()); + writeClassPathChecksums(runtimeClassPathChecksums, project.getRuntimeClasspathElements()); + } catch (DependencyResolutionRequiredException e) { + throw new MojoExecutionException("Failed to resolve dependencies", e); } } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/src/main/java/org/apache/maven/plugin/coreit/TestMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/src/main/java/org/apache/maven/plugin/coreit/TestMojo.java index 60ba7b98f9..a9a453085a 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/src/main/java/org/apache/maven/plugin/coreit/TestMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/src/main/java/org/apache/maven/plugin/coreit/TestMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; import org.apache.maven.artifact.DependencyResolutionRequiredException; import org.apache.maven.plugin.MojoExecutionException; @@ -33,10 +32,8 @@ import org.apache.maven.plugins.annotations.ResolutionScope; * @author Benjamin Bentmann * */ -@Mojo( name = "test", requiresDependencyResolution = ResolutionScope.TEST ) -public class TestMojo - extends AbstractDependencyMojo -{ +@Mojo(name = "test", requiresDependencyResolution = ResolutionScope.TEST) +public class TestMojo extends AbstractDependencyMojo { /** * The path to the output file for the project artifacts, relative to the project base directory. Each line of this @@ -44,7 +41,7 @@ public class TestMojo * disk. Unlike the test artifacts, the collection of project artifacts additionally contains those artifacts that * do not contribute to the class path. */ - @Parameter( property = "depres.projectArtifacts" ) + @Parameter(property = "depres.projectArtifacts") private String projectArtifacts; /** @@ -53,7 +50,7 @@ public class TestMojo * written to disk. Unlike the test artifacts, the collection of direct project artifacts additionally contains * those artifacts that do not contribute to the class path. */ - @Parameter( property = "depres.dependencyArtifacts" ) + @Parameter(property = "depres.dependencyArtifacts") private String dependencyArtifacts; /** @@ -61,7 +58,7 @@ public class TestMojo * UTF-8 encoded file specifies an artifact identifier. If not specified, the artifact list will not be written to * disk. */ - @Parameter( property = "depres.testArtifacts" ) + @Parameter(property = "depres.testArtifacts") private String testArtifacts; /** @@ -69,7 +66,7 @@ public class TestMojo * this UTF-8 encoded file specifies the absolute path to a class path element. If not specified, the class path * will not be written to disk. */ - @Parameter( property = "depres.testClassPath" ) + @Parameter(property = "depres.testClassPath") private String testClassPath; /** @@ -77,7 +74,7 @@ public class TestMojo * directory. The (trimmed) path to a JAR is used as the property key, the property value is the SHA-1 hash of the * JAR. If not specified, the class path checksums will not be calculated. */ - @Parameter( property = "depres.testClassPathChecksums" ) + @Parameter(property = "depres.testClassPathChecksums") private String testClassPathChecksums; /** @@ -85,21 +82,15 @@ public class TestMojo * * @throws MojoExecutionException If the output file could not be created or any dependency could not be resolved. */ - public void execute() - throws MojoExecutionException - { - try - { - writeArtifacts( projectArtifacts, project.getArtifacts() ); - writeArtifacts( dependencyArtifacts, project.getDependencyArtifacts() ); - writeArtifacts( testArtifacts, project.getTestArtifacts() ); - writeClassPath( testClassPath, project.getTestClasspathElements() ); - writeClassPathChecksums( testClassPathChecksums, project.getTestClasspathElements() ); - } - catch ( DependencyResolutionRequiredException e ) - { - throw new MojoExecutionException( "Failed to resolve dependencies", e ); + public void execute() throws MojoExecutionException { + try { + writeArtifacts(projectArtifacts, project.getArtifacts()); + writeArtifacts(dependencyArtifacts, project.getDependencyArtifacts()); + writeArtifacts(testArtifacts, project.getTestArtifacts()); + writeClassPath(testClassPath, project.getTestClasspathElements()); + writeClassPathChecksums(testClassPathChecksums, project.getTestClasspathElements()); + } catch (DependencyResolutionRequiredException e) { + throw new MojoExecutionException("Failed to resolve dependencies", e); } } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-error/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-error/pom.xml index 7928ff40d3..b7724f224f 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-error/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-error/pom.xml @@ -1,5 +1,4 @@ - - - + 4.0.0 - maven-it-plugins org.apache.maven.its.plugins + maven-it-plugins 2.1-SNAPSHOT @@ -32,10 +30,8 @@ under the License. maven-plugin Maven IT Plugin :: Error Mojos - - A test plugin that throws various sorts of errors when loaded or executed. This plugin is designed to test Maven's ability - to repackage runtime exceptions and other similar errors in a way that helps the user. - + A test plugin that throws various sorts of errors when loaded or executed. This plugin is designed to test Maven's ability + to repackage runtime exceptions and other similar errors in a way that helps the user. 2009 diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/MojoComponentLookupExceptionMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/MojoComponentLookupExceptionMojo.java index 6b23f0e504..5bab82fc9c 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/MojoComponentLookupExceptionMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/MojoComponentLookupExceptionMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; @@ -26,14 +25,8 @@ import org.apache.maven.plugins.annotations.Mojo; /** */ -@Mojo( name = "mojo-component-lookup-exception", requiresProject = false ) -public class MojoComponentLookupExceptionMojo - extends AbstractMojo -{ - - public void execute() - throws MojoExecutionException, MojoFailureException - { - } +@Mojo(name = "mojo-component-lookup-exception", requiresProject = false) +public class MojoComponentLookupExceptionMojo extends AbstractMojo { + public void execute() throws MojoExecutionException, MojoFailureException {} } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/MojoExecutionExceptionMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/MojoExecutionExceptionMojo.java index abb9e257a9..6292c53bb7 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/MojoExecutionExceptionMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/MojoExecutionExceptionMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; @@ -26,16 +25,12 @@ import org.apache.maven.plugins.annotations.Parameter; /** */ -@Mojo( name = "mojo-execution-exception", requiresProject = false ) -public class MojoExecutionExceptionMojo - extends AbstractMojo -{ - @Parameter( property = "error.message", defaultValue = "Planned MojoExecutionException.", required = true ) +@Mojo(name = "mojo-execution-exception", requiresProject = false) +public class MojoExecutionExceptionMojo extends AbstractMojo { + @Parameter(property = "error.message", defaultValue = "Planned MojoExecutionException.", required = true) private String message; - public void execute() - throws MojoExecutionException - { - throw new MojoExecutionException( message ); + public void execute() throws MojoExecutionException { + throw new MojoExecutionException(message); } } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/MojoFailureExceptionMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/MojoFailureExceptionMojo.java index b86a8308d1..c6149bf520 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/MojoFailureExceptionMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/MojoFailureExceptionMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoFailureException; @@ -26,39 +25,32 @@ import org.apache.maven.plugins.annotations.Parameter; /** */ -@Mojo( name = "mojo-failure-exception", requiresProject = false ) -public class MojoFailureExceptionMojo - extends AbstractMojo -{ +@Mojo(name = "mojo-failure-exception", requiresProject = false) +public class MojoFailureExceptionMojo extends AbstractMojo { /** * Message used in {@link MojoFailureException#MojoFailureException(String)}, unless longMessage * is supplied; then, this becomes the short message in * {@link MojoFailureException#MojoFailureException(Object, String, String)}. */ - @Parameter( property = "error.message", defaultValue = "Planned MojoExecutionException.", required = true ) + @Parameter(property = "error.message", defaultValue = "Planned MojoExecutionException.", required = true) private String message; /** * If supplied, The form {@link MojoFailureException#MojoFailureException(Object, String, String)} will be used. */ - @Parameter( property = "error.longMessage", required = true ) + @Parameter(property = "error.longMessage", required = true) private String longMessage; /** */ - @Parameter( property = "error.source" ) + @Parameter(property = "error.source") private String source; - public void execute() - throws MojoFailureException - { - if ( longMessage != null ) - { - throw new MojoFailureException( source, message, longMessage ); - } - else - { - throw new MojoFailureException( message ); + public void execute() throws MojoFailureException { + if (longMessage != null) { + throw new MojoFailureException(source, message, longMessage); + } else { + throw new MojoFailureException(message); } } } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/NoClassDefFoundErrorComponentMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/NoClassDefFoundErrorComponentMojo.java index cc0b4610cd..a3af50790d 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/NoClassDefFoundErrorComponentMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/NoClassDefFoundErrorComponentMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,12 +16,12 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; import junit.framework.TestCase; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; - import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; @@ -31,20 +29,15 @@ import org.apache.maven.plugins.annotations.Parameter; * Takes a parameter with a class from a provided-scope dependency, so that the mojo class itself won't be * loadable when that dependency is missing (in the runtime environment). */ -@Mojo( name = "no-class-def-found-error-param", requiresProject = false ) -public class NoClassDefFoundErrorComponentMojo - extends AbstractMojo -{ +@Mojo(name = "no-class-def-found-error-param", requiresProject = false) +public class NoClassDefFoundErrorComponentMojo extends AbstractMojo { /** */ - @Parameter( defaultValue = "foo" ) + @Parameter(defaultValue = "foo") private TestCase value; - public void execute() - throws MojoExecutionException, MojoFailureException - { + public void execute() throws MojoExecutionException, MojoFailureException { value.getName(); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/NoClassDefFoundErrorInterfaceMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/NoClassDefFoundErrorInterfaceMojo.java index 08f9254112..ebf331d021 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/NoClassDefFoundErrorInterfaceMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/NoClassDefFoundErrorInterfaceMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,39 +16,30 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; import junit.framework.TestCase; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugin.logging.Log; - import org.apache.maven.plugins.annotations.Mojo; /** * Implements a class from a provided-scope dependency, so that the mojo class itself won't be * loadable when that dependency is missing (in the runtime environment). */ -@Mojo( name = "no-class-def-found-error-mojo", requiresProject = false ) -public class NoClassDefFoundErrorInterfaceMojo - extends TestCase - implements org.apache.maven.plugin.Mojo -{ +@Mojo(name = "no-class-def-found-error-mojo", requiresProject = false) +public class NoClassDefFoundErrorInterfaceMojo extends TestCase implements org.apache.maven.plugin.Mojo { private Log log; - public void execute() - throws MojoExecutionException, MojoFailureException - { - } + public void execute() throws MojoExecutionException, MojoFailureException {} - public Log getLog() - { + public Log getLog() { return log; } - public void setLog( Log log ) - { + public void setLog(Log log) { this.log = log; } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/RequirementComponentLookupExceptionMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/RequirementComponentLookupExceptionMojo.java index bcc73d5a7f..b5e7408ce8 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/RequirementComponentLookupExceptionMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/RequirementComponentLookupExceptionMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; import junit.framework.TestCase; import org.apache.maven.plugin.AbstractMojo; @@ -28,20 +27,15 @@ import org.apache.maven.plugins.annotations.Mojo; /** */ -@Mojo( name = "requirement-component-lookup-exception", requiresProject = false ) -public class RequirementComponentLookupExceptionMojo - extends AbstractMojo -{ +@Mojo(name = "requirement-component-lookup-exception", requiresProject = false) +public class RequirementComponentLookupExceptionMojo extends AbstractMojo { /** */ - @Component( role = TestCase.class, hint = "triggers-error" ) + @Component(role = TestCase.class, hint = "triggers-error") private org.apache.maven.plugin.Mojo dependency; - public void execute() - throws MojoExecutionException, MojoFailureException - { + public void execute() throws MojoExecutionException, MojoFailureException { dependency.execute(); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-expression/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-expression/pom.xml index 5776889650..01948ed89a 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-expression/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-expression/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 - maven-it-plugins org.apache.maven.its.plugins + maven-it-plugins 2.1-SNAPSHOT @@ -32,10 +30,8 @@ under the License. maven-plugin Maven IT Plugin :: Expression - - A test plugin that creates a properties file with the effective values of some user-defined expressions. As such it - allows to analyze the runtime state of the POM similar to the Help Plugin. - + A test plugin that creates a properties file with the effective values of some user-defined expressions. As such it + allows to analyze the runtime state of the POM similar to the Help Plugin. 2008 diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-expression/src/main/java/org/apache/maven/plugin/coreit/EvalMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-expression/src/main/java/org/apache/maven/plugin/coreit/EvalMojo.java index 88b9f165a4..8cee8ad006 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-expression/src/main/java/org/apache/maven/plugin/coreit/EvalMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-expression/src/main/java/org/apache/maven/plugin/coreit/EvalMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,13 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; @@ -26,12 +31,6 @@ import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; -import java.io.File; -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.Properties; - /** * Creates a properties file with the effective values of some user-defined expressions. Unlike Maven's built-in * expression syntax for interpolation, these expressions use forward slashes to navigate down the object graph and @@ -58,16 +57,14 @@ import java.util.Properties; * * @author Benjamin Bentmann * - */ -@Mojo( name = "eval", defaultPhase = LifecyclePhase.INITIALIZE ) -public class EvalMojo - extends AbstractMojo -{ + */ +@Mojo(name = "eval", defaultPhase = LifecyclePhase.INITIALIZE) +public class EvalMojo extends AbstractMojo { /** * The project's base directory, used for manual path translation. */ - @Parameter( defaultValue = "${basedir", readonly = true ) + @Parameter(defaultValue = "${basedir", readonly = true) private File basedir; /** @@ -75,7 +72,7 @@ public class EvalMojo * parameter {@link #expressions}, a similar named properties key will be used to save the expression value. If an * expression evaluated to null, there will be no corresponding key in the properties file. */ - @Parameter( property = "expression.outputFile" ) + @Parameter(property = "expression.outputFile") private File outputFile; /** @@ -87,37 +84,37 @@ public class EvalMojo /** * The comma separated set of expressions to evaluate. */ - @Parameter( property = "expression.expressions" ) + @Parameter(property = "expression.expressions") private String expressionList; /** * The current Maven project against which expressions are evaluated. */ - @Parameter( defaultValue = "${project}", readonly = true ) + @Parameter(defaultValue = "${project}", readonly = true) private Object project; /** * The forked Maven project against which expressions are evaluated. */ - @Parameter( defaultValue = "${executedProject}", readonly = true ) + @Parameter(defaultValue = "${executedProject}", readonly = true) private Object executedProject; /** * The merged user/global settings of the current build against which expressions are evaluated. */ - @Parameter( defaultValue = "${settings}", readonly = true ) + @Parameter(defaultValue = "${settings}", readonly = true) private Object settings; /** * The session context of the current build against which expressions are evaluated. */ - @Parameter( defaultValue = "${session}", readonly = true ) + @Parameter(defaultValue = "${session}", readonly = true) private Object session; /** * The local repository of the current build against which expressions are evaluated. */ - @Parameter( defaultValue = "${session.request.localRepositoryPath}", readonly = true ) + @Parameter(defaultValue = "${session.request.localRepositoryPath}", readonly = true) private Object localRepositoryBasedir; /** @@ -126,66 +123,53 @@ public class EvalMojo * @throws MojoExecutionException If the output file could not be created. * @throws MojoFailureException If the output file has not been set. */ - public void execute() - throws MojoExecutionException, MojoFailureException - { - if ( outputFile == null ) - { - throw new MojoFailureException( "Path name for output file has not been specified" ); + public void execute() throws MojoExecutionException, MojoFailureException { + if (outputFile == null) { + throw new MojoFailureException("Path name for output file has not been specified"); } /* * NOTE: We don't want to test path translation here. */ - if ( !outputFile.isAbsolute() ) - { - outputFile = new File( basedir, outputFile.getPath() ).getAbsoluteFile(); + if (!outputFile.isAbsolute()) { + outputFile = new File(basedir, outputFile.getPath()).getAbsoluteFile(); } - getLog().info( "[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile); Properties expressionProperties = new Properties(); - if ( expressionList != null && expressionList.length() > 0 ) - { - expressions = expressionList.split( "," ); + if (expressionList != null && expressionList.length() > 0) { + expressions = expressionList.split(","); } - if ( expressions != null && expressions.length > 0 ) - { + if (expressions != null && expressions.length > 0) { Map contexts = new HashMap(); - contexts.put( "project", project ); - contexts.put( "executedProject", executedProject ); - contexts.put( "pom", project ); - contexts.put( "settings", settings ); - contexts.put( "session", session ); - contexts.put( "localRepositoryBasedir", localRepositoryBasedir ); + contexts.put("project", project); + contexts.put("executedProject", executedProject); + contexts.put("pom", project); + contexts.put("settings", settings); + contexts.put("session", session); + contexts.put("localRepositoryBasedir", localRepositoryBasedir); - for ( String expression : expressions ) - { - Map values = ExpressionUtil.evaluate( expression, contexts ); - for ( Object key : values.keySet() ) - { - Object value = values.get( key ); - PropertyUtil.store( expressionProperties, key.toString().replace( '/', '.' ), value ); + for (String expression : expressions) { + Map values = ExpressionUtil.evaluate(expression, contexts); + for (Object key : values.keySet()) { + Object value = values.get(key); + PropertyUtil.store(expressionProperties, key.toString().replace('/', '.'), value); } } } - try - { - PropertyUtil.write( expressionProperties, outputFile ); - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Output file could not be created: " + outputFile, e ); + try { + PropertyUtil.write(expressionProperties, outputFile); + } catch (IOException e) { + throw new MojoExecutionException("Output file could not be created: " + outputFile, e); } - getLog().info( "[MAVEN-CORE-IT-LOG] Created output file: " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Created output file: " + outputFile); } - public void setOutputFile( File outputFile ) - { + public void setOutputFile(File outputFile) { this.outputFile = outputFile; } } - diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-expression/src/main/java/org/apache/maven/plugin/coreit/ExpressionUtil.java b/its/core-it-support/core-it-plugins/maven-it-plugin-expression/src/main/java/org/apache/maven/plugin/coreit/ExpressionUtil.java index 6e5738b3bf..6424dc4ffe 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-expression/src/main/java/org/apache/maven/plugin/coreit/ExpressionUtil.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-expression/src/main/java/org/apache/maven/plugin/coreit/ExpressionUtil.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; import java.lang.reflect.Array; import java.lang.reflect.Field; @@ -36,16 +35,15 @@ import java.util.Map; * @author Benjamin Bentmann * */ -class ExpressionUtil -{ +class ExpressionUtil { private static final Object[] NO_ARGS = {}; private static final Class[] NO_PARAMS = {}; - private static final Class[] OBJECT_PARAM = { Object.class }; + private static final Class[] OBJECT_PARAM = {Object.class}; - private static final Class[] STRING_PARAM = { String.class }; + private static final Class[] STRING_PARAM = {String.class}; /** * Evaluates the specified expression. Expressions are composed of segments which are separated by a forward slash @@ -61,14 +59,12 @@ class ExpressionUtil * @return The values of the evaluation, indexed by expression, or an empty map if the segments could not be * evaluated. */ - public static Map evaluate( String expression, Object context ) - { + public static Map evaluate(String expression, Object context) { Map values = Collections.EMPTY_MAP; - if ( expression != null && expression.length() > 0 ) - { - List segments = Arrays.asList( expression.split( "/", 0 ) ); - values = evaluate( "", segments, context ); + if (expression != null && expression.length() > 0) { + List segments = Arrays.asList(expression.split("/", 0)); + values = evaluate("", segments, context); } return values; @@ -83,80 +79,56 @@ class ExpressionUtil * @return The values of the evaluation, indexed by expression, or an empty map if the segments could not be * evaluated. */ - private static Map evaluate( String prefix, List segments, Object context ) - { + private static Map evaluate(String prefix, List segments, Object context) { Map values = Collections.EMPTY_MAP; - if ( segments.isEmpty() ) - { - values = Collections.singletonMap( prefix, context ); - } - else if ( context != null ) - { + if (segments.isEmpty()) { + values = Collections.singletonMap(prefix, context); + } else if (context != null) { Map targets = Collections.EMPTY_MAP; - String segment = (String) segments.get( 0 ); - if ( context.getClass().isArray() && Character.isDigit( segment.charAt( 0 ) ) ) - { - try - { - int index = Integer.parseInt( segment ); - targets = Collections.singletonMap( segment, Array.get( context, index ) ); - } - catch ( RuntimeException e ) - { + String segment = (String) segments.get(0); + if (context.getClass().isArray() && Character.isDigit(segment.charAt(0))) { + try { + int index = Integer.parseInt(segment); + targets = Collections.singletonMap(segment, Array.get(context, index)); + } catch (RuntimeException e) { // invalid index, just ignore } - } - else if ( ( context instanceof List ) && Character.isDigit( segment.charAt( 0 ) ) ) - { - try - { - int index = Integer.parseInt( segment ); - targets = Collections.singletonMap( segment, ( (List) context ).get( index ) ); - } - catch ( RuntimeException e ) - { + } else if ((context instanceof List) && Character.isDigit(segment.charAt(0))) { + try { + int index = Integer.parseInt(segment); + targets = Collections.singletonMap(segment, ((List) context).get(index)); + } catch (RuntimeException e) { // invalid index, just ignore } - } - else if ( ( context instanceof Collection ) && "*".equals( segment ) ) - { + } else if ((context instanceof Collection) && "*".equals(segment)) { targets = new LinkedHashMap(); int index = 0; - for ( Iterator it = ( (Collection) context ).iterator(); it.hasNext(); index++ ) - { - targets.put( Integer.toString( index ), it.next() ); + for (Iterator it = ((Collection) context).iterator(); it.hasNext(); index++) { + targets.put(Integer.toString(index), it.next()); } - } - else if ( context.getClass().isArray() && "*".equals( segment ) ) - { + } else if (context.getClass().isArray() && "*".equals(segment)) { targets = new LinkedHashMap(); - for ( int index = 0, n = Array.getLength( context ); index < n; index++ ) - { - targets.put( Integer.toString( index ), Array.get( context, index ) ); + for (int index = 0, n = Array.getLength(context); index < n; index++) { + targets.put(Integer.toString(index), Array.get(context, index)); } - } - else - { - targets = Collections.singletonMap( segment, getProperty( context, segment ) ); + } else { + targets = Collections.singletonMap(segment, getProperty(context, segment)); } values = new LinkedHashMap(); - for ( Object key : targets.keySet() ) - { - Object target = targets.get( key ); + for (Object key : targets.keySet()) { + Object target = targets.get(key); values.putAll( - evaluate( concat( prefix, String.valueOf( key ) ), segments.subList( 1, segments.size() ), - target ) ); + evaluate(concat(prefix, String.valueOf(key)), segments.subList(1, segments.size()), target)); } } return values; } - private static String concat( String prefix, String segment ) - { - return ( prefix == null || prefix.length() <= 0 ) ? segment : ( prefix + '/' + segment ); + private static String concat(String prefix, String segment) { + return (prefix == null || prefix.length() <= 0) ? segment : (prefix + '/' + segment); } /** @@ -166,78 +138,52 @@ class ExpressionUtil * @param property The name of the bean property, must not be null. * @return The value of the bean property or null if the property does not exist. */ - static Object getProperty( Object context, String property ) - { + static Object getProperty(Object context, String property) { Object value; Class type = context.getClass(); - if ( context instanceof Collection ) - { + if (context instanceof Collection) { type = Collection.class; - } - else if ( context instanceof Map ) - { + } else if (context instanceof Map) { type = Map.class; } - try - { - try - { - Method method = type.getMethod( property, NO_PARAMS ); - method.setAccessible( true ); - value = method.invoke( context, NO_ARGS ); - } - catch ( NoSuchMethodException e ) - { - try - { - String name = "get" + Character.toUpperCase( property.charAt( 0 ) ) + property.substring( 1 ); - Method method = type.getMethod( name, NO_PARAMS ); - method.setAccessible( true ); - value = method.invoke( context, NO_ARGS ); - } - catch ( NoSuchMethodException e1 ) - { - try - { - String name = "is" + Character.toUpperCase( property.charAt( 0 ) ) + property.substring( 1 ); - Method method = type.getMethod( name, NO_PARAMS ); - method.setAccessible( true ); - value = method.invoke( context, NO_ARGS ); - } - catch ( NoSuchMethodException e2 ) - { - try - { + try { + try { + Method method = type.getMethod(property, NO_PARAMS); + method.setAccessible(true); + value = method.invoke(context, NO_ARGS); + } catch (NoSuchMethodException e) { + try { + String name = "get" + Character.toUpperCase(property.charAt(0)) + property.substring(1); + Method method = type.getMethod(name, NO_PARAMS); + method.setAccessible(true); + value = method.invoke(context, NO_ARGS); + } catch (NoSuchMethodException e1) { + try { + String name = "is" + Character.toUpperCase(property.charAt(0)) + property.substring(1); + Method method = type.getMethod(name, NO_PARAMS); + method.setAccessible(true); + value = method.invoke(context, NO_ARGS); + } catch (NoSuchMethodException e2) { + try { Method method; - try - { - method = type.getMethod( "get", STRING_PARAM ); + try { + method = type.getMethod("get", STRING_PARAM); + } catch (NoSuchMethodException e3) { + method = type.getMethod("get", OBJECT_PARAM); } - catch ( NoSuchMethodException e3 ) - { - method = type.getMethod( "get", OBJECT_PARAM ); - } - method.setAccessible( true ); - value = method.invoke( context, new Object[]{ property } ); - } - catch ( NoSuchMethodException e3 ) - { - try - { - Field field = type.getField( property ); - field.setAccessible( true ); - value = field.get( context ); - } - catch ( NoSuchFieldException e4 ) - { - if ( "length".equals( property ) && type.isArray() ) - { - value = Array.getLength( context ); - } - else - { + method.setAccessible(true); + value = method.invoke(context, new Object[] {property}); + } catch (NoSuchMethodException e3) { + try { + Field field = type.getField(property); + field.setAccessible(true); + value = field.get(context); + } catch (NoSuchFieldException e4) { + if ("length".equals(property) && type.isArray()) { + value = Array.getLength(context); + } else { throw e4; } } @@ -245,12 +191,9 @@ class ExpressionUtil } } } - } - catch ( Exception e ) - { + } catch (Exception e) { value = null; } return value; } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-expression/src/main/java/org/apache/maven/plugin/coreit/PropertyUtil.java b/its/core-it-support/core-it-plugins/maven-it-plugin-expression/src/main/java/org/apache/maven/plugin/coreit/PropertyUtil.java index 6e4f932685..7e907b047f 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-expression/src/main/java/org/apache/maven/plugin/coreit/PropertyUtil.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-expression/src/main/java/org/apache/maven/plugin/coreit/PropertyUtil.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; import java.io.File; import java.io.FileOutputStream; @@ -40,8 +39,7 @@ import java.util.Properties; * @author Benjamin Bentmann * */ -class PropertyUtil -{ +class PropertyUtil { private static final Object[] NO_ARGS = {}; @@ -55,9 +53,8 @@ class PropertyUtil * @param key The key to use for serialization of the object data, must not be null. * @param obj The object to serialize, may be null. */ - public static void store( Properties props, String key, Object obj ) - { - store( props, key, obj, new HashSet() ); + public static void store(Properties props, String key, Object obj) { + store(props, key, obj, new HashSet()); } /** @@ -70,115 +67,93 @@ class PropertyUtil * @param visited The set/stack of already visited objects, used to detect back references in the object graph, must * not be null. */ - private static void store( Properties props, String key, Object obj, Collection visited ) - { - if ( obj != null && !visited.contains( obj ) ) - { - visited.add( obj ); - if ( ( obj instanceof String ) || ( obj instanceof Number ) || ( obj instanceof Boolean ) - || ( obj instanceof File ) || ( obj instanceof Path ) ) - { - props.put( key, obj.toString() ); - } - else if ( obj instanceof Collection ) - { + private static void store(Properties props, String key, Object obj, Collection visited) { + if (obj != null && !visited.contains(obj)) { + visited.add(obj); + if ((obj instanceof String) + || (obj instanceof Number) + || (obj instanceof Boolean) + || (obj instanceof File) + || (obj instanceof Path)) { + props.put(key, obj.toString()); + } else if (obj instanceof Collection) { Collection coll = (Collection) obj; - props.put( key, Integer.toString( coll.size() ) ); + props.put(key, Integer.toString(coll.size())); int index = 0; - for ( Iterator it = coll.iterator(); it.hasNext(); index++ ) - { + for (Iterator it = coll.iterator(); it.hasNext(); index++) { Object elem = it.next(); - store( props, key + "." + index, elem, visited ); + store(props, key + "." + index, elem, visited); } - } - else if ( obj instanceof Map ) - { + } else if (obj instanceof Map) { Map map = (Map) obj; - props.put( key, Integer.toString( map.size() ) ); + props.put(key, Integer.toString(map.size())); int index = 0; - for ( Iterator it = map.entrySet().iterator(); it.hasNext(); index++ ) - { + for (Iterator it = map.entrySet().iterator(); it.hasNext(); index++) { Map.Entry entry = (Map.Entry) it.next(); - store( props, key + "." + entry.getKey(), entry.getValue(), visited ); + store(props, key + "." + entry.getKey(), entry.getValue(), visited); } - } - else if ( obj.getClass().isArray() ) - { - int length = Array.getLength( obj ); - props.put( key, Integer.toString( length ) ); - for ( int index = 0; index < length; index++ ) - { - Object elem = Array.get( obj, index ); - store( props, key + "." + index, elem, visited ); + } else if (obj.getClass().isArray()) { + int length = Array.getLength(obj); + props.put(key, Integer.toString(length)); + for (int index = 0; index < length; index++) { + Object elem = Array.get(obj, index); + store(props, key + "." + index, elem, visited); } - } - else if ( obj.getClass().getName().endsWith( "Xpp3Dom" ) ) - { + } else if (obj.getClass().getName().endsWith("Xpp3Dom")) { Class type = obj.getClass(); - try - { - Method getValue = type.getMethod( "getValue", NO_PARAMS ); - String value = (String) getValue.invoke( obj, NO_ARGS ); + try { + Method getValue = type.getMethod("getValue", NO_PARAMS); + String value = (String) getValue.invoke(obj, NO_ARGS); - if ( value != null ) - { - props.put( key + ".value", value ); + if (value != null) { + props.put(key + ".value", value); } - Method getName = type.getMethod( "getName", NO_PARAMS ); + Method getName = type.getMethod("getName", NO_PARAMS); - Method getChildren = type.getMethod( "getChildren", NO_PARAMS ); - Object[] children = (Object[]) getChildren.invoke( obj, NO_ARGS ); + Method getChildren = type.getMethod("getChildren", NO_PARAMS); + Object[] children = (Object[]) getChildren.invoke(obj, NO_ARGS); - props.put( key + ".children", Integer.toString( children.length ) ); + props.put(key + ".children", Integer.toString(children.length)); Map indices = new HashMap(); - for ( Object child : children ) - { - String name = (String) getName.invoke( child, NO_ARGS ); + for (Object child : children) { + String name = (String) getName.invoke(child, NO_ARGS); - Integer index = (Integer) indices.get( name ); - if ( index == null ) - { + Integer index = (Integer) indices.get(name); + if (index == null) { index = 0; } - store( props, key + ".children." + name + "." + index, child, visited ); + store(props, key + ".children." + name + "." + index, child, visited); - indices.put( name, index + 1 ); + indices.put(name, index + 1); } - } - catch ( Exception e ) - { + } catch (Exception e) { // can't happen } - } - else - { + } else { Class type = obj.getClass(); Method[] methods = type.getMethods(); - for ( Method method : methods ) - { - if ( Modifier.isStatic( method.getModifiers() ) || method.getParameterTypes().length > 0 - || !method.getName().matches( "(get|is)\\p{Lu}.*" ) || method.getName().endsWith( "AsMap" ) - || Class.class.isAssignableFrom( method.getReturnType() ) || Object.class.equals( - method.getReturnType() ) ) - { + for (Method method : methods) { + if (Modifier.isStatic(method.getModifiers()) + || method.getParameterTypes().length > 0 + || !method.getName().matches("(get|is)\\p{Lu}.*") + || method.getName().endsWith("AsMap") + || Class.class.isAssignableFrom(method.getReturnType()) + || Object.class.equals(method.getReturnType())) { continue; } - try - { - Object value = method.invoke( obj, NO_ARGS ); - store( props, key + "." + getPropertyName( method.getName() ), value, visited ); - } - catch ( Exception e ) - { + try { + Object value = method.invoke(obj, NO_ARGS); + store(props, key + "." + getPropertyName(method.getName()), value, visited); + } catch (Exception e) { // just ignore } } } - visited.remove( obj ); + visited.remove(obj); } } @@ -188,16 +163,12 @@ class PropertyUtil * @param methodName The method name of the property's getter, must not be null. * @return The property name, never null. */ - static String getPropertyName( String methodName ) - { + static String getPropertyName(String methodName) { String propertyName = methodName; - if ( methodName.startsWith( "get" ) && methodName.length() > 3 ) - { - propertyName = Character.toLowerCase( methodName.charAt( 3 ) ) + methodName.substring( 4 ); - } - else if ( methodName.startsWith( "is" ) && methodName.length() > 2 ) - { - propertyName = Character.toLowerCase( methodName.charAt( 2 ) ) + methodName.substring( 3 ); + if (methodName.startsWith("get") && methodName.length() > 3) { + propertyName = Character.toLowerCase(methodName.charAt(3)) + methodName.substring(4); + } else if (methodName.startsWith("is") && methodName.length() > 2) { + propertyName = Character.toLowerCase(methodName.charAt(2)) + methodName.substring(3); } return propertyName; } @@ -209,30 +180,20 @@ class PropertyUtil * @param file The output file for the properties, must not be null. * @throws IOException If the properties could not be written to the file. */ - public static void write( Properties props, File file ) - throws IOException - { + public static void write(Properties props, File file) throws IOException { OutputStream out = null; - try - { + try { file.getParentFile().mkdirs(); - out = new FileOutputStream( file ); - props.store( out, "MAVEN-CORE-IT-LOG" ); - } - finally - { - if ( out != null ) - { - try - { + out = new FileOutputStream(file); + props.store(out, "MAVEN-CORE-IT-LOG"); + } finally { + if (out != null) { + try { out.close(); - } - catch ( IOException e ) - { + } catch (IOException e) { // just ignore } } } } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-expression/src/test/java/org/apache/maven/plugin/coreit/ExpressionUtilTest.java b/its/core-it-support/core-it-plugins/maven-it-plugin-expression/src/test/java/org/apache/maven/plugin/coreit/ExpressionUtilTest.java index f30a94a8cf..d320951adf 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-expression/src/test/java/org/apache/maven/plugin/coreit/ExpressionUtilTest.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-expression/src/test/java/org/apache/maven/plugin/coreit/ExpressionUtilTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; import java.util.Arrays; import java.util.Collections; @@ -34,107 +33,97 @@ import static org.junit.jupiter.api.Assertions.assertSame; * @author Benjamin Bentmann * */ -public class ExpressionUtilTest -{ +public class ExpressionUtilTest { @Test - public void testEvaluate() - { - Object array = new String[]{ "one", "two", "three" }; - Object list = Arrays.asList( "0", "-1", "-2" ); - Object map = Collections.singletonMap( "some.key", "value" ); + public void testEvaluate() { + Object array = new String[] {"one", "two", "three"}; + Object list = Arrays.asList("0", "-1", "-2"); + Object map = Collections.singletonMap("some.key", "value"); Object bean = new BeanTwo(); Map contexts = new HashMap<>(); - contexts.put( "array", array ); - contexts.put( "list", list ); - contexts.put( "map", map ); - contexts.put( "bean", bean ); + contexts.put("array", array); + contexts.put("list", list); + contexts.put("map", map); + contexts.put("bean", bean); - assertSame( array, evaluate( "array", contexts ) ); - assertSame( array, ExpressionUtil.evaluate( "array/", contexts ).get( "array" ) ); - assertSame( list, evaluate( "list", contexts ) ); - assertSame( map, evaluate( "map", contexts ) ); - assertSame( bean, evaluate( "bean", contexts ) ); - assertNull( evaluate( "no-root", contexts ) ); + assertSame(array, evaluate("array", contexts)); + assertSame(array, ExpressionUtil.evaluate("array/", contexts).get("array")); + assertSame(list, evaluate("list", contexts)); + assertSame(map, evaluate("map", contexts)); + assertSame(bean, evaluate("bean", contexts)); + assertNull(evaluate("no-root", contexts)); - assertEquals( 3, evaluate( "array/length", contexts ) ); - assertEquals( "three", evaluate( "array/2", contexts ) ); - assertEquals( 5, evaluate( "array/2/length", contexts ) ); - assertNull( evaluate( "array/invalid", contexts ) ); - assertNull( evaluate( "array/-1", contexts ) ); - assertNull( evaluate( "array/999", contexts ) ); - assertEquals( 3, ExpressionUtil.evaluate( "array/*", contexts ).size() ); - assertEquals( "one", ExpressionUtil.evaluate( "array/*", contexts ).get( "array/0" ) ); - assertEquals( "two", ExpressionUtil.evaluate( "array/*", contexts ).get( "array/1" ) ); - assertEquals( "three", ExpressionUtil.evaluate( "array/*", contexts ).get( "array/2" ) ); + assertEquals(3, evaluate("array/length", contexts)); + assertEquals("three", evaluate("array/2", contexts)); + assertEquals(5, evaluate("array/2/length", contexts)); + assertNull(evaluate("array/invalid", contexts)); + assertNull(evaluate("array/-1", contexts)); + assertNull(evaluate("array/999", contexts)); + assertEquals(3, ExpressionUtil.evaluate("array/*", contexts).size()); + assertEquals("one", ExpressionUtil.evaluate("array/*", contexts).get("array/0")); + assertEquals("two", ExpressionUtil.evaluate("array/*", contexts).get("array/1")); + assertEquals("three", ExpressionUtil.evaluate("array/*", contexts).get("array/2")); - assertEquals( 3, evaluate( "list/size", contexts ) ); - assertEquals( "-2", evaluate( "list/2", contexts ) ); - assertNull( evaluate( "list/invalid", contexts ) ); - assertNull( evaluate( "list/-1", contexts ) ); - assertNull( evaluate( "list/999", contexts ) ); - assertEquals( 3, ExpressionUtil.evaluate( "list/*", contexts ).size() ); - assertEquals( "0", ExpressionUtil.evaluate( "list/*", contexts ).get( "list/0" ) ); - assertEquals( "-1", ExpressionUtil.evaluate( "list/*", contexts ).get( "list/1" ) ); - assertEquals( "-2", ExpressionUtil.evaluate( "list/*", contexts ).get( "list/2" ) ); + assertEquals(3, evaluate("list/size", contexts)); + assertEquals("-2", evaluate("list/2", contexts)); + assertNull(evaluate("list/invalid", contexts)); + assertNull(evaluate("list/-1", contexts)); + assertNull(evaluate("list/999", contexts)); + assertEquals(3, ExpressionUtil.evaluate("list/*", contexts).size()); + assertEquals("0", ExpressionUtil.evaluate("list/*", contexts).get("list/0")); + assertEquals("-1", ExpressionUtil.evaluate("list/*", contexts).get("list/1")); + assertEquals("-2", ExpressionUtil.evaluate("list/*", contexts).get("list/2")); - assertEquals( 1, evaluate( "map/size", contexts ) ); - assertEquals( "value", evaluate( "map/some.key", contexts ) ); - assertNull( evaluate( "map/invalid", contexts ) ); + assertEquals(1, evaluate("map/size", contexts)); + assertEquals("value", evaluate("map/some.key", contexts)); + assertNull(evaluate("map/invalid", contexts)); - assertEquals( "field", evaluate( "bean/field", contexts ) ); - assertNull( evaluate( "bean/invalid", contexts ) ); - assertEquals( "prop", evaluate( "bean/bean/prop", contexts ) ); - assertEquals( "flag", evaluate( "bean/bean/flag", contexts ) ); - assertEquals( "arg", evaluate( "bean/bean/arg", contexts ) ); + assertEquals("field", evaluate("bean/field", contexts)); + assertNull(evaluate("bean/invalid", contexts)); + assertEquals("prop", evaluate("bean/bean/prop", contexts)); + assertEquals("flag", evaluate("bean/bean/flag", contexts)); + assertEquals("arg", evaluate("bean/bean/arg", contexts)); } - private static Object evaluate( String expression, Object context ) - { - return ExpressionUtil.evaluate( expression, context ).get( expression ); + private static Object evaluate(String expression, Object context) { + return ExpressionUtil.evaluate(expression, context).get(expression); } @Test - public void testGetProperty() - { + public void testGetProperty() { BeanOne bean1 = new BeanOne(); BeanTwo bean2 = new BeanTwo(); - assertEquals( bean1.isFlag(), ExpressionUtil.getProperty( bean1, "flag" ) ); - assertEquals( bean1.getProp(), ExpressionUtil.getProperty( bean1, "prop" ) ); - assertEquals( bean1.get( "get" ), ExpressionUtil.getProperty( bean1, "get" ) ); + assertEquals(bean1.isFlag(), ExpressionUtil.getProperty(bean1, "flag")); + assertEquals(bean1.getProp(), ExpressionUtil.getProperty(bean1, "prop")); + assertEquals(bean1.get("get"), ExpressionUtil.getProperty(bean1, "get")); - assertNull( ExpressionUtil.getProperty( bean2, "invalid" ) ); - assertEquals( bean2.field, ExpressionUtil.getProperty( bean2, "field" ) ); - assertSame( bean2.bean, ExpressionUtil.getProperty( bean2, "bean" ) ); + assertNull(ExpressionUtil.getProperty(bean2, "invalid")); + assertEquals(bean2.field, ExpressionUtil.getProperty(bean2, "field")); + assertSame(bean2.bean, ExpressionUtil.getProperty(bean2, "bean")); - assertEquals( 0, ExpressionUtil.getProperty( new String[0], "length" ) ); + assertEquals(0, ExpressionUtil.getProperty(new String[0], "length")); } - public static class BeanOne - { - public String isFlag() - { + public static class BeanOne { + public String isFlag() { return "flag"; } - public String getProp() - { + public String getProp() { return "prop"; } - public String get( String arg ) - { + public String get(String arg) { return arg; } } - public static class BeanTwo - { + public static class BeanTwo { public String field = "field"; public BeanOne bean = new BeanOne(); - } } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-expression/src/test/java/org/apache/maven/plugin/coreit/PropertyUtilTest.java b/its/core-it-support/core-it-plugins/maven-it-plugin-expression/src/test/java/org/apache/maven/plugin/coreit/PropertyUtilTest.java index 3d8dc1f639..d543588823 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-expression/src/test/java/org/apache/maven/plugin/coreit/PropertyUtilTest.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-expression/src/test/java/org/apache/maven/plugin/coreit/PropertyUtilTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,14 +16,15 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ - -import org.junit.jupiter.api.Test; +package org.apache.maven.plugin.coreit; import java.io.File; import java.util.Arrays; import java.util.Collections; import java.util.Properties; +import org.junit.jupiter.api.Test; + import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -34,117 +33,102 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * @author Benjamin Bentmann * */ -public class PropertyUtilTest -{ +public class PropertyUtilTest { @Test - public void testStoreScalar() - { + public void testStoreScalar() { Properties props = new Properties(); - PropertyUtil.store( props, "null", null ); - PropertyUtil.store( props, "string", "str" ); - PropertyUtil.store( props, "boolean", Boolean.TRUE ); - PropertyUtil.store( props, "int", 7 ); - PropertyUtil.store( props, "file", new File( "pom.xml" ) ); + PropertyUtil.store(props, "null", null); + PropertyUtil.store(props, "string", "str"); + PropertyUtil.store(props, "boolean", Boolean.TRUE); + PropertyUtil.store(props, "int", 7); + PropertyUtil.store(props, "file", new File("pom.xml")); - assertNull( props.get( "null" ) ); - assertEquals( "str", props.get( "string" ) ); - assertEquals( "true", props.get( "boolean" ) ); - assertEquals( "7", props.get( "int" ) ); - assertEquals( "pom.xml", props.get( "file" ) ); - assertEquals( 4, props.size() ); + assertNull(props.get("null")); + assertEquals("str", props.get("string")); + assertEquals("true", props.get("boolean")); + assertEquals("7", props.get("int")); + assertEquals("pom.xml", props.get("file")); + assertEquals(4, props.size()); } @Test - public void testStoreArray() - { + public void testStoreArray() { Properties props = new Properties(); - PropertyUtil.store( props, "arr", new String[]{ "one", "two" } ); + PropertyUtil.store(props, "arr", new String[] {"one", "two"}); - assertEquals( "2", props.get( "arr" ) ); - assertEquals( "one", props.get( "arr.0" ) ); - assertEquals( "two", props.get( "arr.1" ) ); - assertEquals( 3, props.size() ); + assertEquals("2", props.get("arr")); + assertEquals("one", props.get("arr.0")); + assertEquals("two", props.get("arr.1")); + assertEquals(3, props.size()); } @Test - public void testStoreList() - { + public void testStoreList() { Properties props = new Properties(); - PropertyUtil.store( props, "arr", Arrays.asList( new String[]{ "one", "two" } ) ); + PropertyUtil.store(props, "arr", Arrays.asList(new String[] {"one", "two"})); - assertEquals( "2", props.get( "arr" ) ); - assertEquals( "one", props.get( "arr.0" ) ); - assertEquals( "two", props.get( "arr.1" ) ); - assertEquals( 3, props.size() ); + assertEquals("2", props.get("arr")); + assertEquals("one", props.get("arr.0")); + assertEquals("two", props.get("arr.1")); + assertEquals(3, props.size()); } @Test - public void testStoreMap() - { + public void testStoreMap() { Properties props = new Properties(); - PropertyUtil.store( props, "map", Collections.singletonMap( "key", "value" ) ); + PropertyUtil.store(props, "map", Collections.singletonMap("key", "value")); - assertEquals( "1", props.get( "map" ) ); - assertEquals( "value", props.get( "map.key" ) ); - assertEquals( 2, props.size() ); + assertEquals("1", props.get("map")); + assertEquals("value", props.get("map.key")); + assertEquals(2, props.size()); } @Test - public void testStoreBean() - { + public void testStoreBean() { Properties props = new Properties(); - PropertyUtil.store( props, "bean", new Bean() ); + PropertyUtil.store(props, "bean", new Bean()); - assertEquals( "name", props.get( "bean.name" ) ); - assertEquals( "false", props.get( "bean.enabled" ) ); - assertEquals( 2, props.size() ); + assertEquals("name", props.get("bean.name")); + assertEquals("false", props.get("bean.enabled")); + assertEquals(2, props.size()); } @Test - public void testStoreCycle() - { - Object[] arr = { null }; - arr[0] = Collections.singleton( Collections.singletonMap( "key", arr ) ); + public void testStoreCycle() { + Object[] arr = {null}; + arr[0] = Collections.singleton(Collections.singletonMap("key", arr)); Properties props = new Properties(); - PropertyUtil.store( props, "cycle", arr ); - assertTrue( true, "Should not die because of stack overflow" ); + PropertyUtil.store(props, "cycle", arr); + assertTrue(true, "Should not die because of stack overflow"); } @Test - public void testGetPropertyName() - { - assertEquals( "name", PropertyUtil.getPropertyName( "getName" ) ); - assertEquals( "enabled", PropertyUtil.getPropertyName( "isEnabled" ) ); + public void testGetPropertyName() { + assertEquals("name", PropertyUtil.getPropertyName("getName")); + assertEquals("enabled", PropertyUtil.getPropertyName("isEnabled")); } - public static class Bean - { - public String getName() - { + public static class Bean { + public String getName() { return "name"; } - public boolean isEnabled() - { + public boolean isEnabled() { return false; } - public String toString() - { + public String toString() { return "excluded"; } - public Object getUntypedReturnValue() - { + public Object getUntypedReturnValue() { return "excluded"; } - public Bean getCyclicReference() - { + public Bean getCyclicReference() { return this; } } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-extension-consumer/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-extension-consumer/pom.xml index 98ecae61f5..287b50f73b 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-extension-consumer/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-extension-consumer/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 - maven-it-plugins org.apache.maven.its.plugins + maven-it-plugins 2.1-SNAPSHOT @@ -32,9 +30,7 @@ under the License. maven-plugin Maven IT Plugin :: Extension Consumer - - A test plugin that reuses a component provided by the extension-provider. - + A test plugin that reuses a component provided by the extension-provider. 2009 diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-extension-consumer/src/main/java/org/apache/maven/plugin/coreit/UpdateSingletonMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-extension-consumer/src/main/java/org/apache/maven/plugin/coreit/UpdateSingletonMojo.java index 40a11f7aa3..3c2f1b99d2 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-extension-consumer/src/main/java/org/apache/maven/plugin/coreit/UpdateSingletonMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-extension-consumer/src/main/java/org/apache/maven/plugin/coreit/UpdateSingletonMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; import java.io.File; import java.io.IOException; @@ -33,22 +32,20 @@ import org.apache.maven.plugins.annotations.Parameter; /** * Updates the state of the singleton component and optionally dumps the updated state to a properties file. * - * + * * @author Benjamin Bentmann */ -@Mojo( name = "update-singleton", defaultPhase = LifecyclePhase.INITIALIZE ) -public class UpdateSingletonMojo - extends AbstractMojo -{ +@Mojo(name = "update-singleton", defaultPhase = LifecyclePhase.INITIALIZE) +public class UpdateSingletonMojo extends AbstractMojo { /** */ - @Parameter( defaultValue = "consumer" ) + @Parameter(defaultValue = "consumer") private String key; /** */ - @Parameter( defaultValue = "passed" ) + @Parameter(defaultValue = "passed") private String value; /** @@ -66,29 +63,23 @@ public class UpdateSingletonMojo * * @throws MojoExecutionException If the output file could not be created. */ - public void execute() - throws MojoExecutionException - { - getLog().info( "[MAVEN-CORE-IT-LOG] Singleton Instance: " + System.identityHashCode( singleton ) ); - getLog().info( "[MAVEN-CORE-IT-LOG] Singleton Class Loader: " + singleton.getClass().getClassLoader() ); + public void execute() throws MojoExecutionException { + getLog().info("[MAVEN-CORE-IT-LOG] Singleton Instance: " + System.identityHashCode(singleton)); + getLog().info("[MAVEN-CORE-IT-LOG] Singleton Class Loader: " + + singleton.getClass().getClassLoader()); - getLog().info( "[MAVEN-CORE-IT-LOG] Setting property " + key + " = " + value ); + getLog().info("[MAVEN-CORE-IT-LOG] Setting property " + key + " = " + value); - singleton.setProperty( key, value ); + singleton.setProperty(key, value); - if ( propertiesFile != null ) - { - getLog().info( "[MAVEN-CORE-IT-LOG] Saving properties to " + propertiesFile ); + if (propertiesFile != null) { + getLog().info("[MAVEN-CORE-IT-LOG] Saving properties to " + propertiesFile); - try - { - singleton.saveProperties( propertiesFile ); - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Failed to save properties to " + propertiesFile, e ); + try { + singleton.saveProperties(propertiesFile); + } catch (IOException e) { + throw new MojoExecutionException("Failed to save properties to " + propertiesFile, e); } } } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-extension-provider/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-extension-provider/pom.xml index 97d0895d89..efc0f14de7 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-extension-provider/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-extension-provider/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 - maven-it-plugins org.apache.maven.its.plugins + maven-it-plugins 2.1-SNAPSHOT @@ -32,10 +30,8 @@ under the License. maven-plugin Maven IT Plugin :: Extension Provider - - A test plugin that will be used as a build extension and should contribute a stateful singleton component for reuse - by other plugins in the same project and other projects that use the same extension plugin. - + A test plugin that will be used as a build extension and should contribute a stateful singleton component for reuse + by other plugins in the same project and other projects that use the same extension plugin. 2009 diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-extension-provider/src/main/java/org/apache/maven/plugin/coreit/UpdateSingletonMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-extension-provider/src/main/java/org/apache/maven/plugin/coreit/UpdateSingletonMojo.java index c2ac3871db..b7f71eb2db 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-extension-provider/src/main/java/org/apache/maven/plugin/coreit/UpdateSingletonMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-extension-provider/src/main/java/org/apache/maven/plugin/coreit/UpdateSingletonMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; import java.io.File; import java.io.IOException; @@ -33,22 +32,20 @@ import org.apache.maven.plugins.annotations.Parameter; /** * Updates the state of the singleton component and optionally dumps the updated state to a properties file. * - * + * * @author Benjamin Bentmann */ -@Mojo( name = "update-singleton", defaultPhase = LifecyclePhase.INITIALIZE ) -public class UpdateSingletonMojo - extends AbstractMojo -{ +@Mojo(name = "update-singleton", defaultPhase = LifecyclePhase.INITIALIZE) +public class UpdateSingletonMojo extends AbstractMojo { /** */ - @Parameter( defaultValue = "provider" ) + @Parameter(defaultValue = "provider") private String key; /** */ - @Parameter( defaultValue = "passed" ) + @Parameter(defaultValue = "passed") private String value; /** @@ -66,29 +63,23 @@ public class UpdateSingletonMojo * * @throws MojoExecutionException If the output file could not be created. */ - public void execute() - throws MojoExecutionException - { - getLog().info( "[MAVEN-CORE-IT-LOG] Singleton Instance: " + System.identityHashCode( singleton ) ); - getLog().info( "[MAVEN-CORE-IT-LOG] Singleton Class Loader: " + singleton.getClass().getClassLoader() ); + public void execute() throws MojoExecutionException { + getLog().info("[MAVEN-CORE-IT-LOG] Singleton Instance: " + System.identityHashCode(singleton)); + getLog().info("[MAVEN-CORE-IT-LOG] Singleton Class Loader: " + + singleton.getClass().getClassLoader()); - getLog().info( "[MAVEN-CORE-IT-LOG] Setting property " + key + " = " + value ); + getLog().info("[MAVEN-CORE-IT-LOG] Setting property " + key + " = " + value); - singleton.setProperty( key, value ); + singleton.setProperty(key, value); - if ( propertiesFile != null ) - { - getLog().info( "[MAVEN-CORE-IT-LOG] Saving properties to " + propertiesFile ); + if (propertiesFile != null) { + getLog().info("[MAVEN-CORE-IT-LOG] Saving properties to " + propertiesFile); - try - { - singleton.saveProperties( propertiesFile ); - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Failed to save properties to " + propertiesFile, e ); + try { + singleton.saveProperties(propertiesFile); + } catch (IOException e) { + throw new MojoExecutionException("Failed to save properties to " + propertiesFile, e); } } } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-extension1/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-extension1/pom.xml index 8e43200a65..fb5cf86238 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-extension1/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-extension1/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 - maven-it-plugins org.apache.maven.its.plugins + maven-it-plugins 2.1-SNAPSHOT @@ -32,9 +30,7 @@ under the License. maven-plugin Maven IT Plugin :: Extension 1 - - A test plugin that contribute an artifact handler. - + A test plugin that contribute an artifact handler. true diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-extension1/src/main/java/org/apache/maven/plugin/coreit/CoreItMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-extension1/src/main/java/org/apache/maven/plugin/coreit/CoreItMojo.java index 4522ece5d4..3fbb0fff82 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-extension1/src/main/java/org/apache/maven/plugin/coreit/CoreItMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-extension1/src/main/java/org/apache/maven/plugin/coreit/CoreItMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,17 +16,14 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugins.annotations.Mojo; /** - */ -@Mojo( name = "dummy" ) -public class CoreItMojo - extends AbstractMojo -{ - public void execute() - { - } + */ +@Mojo(name = "dummy") +public class CoreItMojo extends AbstractMojo { + public void execute() {} } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-extension2/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-extension2/pom.xml index 168ca5364a..ddc19a3391 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-extension2/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-extension2/pom.xml @@ -1,5 +1,4 @@ - - - + 4.0.0 - maven-it-plugins org.apache.maven.its.plugins + maven-it-plugins 2.1-SNAPSHOT @@ -33,9 +30,7 @@ under the License. maven-plugin Maven IT Plugin :: Extension 2 - - A test plugin that contribute an artifact handler. - + A test plugin that contribute an artifact handler. true diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-extension2/src/main/java/org/apache/maven/plugin/coreit/CoreItMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-extension2/src/main/java/org/apache/maven/plugin/coreit/CoreItMojo.java index 4522ece5d4..3fbb0fff82 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-extension2/src/main/java/org/apache/maven/plugin/coreit/CoreItMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-extension2/src/main/java/org/apache/maven/plugin/coreit/CoreItMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,17 +16,14 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugins.annotations.Mojo; /** - */ -@Mojo( name = "dummy" ) -public class CoreItMojo - extends AbstractMojo -{ - public void execute() - { - } + */ +@Mojo(name = "dummy") +public class CoreItMojo extends AbstractMojo { + public void execute() {} } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-fork/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-fork/pom.xml index 77b7d6a8da..1c9985d385 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-fork/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-fork/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 - maven-it-plugins org.apache.maven.its.plugins + maven-it-plugins 2.1-SNAPSHOT diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-fork/src/main/java/org/apache/maven/plugin/coreit/ForkGoalAggregatorMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-fork/src/main/java/org/apache/maven/plugin/coreit/ForkGoalAggregatorMojo.java index f4300056f1..116977dc41 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-fork/src/main/java/org/apache/maven/plugin/coreit/ForkGoalAggregatorMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-fork/src/main/java/org/apache/maven/plugin/coreit/ForkGoalAggregatorMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,9 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.util.List; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; @@ -26,45 +27,36 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; -import java.util.List; - /** */ -@Mojo( name = "fork-goal-aggregator", aggregator = true ) -@Execute( goal = "touch" ) -public class ForkGoalAggregatorMojo - extends AbstractMojo -{ +@Mojo(name = "fork-goal-aggregator", aggregator = true) +@Execute(goal = "touch") +public class ForkGoalAggregatorMojo extends AbstractMojo { /** */ - @Parameter( defaultValue = "${project}" ) + @Parameter(defaultValue = "${project}") private MavenProject project; /** */ - @Parameter( defaultValue = "${reactorProjects}" ) + @Parameter(defaultValue = "${reactorProjects}") private List reactorProjects; - public void execute() - throws MojoExecutionException - { - for ( MavenProject reactorProject : reactorProjects ) - { + public void execute() throws MojoExecutionException { + for (MavenProject reactorProject : reactorProjects) { MavenProject executedProject = reactorProject.getExecutionProject(); - if ( !executedProject.getBuild().getFinalName().equals( TouchMojo.FINAL_NAME ) ) - { + if (!executedProject.getBuild().getFinalName().equals(TouchMojo.FINAL_NAME)) { throw new MojoExecutionException( - "Unexpected result, final name of executed project " + executedProject + " is " - + executedProject.getBuild().getFinalName() + " (should be \'" + TouchMojo.FINAL_NAME - + "\')." ); + "Unexpected result, final name of executed project " + executedProject + " is " + + executedProject.getBuild().getFinalName() + " (should be \'" + TouchMojo.FINAL_NAME + + "\')."); } } - if ( project.getBuild().getFinalName().equals( TouchMojo.FINAL_NAME ) ) - { + if (project.getBuild().getFinalName().equals(TouchMojo.FINAL_NAME)) { throw new MojoExecutionException( - "forked project was polluted. (should NOT be \'" + TouchMojo.FINAL_NAME + "\')." ); + "forked project was polluted. (should NOT be \'" + TouchMojo.FINAL_NAME + "\')."); } } } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-fork/src/main/java/org/apache/maven/plugin/coreit/ForkGoalMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-fork/src/main/java/org/apache/maven/plugin/coreit/ForkGoalMojo.java index cc9a5ac6da..8a18410a34 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-fork/src/main/java/org/apache/maven/plugin/coreit/ForkGoalMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-fork/src/main/java/org/apache/maven/plugin/coreit/ForkGoalMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; @@ -28,30 +27,24 @@ import org.apache.maven.project.MavenProject; /** */ -@Mojo( name = "fork-goal" ) -@Execute( goal = "touch" ) -public class ForkGoalMojo - extends AbstractMojo -{ - @Parameter( defaultValue = "${project}" ) +@Mojo(name = "fork-goal") +@Execute(goal = "touch") +public class ForkGoalMojo extends AbstractMojo { + @Parameter(defaultValue = "${project}") private MavenProject project; - @Parameter( defaultValue = "${executedProject}" ) + @Parameter(defaultValue = "${executedProject}") private MavenProject executedProject; - public void execute() - throws MojoExecutionException - { - if ( !executedProject.getBuild().getFinalName().equals( TouchMojo.FINAL_NAME ) ) - { - throw new MojoExecutionException( "Unexpected result, final name of executed project is " - + executedProject.getBuild().getFinalName() + " (should be \'" + TouchMojo.FINAL_NAME + "\')." ); + public void execute() throws MojoExecutionException { + if (!executedProject.getBuild().getFinalName().equals(TouchMojo.FINAL_NAME)) { + throw new MojoExecutionException("Unexpected result, final name of executed project is " + + executedProject.getBuild().getFinalName() + " (should be \'" + TouchMojo.FINAL_NAME + "\')."); } - if ( project.getBuild().getFinalName().equals( TouchMojo.FINAL_NAME ) ) - { - throw new MojoExecutionException( "forked project was polluted. (should NOT be \'" + TouchMojo.FINAL_NAME - + "\')." ); + if (project.getBuild().getFinalName().equals(TouchMojo.FINAL_NAME)) { + throw new MojoExecutionException( + "forked project was polluted. (should NOT be \'" + TouchMojo.FINAL_NAME + "\')."); } } } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-fork/src/main/java/org/apache/maven/plugin/coreit/ForkLifecycleAggregatorMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-fork/src/main/java/org/apache/maven/plugin/coreit/ForkLifecycleAggregatorMojo.java index 75e57208fe..8f8c54a9b2 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-fork/src/main/java/org/apache/maven/plugin/coreit/ForkLifecycleAggregatorMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-fork/src/main/java/org/apache/maven/plugin/coreit/ForkLifecycleAggregatorMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,9 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.util.List; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; @@ -27,43 +28,33 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; -import java.util.List; - /** */ -@Mojo( name = "fork-lifecycle-aggregator", aggregator = true ) -@Execute( phase = LifecyclePhase.GENERATE_SOURCES, lifecycle = "foo" ) -public class ForkLifecycleAggregatorMojo - extends AbstractMojo -{ +@Mojo(name = "fork-lifecycle-aggregator", aggregator = true) +@Execute(phase = LifecyclePhase.GENERATE_SOURCES, lifecycle = "foo") +public class ForkLifecycleAggregatorMojo extends AbstractMojo { - @Parameter( defaultValue = "${project}" ) + @Parameter(defaultValue = "${project}") private MavenProject project; - @Parameter( defaultValue = "${reactorProjects}" ) + @Parameter(defaultValue = "${reactorProjects}") private List reactorProjects; - public void execute() - throws MojoExecutionException - { - for ( Object reactorProject : reactorProjects ) - { - MavenProject executedProject = ( (MavenProject) reactorProject ).getExecutionProject(); + public void execute() throws MojoExecutionException { + for (Object reactorProject : reactorProjects) { + MavenProject executedProject = ((MavenProject) reactorProject).getExecutionProject(); - if ( !executedProject.getBuild().getFinalName().equals( TouchMojo.FINAL_NAME ) ) - { + if (!executedProject.getBuild().getFinalName().equals(TouchMojo.FINAL_NAME)) { throw new MojoExecutionException( - "Unexpected result, final name of executed project " + executedProject + " is " - + executedProject.getBuild().getFinalName() + " (should be \'" + TouchMojo.FINAL_NAME - + "\')." ); + "Unexpected result, final name of executed project " + executedProject + " is " + + executedProject.getBuild().getFinalName() + " (should be \'" + TouchMojo.FINAL_NAME + + "\')."); } } - if ( project.getBuild().getFinalName().equals( TouchMojo.FINAL_NAME ) ) - { + if (project.getBuild().getFinalName().equals(TouchMojo.FINAL_NAME)) { throw new MojoExecutionException( - "forked project was polluted. (should NOT be \'" + TouchMojo.FINAL_NAME + "\')." ); + "forked project was polluted. (should NOT be \'" + TouchMojo.FINAL_NAME + "\')."); } } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-fork/src/main/java/org/apache/maven/plugin/coreit/ForkLifecycleMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-fork/src/main/java/org/apache/maven/plugin/coreit/ForkLifecycleMojo.java index c813cc4639..00b3967ac7 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-fork/src/main/java/org/apache/maven/plugin/coreit/ForkLifecycleMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-fork/src/main/java/org/apache/maven/plugin/coreit/ForkLifecycleMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,9 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; @@ -27,39 +28,31 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; -import java.io.File; - /** */ -@Mojo( name = "fork" ) -@Execute( phase = LifecyclePhase.GENERATE_RESOURCES, lifecycle = "foo" ) -public class ForkLifecycleMojo - extends AbstractMojo -{ - @Parameter( defaultValue = "${project}" ) +@Mojo(name = "fork") +@Execute(phase = LifecyclePhase.GENERATE_RESOURCES, lifecycle = "foo") +public class ForkLifecycleMojo extends AbstractMojo { + @Parameter(defaultValue = "${project}") private MavenProject project; - @Parameter( defaultValue = "${executedProject}" ) + @Parameter(defaultValue = "${executedProject}") private MavenProject executedProject; - @Parameter( defaultValue = "${project.build.directory}" ) + @Parameter(defaultValue = "${project.build.directory}") private File touchDirectory; - public void execute() - throws MojoExecutionException - { - TouchMojo.touch( touchDirectory, "fork-lifecycle.txt" ); + public void execute() throws MojoExecutionException { + TouchMojo.touch(touchDirectory, "fork-lifecycle.txt"); - if ( !executedProject.getBuild().getFinalName().equals( TouchMojo.FINAL_NAME ) ) - { - throw new MojoExecutionException( "Unexpected result, final name of executed project is " - + executedProject.getBuild().getFinalName() + " (should be \'" + TouchMojo.FINAL_NAME + "\')." ); + if (!executedProject.getBuild().getFinalName().equals(TouchMojo.FINAL_NAME)) { + throw new MojoExecutionException("Unexpected result, final name of executed project is " + + executedProject.getBuild().getFinalName() + " (should be \'" + TouchMojo.FINAL_NAME + "\')."); } - if ( project.getBuild().getFinalName().equals( TouchMojo.FINAL_NAME ) ) - { - throw new MojoExecutionException( "forked project was polluted. (should NOT be \'" + TouchMojo.FINAL_NAME - + "\')." ); + if (project.getBuild().getFinalName().equals(TouchMojo.FINAL_NAME)) { + throw new MojoExecutionException( + "forked project was polluted. (should NOT be \'" + TouchMojo.FINAL_NAME + "\')."); } } } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-fork/src/main/java/org/apache/maven/plugin/coreit/ForkLifecycleNoProjectMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-fork/src/main/java/org/apache/maven/plugin/coreit/ForkLifecycleNoProjectMojo.java index 473c11dbea..ba0b347a0f 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-fork/src/main/java/org/apache/maven/plugin/coreit/ForkLifecycleNoProjectMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-fork/src/main/java/org/apache/maven/plugin/coreit/ForkLifecycleNoProjectMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,9 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; @@ -26,32 +27,24 @@ import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; -import java.io.File; - /** */ -@Mojo( name = "fork-lifecycle-no-project", requiresProject = false ) -@Execute( phase = LifecyclePhase.GENERATE_RESOURCES, lifecycle = "foo" ) -public class ForkLifecycleNoProjectMojo - extends AbstractMojo -{ +@Mojo(name = "fork-lifecycle-no-project", requiresProject = false) +@Execute(phase = LifecyclePhase.GENERATE_RESOURCES, lifecycle = "foo") +public class ForkLifecycleNoProjectMojo extends AbstractMojo { - @Parameter( defaultValue = "${project.build.finalName}" ) + @Parameter(defaultValue = "${project.build.finalName}") private String finalName; - @Parameter( defaultValue = "target" ) + @Parameter(defaultValue = "target") private File touchDirectory; - public void execute() - throws MojoExecutionException - { - TouchMojo.touch( touchDirectory, "fork-lifecycle-no-project.txt" ); + public void execute() throws MojoExecutionException { + TouchMojo.touch(touchDirectory, "fork-lifecycle-no-project.txt"); - if ( TouchMojo.FINAL_NAME.equals( finalName ) ) - { - throw new MojoExecutionException( "forked project was polluted. (should NOT be \'" + TouchMojo.FINAL_NAME - + "\')." ); + if (TouchMojo.FINAL_NAME.equals(finalName)) { + throw new MojoExecutionException( + "forked project was polluted. (should NOT be \'" + TouchMojo.FINAL_NAME + "\')."); } } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-fork/src/main/java/org/apache/maven/plugin/coreit/TouchMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-fork/src/main/java/org/apache/maven/plugin/coreit/TouchMojo.java index 0b71e12402..499c717219 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-fork/src/main/java/org/apache/maven/plugin/coreit/TouchMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-fork/src/main/java/org/apache/maven/plugin/coreit/TouchMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,12 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; @@ -26,64 +30,49 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; -import java.io.File; -import java.io.FileOutputStream; -import java.io.OutputStreamWriter; -import java.io.IOException; - /** */ -@Mojo( name = "touch", defaultPhase = LifecyclePhase.PROCESS_RESOURCES ) -public class TouchMojo - extends AbstractMojo -{ +@Mojo(name = "touch", defaultPhase = LifecyclePhase.PROCESS_RESOURCES) +public class TouchMojo extends AbstractMojo { static final String FINAL_NAME = "coreitified"; - @Parameter( defaultValue = "${project}" ) + @Parameter(defaultValue = "${project}") private MavenProject project; - @Parameter( defaultValue = "${project.build.directory}", required = true ) + @Parameter(defaultValue = "${project.build.directory}", required = true) private File outputDirectory; - public void execute() - throws MojoExecutionException - { - getLog().info( "[MAVEN-CORE-IT-LOG] Project build directory " + project.getBuild().getDirectory() ); + public void execute() throws MojoExecutionException { + getLog().info("[MAVEN-CORE-IT-LOG] Project build directory " + + project.getBuild().getDirectory()); - touch( new File( project.getBuild().getDirectory() ), "touch.log" ); + touch(new File(project.getBuild().getDirectory()), "touch.log"); - getLog().info( "[MAVEN-CORE-IT-LOG] Using output directory " + outputDirectory ); + getLog().info("[MAVEN-CORE-IT-LOG] Using output directory " + outputDirectory); - touch( outputDirectory, "touch.txt" ); + touch(outputDirectory, "touch.txt"); - project.getBuild().setFinalName( FINAL_NAME ); + project.getBuild().setFinalName(FINAL_NAME); } - static void touch( File dir, String file ) - throws MojoExecutionException - { - try - { - if ( !dir.exists() ) - { - dir.mkdirs(); - } + static void touch(File dir, String file) throws MojoExecutionException { + try { + if (!dir.exists()) { + dir.mkdirs(); + } - File touch = new File( dir, file ); + File touch = new File(dir, file); - // NOTE: Using append mode to track execution count - OutputStreamWriter w = new OutputStreamWriter( new FileOutputStream( touch, true ), "UTF-8" ); + // NOTE: Using append mode to track execution count + OutputStreamWriter w = new OutputStreamWriter(new FileOutputStream(touch, true), "UTF-8"); - w.write( file ); - w.write( "\n" ); + w.write(file); + w.write("\n"); - w.close(); - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Error touching file", e ); + w.close(); + } catch (IOException e) { + throw new MojoExecutionException("Error touching file", e); } } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-invalid-descriptor/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-invalid-descriptor/pom.xml index e8f7f84d62..3dc200a57f 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-invalid-descriptor/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-invalid-descriptor/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 - maven-it-plugins org.apache.maven.its.plugins + maven-it-plugins 2.1-SNAPSHOT @@ -54,10 +52,10 @@ under the License. copy-resources - prepare-package copy-resources + prepare-package ${project.build.outputDirectory} @@ -74,4 +72,3 @@ under the License. - diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-invalid-descriptor/src/main/java/org/apache/maven/plugin/coreit/CoreItMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-invalid-descriptor/src/main/java/org/apache/maven/plugin/coreit/CoreItMojo.java index c28ceba2e8..c6eb1801b8 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-invalid-descriptor/src/main/java/org/apache/maven/plugin/coreit/CoreItMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-invalid-descriptor/src/main/java/org/apache/maven/plugin/coreit/CoreItMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; @@ -27,14 +26,9 @@ import org.apache.maven.plugins.annotations.Mojo; * * @phase process-sources */ -@Mojo( name = "test" ) -public class CoreItMojo - extends AbstractMojo -{ - public void execute() - throws MojoExecutionException - { - throw new MojoExecutionException( "Should not be run" ); +@Mojo(name = "test") +public class CoreItMojo extends AbstractMojo { + public void execute() throws MojoExecutionException { + throw new MojoExecutionException("Should not be run"); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-log-file/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-log-file/pom.xml index 44f0a7bc34..a6bec95c30 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-log-file/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-log-file/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 - maven-it-plugins org.apache.maven.its.plugins + maven-it-plugins 2.1-SNAPSHOT @@ -32,10 +30,8 @@ under the License. maven-plugin Maven IT Plugin :: Log File - - A test plugin that appends lines to a UTF-8 encoded log file. Apparently, the order of log lines allows to check - the order in which the plugin's goals were executed. - + A test plugin that appends lines to a UTF-8 encoded log file. Apparently, the order of log lines allows to check + the order in which the plugin's goals were executed. 2008 diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-log-file/src/main/java/org/apache/maven/plugin/coreit/AbstractLogMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-log-file/src/main/java/org/apache/maven/plugin/coreit/AbstractLogMojo.java index 4c55c6b95b..e54bfeaa16 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-log-file/src/main/java/org/apache/maven/plugin/coreit/AbstractLogMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-log-file/src/main/java/org/apache/maven/plugin/coreit/AbstractLogMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,10 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugins.annotations.Parameter; +package org.apache.maven.plugin.coreit; import java.io.BufferedWriter; import java.io.File; @@ -30,26 +25,28 @@ import java.io.IOException; import java.io.OutputStream; import java.io.OutputStreamWriter; +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugins.annotations.Parameter; + /** * Provides common services for the mojos of this plugin. * * @author Benjamin Bentmann * */ -public abstract class AbstractLogMojo - extends AbstractMojo -{ +public abstract class AbstractLogMojo extends AbstractMojo { /** * The project's base directory, used for manual path translation. */ - @Parameter( defaultValue = "${basedir}", readonly = true ) + @Parameter(defaultValue = "${basedir}", readonly = true) private File basedir; /** * The path to the output file, relative to the project's base directory. */ - @Parameter( property = "log.logFile" ) + @Parameter(property = "log.logFile") private File logFile; /** @@ -62,12 +59,11 @@ public abstract class AbstractLogMojo * * @return The absolute path to the log file, never null. */ - private File getLogFile() - { + private File getLogFile() { /* * NOTE: We don't want to test path translation here. */ - return logFile.isAbsolute() ? logFile : new File( basedir, logFile.getPath() ); + return logFile.isAbsolute() ? logFile : new File(basedir, logFile.getPath()); } /** @@ -78,41 +74,29 @@ public abstract class AbstractLogMojo * @param value The object to log, may be null. * @throws MojoExecutionException If the log file could not be updated. */ - protected void append( Object value ) - throws MojoExecutionException - { + protected void append(Object value) throws MojoExecutionException { File file = getLogFile(); - getLog().info( "[MAVEN-CORE-IT-LOG] Updating log file: " + file ); - getLog().info( "[MAVEN-CORE-IT-LOG] " + value ); - try - { + getLog().info("[MAVEN-CORE-IT-LOG] Updating log file: " + file); + getLog().info("[MAVEN-CORE-IT-LOG] " + value); + try { file.getParentFile().mkdirs(); - OutputStream out = new FileOutputStream( file, true ); - try - { - BufferedWriter writer = new BufferedWriter( new OutputStreamWriter( out, encoding ) ); - if ( value != null ) - { - writer.write( value.toString() ); + OutputStream out = new FileOutputStream(file, true); + try { + BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out, encoding)); + if (value != null) { + writer.write(value.toString()); writer.newLine(); writer.flush(); } - } - finally - { - try - { + } finally { + try { out.close(); - } - catch ( IOException e ) - { + } catch (IOException e) { // just ignore, we tried our best to clean up } } - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Failed to update log file " + logFile, e ); + } catch (IOException e) { + throw new MojoExecutionException("Failed to update log file " + logFile, e); } } @@ -121,31 +105,22 @@ public abstract class AbstractLogMojo * * @throws MojoExecutionException If the log file could not be reset. */ - protected void reset() - throws MojoExecutionException - { + protected void reset() throws MojoExecutionException { File file = getLogFile(); - getLog().info( "[MAVEN-CORE-IT-LOG] Resetting log file: " + file ); - try - { + getLog().info("[MAVEN-CORE-IT-LOG] Resetting log file: " + file); + try { /* * NOTE: Intentionally don't delete the file but create a new empty one to check the plugin was executed. */ file.getParentFile().mkdirs(); - OutputStream out = new FileOutputStream( file ); - try - { + OutputStream out = new FileOutputStream(file); + try { out.close(); - } - catch ( IOException e ) - { + } catch (IOException e) { // just ignore, we tried our best to clean up } - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Failed to reset log file " + logFile, e ); + } catch (IOException e) { + throw new MojoExecutionException("Failed to reset log file " + logFile, e); } } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-log-file/src/main/java/org/apache/maven/plugin/coreit/LogSeparatorMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-log-file/src/main/java/org/apache/maven/plugin/coreit/LogSeparatorMojo.java index 55f590d186..fa8886d864 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-log-file/src/main/java/org/apache/maven/plugin/coreit/LogSeparatorMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-log-file/src/main/java/org/apache/maven/plugin/coreit/LogSeparatorMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugins.annotations.LifecyclePhase; @@ -29,16 +28,14 @@ import org.apache.maven.plugins.annotations.Parameter; * * @author Benjamin Bentmann * - */ -@Mojo( name = "log-separator", defaultPhase = LifecyclePhase.INITIALIZE ) -public class LogSeparatorMojo - extends AbstractLogMojo -{ + */ +@Mojo(name = "log-separator", defaultPhase = LifecyclePhase.INITIALIZE) +public class LogSeparatorMojo extends AbstractLogMojo { /** * The length of the separator line. */ - @Parameter( property = "log.length", defaultValue = "80" ) + @Parameter(property = "log.length", defaultValue = "80") private int length; /** @@ -46,15 +43,11 @@ public class LogSeparatorMojo * * @throws MojoExecutionException If the output file could not be created. */ - public void execute() - throws MojoExecutionException - { - StringBuilder buffer = new StringBuilder( length ); - for ( int i = 0; i < length; i++ ) - { - buffer.append( '-' ); + public void execute() throws MojoExecutionException { + StringBuilder buffer = new StringBuilder(length); + for (int i = 0; i < length; i++) { + buffer.append('-'); } - append( buffer.toString() ); + append(buffer.toString()); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-log-file/src/main/java/org/apache/maven/plugin/coreit/LogStringMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-log-file/src/main/java/org/apache/maven/plugin/coreit/LogStringMojo.java index 936077451b..7680821b35 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-log-file/src/main/java/org/apache/maven/plugin/coreit/LogStringMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-log-file/src/main/java/org/apache/maven/plugin/coreit/LogStringMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugins.annotations.LifecyclePhase; @@ -27,19 +26,17 @@ import org.apache.maven.plugins.annotations.Parameter; /** * Appends a string to the log file. * - * + * * @author Benjamin Bentmann * */ -@Mojo( name = "log-string", defaultPhase = LifecyclePhase.INITIALIZE ) -public class LogStringMojo - extends AbstractLogMojo -{ +@Mojo(name = "log-string", defaultPhase = LifecyclePhase.INITIALIZE) +public class LogStringMojo extends AbstractLogMojo { /** * The string to append to the log file. */ - @Parameter( property = "log.string" ) + @Parameter(property = "log.string") private String string; /** @@ -47,10 +44,7 @@ public class LogStringMojo * * @throws MojoExecutionException If the output file could not be created. */ - public void execute() - throws MojoExecutionException - { - append( string ); + public void execute() throws MojoExecutionException { + append(string); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-log-file/src/main/java/org/apache/maven/plugin/coreit/ResetMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-log-file/src/main/java/org/apache/maven/plugin/coreit/ResetMojo.java index 97e43cc183..cc07cfdffb 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-log-file/src/main/java/org/apache/maven/plugin/coreit/ResetMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-log-file/src/main/java/org/apache/maven/plugin/coreit/ResetMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugins.annotations.LifecyclePhase; @@ -26,24 +25,19 @@ import org.apache.maven.plugins.annotations.Mojo; /** * Clears the contents of the log file by creating a new empty log file. * - * + * * @author Benjamin Bentmann * */ -@Mojo( name = "reset", defaultPhase = LifecyclePhase.INITIALIZE ) -public class ResetMojo - extends AbstractLogMojo -{ +@Mojo(name = "reset", defaultPhase = LifecyclePhase.INITIALIZE) +public class ResetMojo extends AbstractLogMojo { /** * Runs this mojo. * * @throws MojoExecutionException If the output file could not be created. */ - public void execute() - throws MojoExecutionException - { + public void execute() throws MojoExecutionException { reset(); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-log4j/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-log4j/pom.xml index 816d44c32f..1967b16676 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-log4j/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-log4j/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 - maven-it-plugins org.apache.maven.its.plugins + maven-it-plugins 2.1-SNAPSHOT @@ -33,9 +31,7 @@ under the License. maven-plugin Maven IT Plugin :: Log4J Client - - A test plugin that uses log4j. - + A test plugin that uses log4j. 2008 diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-log4j/src/main/java/org/apache/maven/plugin/coreit/ItMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-log4j/src/main/java/org/apache/maven/plugin/coreit/ItMojo.java index 9073ded940..b386c53e7c 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-log4j/src/main/java/org/apache/maven/plugin/coreit/ItMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-log4j/src/main/java/org/apache/maven/plugin/coreit/ItMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,15 +16,16 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; import java.util.List; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.factory.ArtifactFactory; +import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.resolver.ArtifactNotFoundException; import org.apache.maven.artifact.resolver.ArtifactResolutionException; import org.apache.maven.artifact.resolver.ArtifactResolver; -import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugins.annotations.Component; @@ -40,10 +39,8 @@ import org.apache.maven.plugins.annotations.Parameter; * @author Benjamin Bentmann * */ -@Mojo( name = "it" ) -public class ItMojo - extends AbstractMojo -{ +@Mojo(name = "it") +public class ItMojo extends AbstractMojo { /** */ @@ -55,19 +52,19 @@ public class ItMojo @Component private ArtifactResolver artifactResolver; - @Parameter( defaultValue = "${localRepository}", required = true, readonly = true ) + @Parameter(defaultValue = "${localRepository}", required = true, readonly = true) private ArtifactRepository localRepository; - @Parameter( defaultValue = "${project.remoteArtifactRepositories}", required = true, readonly = true ) + @Parameter(defaultValue = "${project.remoteArtifactRepositories}", required = true, readonly = true) private List remoteRepositories; - @Parameter( defaultValue = "test" ) + @Parameter(defaultValue = "test") private String groupId; - @Parameter( defaultValue = "test" ) + @Parameter(defaultValue = "test") private String artifactId; - @Parameter( defaultValue = "1.0" ) + @Parameter(defaultValue = "1.0") private String version; /** @@ -76,25 +73,17 @@ public class ItMojo * @throws MojoExecutionException If the output file could not be created. * or if the output file has not been set. */ - public void execute() - throws MojoExecutionException - { - getLog().info( "[MAVEN-CORE-IT-LOG4J]" ); + public void execute() throws MojoExecutionException { + getLog().info("[MAVEN-CORE-IT-LOG4J]"); - Artifact artifact = artifactFactory.createProjectArtifact( groupId, artifactId, version ); + Artifact artifact = artifactFactory.createProjectArtifact(groupId, artifactId, version); - try - { - artifactResolver.resolve( artifact, remoteRepositories, localRepository ); - } - catch ( ArtifactNotFoundException e ) - { - getLog().info( "SUCCESS" ); - } - catch ( ArtifactResolutionException e ) - { - throw new MojoExecutionException( "Should have responded with ArtifactNotFoundException.", e ); + try { + artifactResolver.resolve(artifact, remoteRepositories, localRepository); + } catch (ArtifactNotFoundException e) { + getLog().info("SUCCESS"); + } catch (ArtifactResolutionException e) { + throw new MojoExecutionException("Should have responded with ArtifactNotFoundException.", e); } } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-model-interpolation/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-model-interpolation/pom.xml index afdd5eb6c1..a6cbcd5f63 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-model-interpolation/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-model-interpolation/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 - maven-it-plugins org.apache.maven.its.plugins + maven-it-plugins 2.1-SNAPSHOT diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-model-interpolation/src/main/java/org/apache/maven/plugin/coreit/PathInterpolationMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-model-interpolation/src/main/java/org/apache/maven/plugin/coreit/PathInterpolationMojo.java index 5016de7d00..892b7cde57 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-model-interpolation/src/main/java/org/apache/maven/plugin/coreit/PathInterpolationMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-model-interpolation/src/main/java/org/apache/maven/plugin/coreit/PathInterpolationMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,9 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.util.Properties; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; @@ -30,14 +31,10 @@ import org.apache.maven.project.MavenProject; import org.apache.maven.project.interpolation.ModelInterpolationException; import org.apache.maven.project.interpolation.ModelInterpolator; -import java.util.Properties; - /** - */ -@Mojo( name = "path-interpolation", defaultPhase = LifecyclePhase.VALIDATE ) -public class PathInterpolationMojo - extends AbstractMojo -{ + */ +@Mojo(name = "path-interpolation", defaultPhase = LifecyclePhase.VALIDATE) +public class PathInterpolationMojo extends AbstractMojo { /** * The model interpolator */ @@ -47,24 +44,20 @@ public class PathInterpolationMojo /** * The current Maven project. */ - @Parameter( defaultValue = "${project}" ) + @Parameter(defaultValue = "${project}") private MavenProject project; - public void execute() - throws MojoExecutionException - { - try - { + public void execute() throws MojoExecutionException { + try { Properties props = project.getProperties(); - modelInterpolator.interpolate( project.getOriginalModel(), - project.getBasedir(), - new DefaultProjectBuilderConfiguration().setExecutionProperties( props ), - true ); - } - catch ( ModelInterpolationException e ) - { - throw new MojoExecutionException( e.getMessage(), e ); + modelInterpolator.interpolate( + project.getOriginalModel(), + project.getBasedir(), + new DefaultProjectBuilderConfiguration().setExecutionProperties(props), + true); + } catch (ModelInterpolationException e) { + throw new MojoExecutionException(e.getMessage(), e); } } } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-no-default-comp/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-no-default-comp/pom.xml index 7fe0dbaf77..21c0819362 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-no-default-comp/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-no-default-comp/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 - maven-it-plugins org.apache.maven.its.plugins + maven-it-plugins 2.1-SNAPSHOT @@ -32,10 +30,8 @@ under the License. maven-plugin Maven IT Plugin :: No Default Component - - A test plugin that has a dependency on some component where the only available implementation does not use - the role hint "default". - + A test plugin that has a dependency on some component where the only available implementation does not use + the role hint "default". 2009 diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-no-default-comp/src/main/java/org/apache/maven/plugin/coreit/ConcreteTestComponent.java b/its/core-it-support/core-it-plugins/maven-it-plugin-no-default-comp/src/main/java/org/apache/maven/plugin/coreit/ConcreteTestComponent.java index e9aa665a85..c8894aafdc 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-no-default-comp/src/main/java/org/apache/maven/plugin/coreit/ConcreteTestComponent.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-no-default-comp/src/main/java/org/apache/maven/plugin/coreit/ConcreteTestComponent.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; import org.codehaus.plexus.component.annotations.Component; @@ -26,14 +25,10 @@ import org.codehaus.plexus.component.annotations.Component; * * @author Benjamin Bentmann */ -@Component ( role = TestComponent.class, hint = "concrete" ) -public class ConcreteTestComponent - implements TestComponent -{ +@Component(role = TestComponent.class, hint = "concrete") +public class ConcreteTestComponent implements TestComponent { - public String getId() - { + public String getId() { return "concrete"; } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-no-default-comp/src/main/java/org/apache/maven/plugin/coreit/ItMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-no-default-comp/src/main/java/org/apache/maven/plugin/coreit/ItMojo.java index 7c8a3ad549..c762b710a9 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-no-default-comp/src/main/java/org/apache/maven/plugin/coreit/ItMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-no-default-comp/src/main/java/org/apache/maven/plugin/coreit/ItMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,12 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.Properties; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; @@ -26,26 +30,19 @@ import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.Properties; - /** * Requires a component with a non-default role hint and dumps this hint to a properties file. * * @author Benjamin Bentmann * - */ -@Mojo( name = "it", defaultPhase = LifecyclePhase.INITIALIZE ) -public class ItMojo - extends AbstractMojo -{ + */ +@Mojo(name = "it", defaultPhase = LifecyclePhase.INITIALIZE) +public class ItMojo extends AbstractMojo { /** * The path to the output file. */ - @Parameter( property = "touch.outputFile", defaultValue = "target/comp.properties" ) + @Parameter(property = "touch.outputFile", defaultValue = "target/comp.properties") private File outputFile; /** @@ -60,30 +57,23 @@ public class ItMojo * * @throws MojoExecutionException If the output file could not be created. */ - public void execute() - throws MojoExecutionException - { - getLog().info( "[MAVEN-CORE-IT-LOG] Using component: " + component ); + public void execute() throws MojoExecutionException { + getLog().info("[MAVEN-CORE-IT-LOG] Using component: " + component); Properties props = new Properties(); - props.setProperty( "id", component.getId() ); + props.setProperty("id", component.getId()); - getLog().info( "[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile); - try - { + try { outputFile.getParentFile().mkdirs(); - try ( FileOutputStream os = new FileOutputStream( outputFile ) ) - { - props.store( os, "MAVEN-CORE-IT-LOG" ); + try (FileOutputStream os = new FileOutputStream(outputFile)) { + props.store(os, "MAVEN-CORE-IT-LOG"); } - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Output file could not be created: " + outputFile, e ); + } catch (IOException e) { + throw new MojoExecutionException("Output file could not be created: " + outputFile, e); } - getLog().info( "[MAVEN-CORE-IT-LOG] Created output file: " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Created output file: " + outputFile); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-no-default-comp/src/main/java/org/apache/maven/plugin/coreit/TestComponent.java b/its/core-it-support/core-it-plugins/maven-it-plugin-no-default-comp/src/main/java/org/apache/maven/plugin/coreit/TestComponent.java index de3256fad5..6a83a888a3 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-no-default-comp/src/main/java/org/apache/maven/plugin/coreit/TestComponent.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-no-default-comp/src/main/java/org/apache/maven/plugin/coreit/TestComponent.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,15 +16,14 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; /** * A dummy component. * * @author Benjamin Bentmann */ -public interface TestComponent -{ +public interface TestComponent { String getId(); - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-no-project/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-no-project/pom.xml index 176d0464c5..50cda4fd48 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-no-project/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-no-project/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 - maven-it-plugins org.apache.maven.its.plugins + maven-it-plugins 2.1-SNAPSHOT diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-no-project/src/main/java/org/apache/maven/plugin/coreit/NoProjectMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-no-project/src/main/java/org/apache/maven/plugin/coreit/NoProjectMojo.java index cee2e79990..5a74548528 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-no-project/src/main/java/org/apache/maven/plugin/coreit/NoProjectMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-no-project/src/main/java/org/apache/maven/plugin/coreit/NoProjectMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,62 +16,53 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; - /** * Mojo which touches a file without requiring a project. */ -@Mojo( name = "light-touch", requiresProject = false ) -public class NoProjectMojo - extends AbstractMojo -{ +@Mojo(name = "light-touch", requiresProject = false) +public class NoProjectMojo extends AbstractMojo { /** */ - @Parameter( defaultValue = "${project.build.directory}", required = true ) + @Parameter(defaultValue = "${project.build.directory}", required = true) private String outputDirectory; /** */ - @Parameter( defaultValue = "target/test-basedir-alignment" ) + @Parameter(defaultValue = "target/test-basedir-alignment") private File basedirAlignmentDirectory; - public void execute() - throws MojoExecutionException - { - touch( new File( outputDirectory ), "touch.txt" ); + public void execute() throws MojoExecutionException { + touch(new File(outputDirectory), "touch.txt"); } - private void touch( File dir, String file ) - throws MojoExecutionException - { - try - { - if ( !dir.exists() ) - { - dir.mkdirs(); - } + private void touch(File dir, String file) throws MojoExecutionException { + try { + if (!dir.exists()) { + dir.mkdirs(); + } - File touch = new File( dir, file ); + File touch = new File(dir, file); - getLog().info( "Touching: " + touch ); + getLog().info("Touching: " + touch); - FileWriter w = new FileWriter( touch ); + FileWriter w = new FileWriter(touch); - w.write( file ); + w.write(file); - w.close(); - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Error touching file", e ); + w.close(); + } catch (IOException e) { + throw new MojoExecutionException("Error touching file", e); } } } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-online/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-online/pom.xml index 5a90c034d0..e9c7b70625 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-online/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-online/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 - maven-it-plugins org.apache.maven.its.plugins + maven-it-plugins 2.1-SNAPSHOT @@ -32,9 +30,7 @@ under the License. maven-plugin Maven IT Plugin :: Online - - A test plugin that requires online mode. - + A test plugin that requires online mode. 2009 diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-online/src/main/java/org/apache/maven/plugin/coreit/TouchMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-online/src/main/java/org/apache/maven/plugin/coreit/TouchMojo.java index 4b79f0d8b6..f584d80874 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-online/src/main/java/org/apache/maven/plugin/coreit/TouchMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-online/src/main/java/org/apache/maven/plugin/coreit/TouchMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,10 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; +import java.io.IOException; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; @@ -25,23 +27,18 @@ import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; -import java.io.File; -import java.io.IOException; - /** * Creates an empty file with a user-specified name. NOTE: This mojo requires online mode. * * @author Benjamin Bentmann */ -@Mojo( name = "touch", defaultPhase = LifecyclePhase.VALIDATE, requiresOnline = true ) -public class TouchMojo - extends AbstractMojo -{ +@Mojo(name = "touch", defaultPhase = LifecyclePhase.VALIDATE, requiresOnline = true) +public class TouchMojo extends AbstractMojo { /** * The path to the output file. */ - @Parameter( property = "touch.outputFile", defaultValue = "target/touch.txt" ) + @Parameter(property = "touch.outputFile", defaultValue = "target/touch.txt") private File outputFile; /** @@ -49,22 +46,16 @@ public class TouchMojo * * @throws MojoExecutionException If the output file could not be created. */ - public void execute() - throws MojoExecutionException - { - getLog().info( "[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile ); + public void execute() throws MojoExecutionException { + getLog().info("[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile); - try - { + try { outputFile.getParentFile().mkdirs(); outputFile.createNewFile(); - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Output file could not be created: " + outputFile, e ); + } catch (IOException e) { + throw new MojoExecutionException("Output file could not be created: " + outputFile, e); } - getLog().info( "[MAVEN-CORE-IT-LOG] Created output file: " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Created output file: " + outputFile); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-optional-mojos/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-optional-mojos/pom.xml index a4d8fd55e2..d4b32b2ad6 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-optional-mojos/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-optional-mojos/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 - maven-it-plugins org.apache.maven.its.plugins + maven-it-plugins 2.1-SNAPSHOT @@ -32,9 +30,7 @@ under the License. maven-plugin Maven IT Plugin :: Optional Mojos - - A test plugin that defines a custom lifecycle mapping with optional mojos. - + A test plugin that defines a custom lifecycle mapping with optional mojos. 2009 diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-optional-mojos/src/main/java/org/apache/maven/plugin/coreit/TouchMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-optional-mojos/src/main/java/org/apache/maven/plugin/coreit/TouchMojo.java index 96559cee96..097e691669 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-optional-mojos/src/main/java/org/apache/maven/plugin/coreit/TouchMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-optional-mojos/src/main/java/org/apache/maven/plugin/coreit/TouchMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,40 +16,33 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; +import java.io.IOException; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; -import java.io.File; -import java.io.IOException; - /** * Creates an empty file to prove this goal was executed. */ -@Mojo( name = "touch" ) -public class TouchMojo - extends AbstractMojo -{ +@Mojo(name = "touch") +public class TouchMojo extends AbstractMojo { - @Parameter( defaultValue = "${project.build.directory}/touch.txt" ) + @Parameter(defaultValue = "${project.build.directory}/touch.txt") private File touchFile; - public void execute() - throws MojoExecutionException - { - getLog().info( "[MAVEN-CORE-IT-LOG] Creating touch file: " + touchFile ); + public void execute() throws MojoExecutionException { + getLog().info("[MAVEN-CORE-IT-LOG] Creating touch file: " + touchFile); - try - { + try { touchFile.getParentFile().mkdirs(); touchFile.createNewFile(); - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Error creating touch file: " + e.getMessage(), e ); + } catch (IOException e) { + throw new MojoExecutionException("Error creating touch file: " + e.getMessage(), e); } } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-packaging/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-packaging/pom.xml index 60044e05af..2eaa6eed47 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-packaging/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-packaging/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 - maven-it-plugins org.apache.maven.its.plugins + maven-it-plugins 2.1-SNAPSHOT @@ -32,9 +30,7 @@ under the License. maven-plugin Maven IT Plugin :: Packaging - - A test plugin that defines a custom artifact handler ("it-artifact") and a new packaging type ("it-packaging"). - + A test plugin that defines a custom artifact handler ("it-artifact") and a new packaging type ("it-packaging"). 2006 diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-packaging/src/main/java/org/apache/maven/plugin/coreit/AppendMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-packaging/src/main/java/org/apache/maven/plugin/coreit/AppendMojo.java index a82e85972b..91eaa0aeba 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-packaging/src/main/java/org/apache/maven/plugin/coreit/AppendMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-packaging/src/main/java/org/apache/maven/plugin/coreit/AppendMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,61 +16,52 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugins.annotations.Mojo; -import org.apache.maven.plugins.annotations.Parameter; +package org.apache.maven.plugin.coreit; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStreamWriter; +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; + /** * Appends a message to a UTF-8 encoded plain text file. * * @author Benjamin Bentmann - */ -@Mojo( name = "append" ) -public class AppendMojo - extends AbstractMojo -{ + */ +@Mojo(name = "append") +public class AppendMojo extends AbstractMojo { /** */ - @Parameter( property = "append.message" ) + @Parameter(property = "append.message") private String message; /** */ - @Parameter( defaultValue = "${project.build.directory}/log.txt" ) + @Parameter(defaultValue = "${project.build.directory}/log.txt") private File outputFile; - public void execute() - throws MojoExecutionException - { - getLog().info( "[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile ); + public void execute() throws MojoExecutionException { + getLog().info("[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile); - try - { + try { outputFile.getParentFile().mkdirs(); - getLog().info( "[MAVEN-CORE-IT-LOG] " + message ); + getLog().info("[MAVEN-CORE-IT-LOG] " + message); - try ( OutputStreamWriter writer = new OutputStreamWriter( new FileOutputStream( outputFile, true ), - "UTF-8" ) ) - { - writer.write( message ); - writer.write( "\n" ); + try (OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(outputFile, true), "UTF-8")) { + writer.write(message); + writer.write("\n"); } - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Output file could not be created: " + outputFile, e ); + } catch (IOException e) { + throw new MojoExecutionException("Output file could not be created: " + outputFile, e); } - getLog().info( "[MAVEN-CORE-IT-LOG] Created output file: " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Created output file: " + outputFile); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-packaging/src/main/java/org/apache/maven/plugin/coreit/PackagingMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-packaging/src/main/java/org/apache/maven/plugin/coreit/PackagingMojo.java index dea39210bd..2e9842d867 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-packaging/src/main/java/org/apache/maven/plugin/coreit/PackagingMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-packaging/src/main/java/org/apache/maven/plugin/coreit/PackagingMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,51 +16,45 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; +import java.io.IOException; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; -import java.io.File; -import java.io.IOException; - /** * Creates an empty file to prove this goal was executed. * * @author Brett Porter * - */ -@Mojo( name = "package" ) -public class PackagingMojo - extends AbstractMojo -{ + */ +@Mojo(name = "package") +public class PackagingMojo extends AbstractMojo { /** */ - @Parameter( defaultValue = "${project.build.finalName}", required = true ) + @Parameter(defaultValue = "${project.build.finalName}", required = true) private String finalName; /** */ - @Parameter( defaultValue = "${project.build.directory}", required = true, readonly = true ) + @Parameter(defaultValue = "${project.build.directory}", required = true, readonly = true) private File outputDirectory; - public void execute() - throws MojoExecutionException - { - File jarFile = new File( outputDirectory, finalName + "-it.jar" ); + public void execute() throws MojoExecutionException { + File jarFile = new File(outputDirectory, finalName + "-it.jar"); - getLog().info( "[MAVEN-CORE-IT-LOG] Creating artifact file: " + jarFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Creating artifact file: " + jarFile); - try - { + try { jarFile.getParentFile().mkdirs(); jarFile.createNewFile(); - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Error assembling JAR", e ); + } catch (IOException e) { + throw new MojoExecutionException("Error assembling JAR", e); } /* @@ -70,5 +62,4 @@ public class PackagingMojo * this test plugin. Hence there's no need to introduce further coupling with the Maven Artifact API. */ } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-plexus-component-api/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-plexus-component-api/pom.xml index bcd9ab53fc..f47c464947 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-plexus-component-api/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-plexus-component-api/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 - maven-it-plugins org.apache.maven.its.plugins + maven-it-plugins 2.1-SNAPSHOT diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-plexus-component-api/src/main/java/org/apache/maven/its/plugins/VelocityMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-plexus-component-api/src/main/java/org/apache/maven/its/plugins/VelocityMojo.java index 2644bc65f7..2a926e6f42 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-plexus-component-api/src/main/java/org/apache/maven/its/plugins/VelocityMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-plexus-component-api/src/main/java/org/apache/maven/its/plugins/VelocityMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.its.plugins; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,7 @@ package org.apache.maven.its.plugins; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.its.plugins; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; @@ -28,24 +27,19 @@ import org.apache.maven.plugins.annotations.Mojo; import org.codehaus.plexus.velocity.VelocityComponent; /** - */ -@Mojo( name = "velocity", defaultPhase = LifecyclePhase.VALIDATE ) -public class VelocityMojo - extends AbstractMojo -{ + */ +@Mojo(name = "velocity", defaultPhase = LifecyclePhase.VALIDATE) +public class VelocityMojo extends AbstractMojo { /** */ @Component protected VelocityComponent velocityComponent; - public void execute() - throws MojoExecutionException, MojoFailureException - { + public void execute() throws MojoExecutionException, MojoFailureException { // velocityComponent should not be null velocityComponent.getEngine(); - try - { + try { // velocityComponent engine should not be null // this is the real test to check that we got the right Initializable interface in both Plexus and the // component @@ -53,11 +47,9 @@ public class VelocityMojo * NOTE: There's a bug in the plexus-velocity:1.1.7 component that fails to transform "/template.vm" into * a proper resource name before searching the context class loader so we avoid the leading slash here. */ - velocityComponent.getEngine().getTemplate( "template.vm" ); - } - catch ( Exception e ) - { - throw new MojoExecutionException( e.getMessage(), e ); + velocityComponent.getEngine().getTemplate("template.vm"); + } catch (Exception e) { + throw new MojoExecutionException(e.getMessage(), e); } } } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-plexus-lifecycle/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-plexus-lifecycle/pom.xml index 04d11b7ccd..c7782a8385 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-plexus-lifecycle/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-plexus-lifecycle/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 - maven-it-plugins org.apache.maven.its.plugins + maven-it-plugins 2.1-SNAPSHOT @@ -65,10 +63,10 @@ under the License. create-component-descriptor - generate-resources generate-metadata + generate-resources diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-plexus-lifecycle/src/main/java/org/apache/maven/its/plugins/plexuslifecycle/DefaultFakeComponent.java b/its/core-it-support/core-it-plugins/maven-it-plugin-plexus-lifecycle/src/main/java/org/apache/maven/its/plugins/plexuslifecycle/DefaultFakeComponent.java index 4daf109b31..49a1803c52 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-plexus-lifecycle/src/main/java/org/apache/maven/its/plugins/plexuslifecycle/DefaultFakeComponent.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-plexus-lifecycle/src/main/java/org/apache/maven/its/plugins/plexuslifecycle/DefaultFakeComponent.java @@ -1,5 +1,3 @@ -package org.apache.maven.its.plugins.plexuslifecycle; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,7 @@ package org.apache.maven.its.plugins.plexuslifecycle; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.its.plugins.plexuslifecycle; import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.context.Context; @@ -30,30 +29,23 @@ import org.codehaus.plexus.personality.plexus.lifecycle.phase.Disposable; /** * @author Olivier Lamy */ -@Component ( role = org.apache.maven.its.plugins.plexuslifecycle.FakeComponent.class ) -public class DefaultFakeComponent - implements FakeComponent, Contextualizable, Disposable, LogEnabled -{ +@Component(role = org.apache.maven.its.plugins.plexuslifecycle.FakeComponent.class) +public class DefaultFakeComponent implements FakeComponent, Contextualizable, Disposable, LogEnabled { private Logger logger; - public void enableLogging( Logger logger ) - { + public void enableLogging(Logger logger) { this.logger = logger; } - public void contextualize( Context context ) - throws ContextException - { - logger.info( "DefaultFakeComponent :: contextualize" ); + public void contextualize(Context context) throws ContextException { + logger.info("DefaultFakeComponent :: contextualize"); } - public void dispose() - { - logger.info( "DefaultFakeComponent :: dispose" ); + public void dispose() { + logger.info("DefaultFakeComponent :: dispose"); } - public void doNothing() - { - logger.info( "doNothing DefaultFakeComponent" ); + public void doNothing() { + logger.info("doNothing DefaultFakeComponent"); } } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-plexus-lifecycle/src/main/java/org/apache/maven/its/plugins/plexuslifecycle/FakeComponent.java b/its/core-it-support/core-it-plugins/maven-it-plugin-plexus-lifecycle/src/main/java/org/apache/maven/its/plugins/plexuslifecycle/FakeComponent.java index cea4bedc82..5a35e827a0 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-plexus-lifecycle/src/main/java/org/apache/maven/its/plugins/plexuslifecycle/FakeComponent.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-plexus-lifecycle/src/main/java/org/apache/maven/its/plugins/plexuslifecycle/FakeComponent.java @@ -1,5 +1,3 @@ -package org.apache.maven.its.plugins.plexuslifecycle; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,11 +16,11 @@ package org.apache.maven.its.plugins.plexuslifecycle; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.its.plugins.plexuslifecycle; /** * @author Olivier Lamy */ -public interface FakeComponent -{ +public interface FakeComponent { void doNothing(); } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-plexus-lifecycle/src/main/java/org/apache/maven/its/plugins/plexuslifecycle/MojoWithPlexusLifecycle.java b/its/core-it-support/core-it-plugins/maven-it-plugin-plexus-lifecycle/src/main/java/org/apache/maven/its/plugins/plexuslifecycle/MojoWithPlexusLifecycle.java index 73e5a85f6b..419c3955df 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-plexus-lifecycle/src/main/java/org/apache/maven/its/plugins/plexuslifecycle/MojoWithPlexusLifecycle.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-plexus-lifecycle/src/main/java/org/apache/maven/its/plugins/plexuslifecycle/MojoWithPlexusLifecycle.java @@ -1,5 +1,3 @@ -package org.apache.maven.its.plugins.plexuslifecycle; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,7 @@ package org.apache.maven.its.plugins.plexuslifecycle; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.its.plugins.plexuslifecycle; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; @@ -33,33 +32,23 @@ import org.codehaus.plexus.personality.plexus.lifecycle.phase.Disposable; /** * @author Olivier Lamy */ -@Mojo( name = "do-nothing", defaultPhase = LifecyclePhase.VALIDATE ) -public class MojoWithPlexusLifecycle - extends AbstractMojo - implements Contextualizable, Disposable -{ +@Mojo(name = "do-nothing", defaultPhase = LifecyclePhase.VALIDATE) +public class MojoWithPlexusLifecycle extends AbstractMojo implements Contextualizable, Disposable { /** */ @Component private FakeComponent fakeComponent; - public void execute() - throws MojoExecutionException, MojoFailureException - { - getLog().info( "execute MojoWithPlexusLifecycle" ); + public void execute() throws MojoExecutionException, MojoFailureException { + getLog().info("execute MojoWithPlexusLifecycle"); fakeComponent.doNothing(); } - public void dispose() - { - getLog().info( "MojoWithPlexusLifecycle :: dispose" ); + public void dispose() { + getLog().info("MojoWithPlexusLifecycle :: dispose"); } - public void contextualize( Context context ) - throws ContextException - { - getLog().info( "MojoWithPlexusLifecycle :: contextualize" ); + public void contextualize(Context context) throws ContextException { + getLog().info("MojoWithPlexusLifecycle :: contextualize"); } - - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-plexus-utils-11/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-plexus-utils-11/pom.xml index cb0317b31f..cd3a72d296 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-plexus-utils-11/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-plexus-utils-11/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 - maven-it-plugins org.apache.maven.its.plugins + maven-it-plugins 2.1-SNAPSHOT diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-plexus-utils-11/src/main/java/org/apache/maven/its/plugins/SerializeMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-plexus-utils-11/src/main/java/org/apache/maven/its/plugins/SerializeMojo.java index 10170c8f77..b16c233b87 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-plexus-utils-11/src/main/java/org/apache/maven/its/plugins/SerializeMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-plexus-utils-11/src/main/java/org/apache/maven/its/plugins/SerializeMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.its.plugins; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,7 @@ package org.apache.maven.its.plugins; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.its.plugins; import java.io.File; import java.io.FileOutputStream; @@ -37,39 +36,30 @@ import org.codehaus.plexus.util.xml.pull.MXSerializer; import org.codehaus.plexus.util.xml.pull.XmlSerializer; /** - */ -@Mojo( name = "serialize", defaultPhase = LifecyclePhase.VALIDATE ) -public class SerializeMojo - extends AbstractMojo -{ + */ +@Mojo(name = "serialize", defaultPhase = LifecyclePhase.VALIDATE) +public class SerializeMojo extends AbstractMojo { /** */ - @Parameter( defaultValue = "${project.build.directory}/serialized.xml" ) + @Parameter(defaultValue = "${project.build.directory}/serialized.xml") private File file; - public void execute() - throws MojoExecutionException, MojoFailureException - { + public void execute() throws MojoExecutionException, MojoFailureException { Writer writer = null; XmlSerializer s = new MXSerializer(); - try - { + try { file.getParentFile().mkdirs(); - writer = new OutputStreamWriter( new FileOutputStream( file ), "UTF-8" ); - s.setOutput( writer ); + writer = new OutputStreamWriter(new FileOutputStream(file), "UTF-8"); + s.setOutput(writer); - Xpp3Dom dom = new Xpp3Dom( "root" ); + Xpp3Dom dom = new Xpp3Dom("root"); - dom.writeToSerializer( "", s ); - } - catch ( IOException e ) - { - throw new MojoExecutionException( e.getMessage(), e ); - } - finally - { - IOUtil.close( writer ); + dom.writeToSerializer("", s); + } catch (IOException e) { + throw new MojoExecutionException(e.getMessage(), e); + } finally { + IOUtil.close(writer); } } } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-plexus-utils-new/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-plexus-utils-new/pom.xml index 85e0a8ebd6..a72fa36c88 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-plexus-utils-new/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-plexus-utils-new/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 - maven-it-plugins org.apache.maven.its.plugins + maven-it-plugins 2.1-SNAPSHOT diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-plexus-utils-new/src/main/java/org/apache/maven/its/plugins/SerializeMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-plexus-utils-new/src/main/java/org/apache/maven/its/plugins/SerializeMojo.java index dcb483688d..d49d09db7d 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-plexus-utils-new/src/main/java/org/apache/maven/its/plugins/SerializeMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-plexus-utils-new/src/main/java/org/apache/maven/its/plugins/SerializeMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.its.plugins; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,7 @@ package org.apache.maven.its.plugins; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.its.plugins; import java.io.File; import java.io.FileOutputStream; @@ -37,37 +36,28 @@ import org.codehaus.plexus.util.xml.pull.MXSerializer; import org.codehaus.plexus.util.xml.pull.XmlSerializer; /** - */ -@Mojo( name = "serialize", defaultPhase = LifecyclePhase.VALIDATE ) -public class SerializeMojo - extends AbstractMojo -{ + */ +@Mojo(name = "serialize", defaultPhase = LifecyclePhase.VALIDATE) +public class SerializeMojo extends AbstractMojo { - @Parameter( defaultValue = "${project.build.directory}/serialized.xml" ) + @Parameter(defaultValue = "${project.build.directory}/serialized.xml") private File file; - public void execute() - throws MojoExecutionException, MojoFailureException - { + public void execute() throws MojoExecutionException, MojoFailureException { Writer writer = null; XmlSerializer s = new MXSerializer(); - try - { + try { file.getParentFile().mkdirs(); - writer = new OutputStreamWriter( new FileOutputStream( file ), "UTF-8" ); - s.setOutput( writer ); + writer = new OutputStreamWriter(new FileOutputStream(file), "UTF-8"); + s.setOutput(writer); - Xpp3Dom dom = new Xpp3Dom( "root" ); + Xpp3Dom dom = new Xpp3Dom("root"); - dom.writeToSerializer( "", s ); - } - catch ( IOException e ) - { - throw new MojoExecutionException( e.getMessage(), e ); - } - finally - { - IOUtils.closeQuietly( writer ); + dom.writeToSerializer("", s); + } catch (IOException e) { + throw new MojoExecutionException(e.getMessage(), e); + } finally { + IOUtils.closeQuietly(writer); } } } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-plexus-utils-new/src/main/java/org/codehaus/plexus/util/xml/Xpp3Dom.java b/its/core-it-support/core-it-plugins/maven-it-plugin-plexus-utils-new/src/main/java/org/codehaus/plexus/util/xml/Xpp3Dom.java index c87c0dec93..755c74eeda 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-plexus-utils-new/src/main/java/org/codehaus/plexus/util/xml/Xpp3Dom.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-plexus-utils-new/src/main/java/org/codehaus/plexus/util/xml/Xpp3Dom.java @@ -1,5 +1,3 @@ -package org.codehaus.plexus.util.xml; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.codehaus.plexus.util.xml; * "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 + * 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 @@ -18,6 +16,7 @@ package org.codehaus.plexus.util.xml; * specific language governing permissions and limitations * under the License. */ +package org.codehaus.plexus.util.xml; import java.io.IOException; @@ -26,23 +25,18 @@ import org.codehaus.plexus.util.xml.pull.XmlSerializer; /** * */ -public class Xpp3Dom -{ +public class Xpp3Dom { private String root; - public Xpp3Dom( String root ) - { + public Xpp3Dom(String root) { this.root = root; } - public void writeToSerializer( String namespace, XmlSerializer s ) - throws IOException - { - s.startDocument( "UTF-8", Boolean.FALSE ); - s.startTag( namespace, root ); - s.endTag( namespace, root ); + public void writeToSerializer(String namespace, XmlSerializer s) throws IOException { + s.startDocument("UTF-8", Boolean.FALSE); + s.startTag(namespace, root); + s.endTag(namespace, root); s.endDocument(); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-plexus-utils-new/src/main/java/org/codehaus/plexus/util/xml/pull/MXSerializer.java b/its/core-it-support/core-it-plugins/maven-it-plugin-plexus-utils-new/src/main/java/org/codehaus/plexus/util/xml/pull/MXSerializer.java index bca0dfa083..2759ab9b25 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-plexus-utils-new/src/main/java/org/codehaus/plexus/util/xml/pull/MXSerializer.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-plexus-utils-new/src/main/java/org/codehaus/plexus/util/xml/pull/MXSerializer.java @@ -1,5 +1,3 @@ -package org.codehaus.plexus.util.xml.pull; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.codehaus.plexus.util.xml.pull; * "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 + * 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 @@ -18,6 +16,7 @@ package org.codehaus.plexus.util.xml.pull; * specific language governing permissions and limitations * under the License. */ +package org.codehaus.plexus.util.xml.pull; import java.io.IOException; import java.io.OutputStream; @@ -26,136 +25,108 @@ import java.io.Writer; /** * */ -public class MXSerializer - implements XmlSerializer -{ +public class MXSerializer implements XmlSerializer { private Writer output; - public void setOutput( Writer writer ) - { + public void setOutput(Writer writer) { output = writer; } - public XmlSerializer attribute( String namespace, String name, String value ) - { + public XmlSerializer attribute(String namespace, String name, String value) { return null; } - public void cdsect( String text ) - { + public void cdsect(String text) { // ignore } - public void comment( String text ) - { + public void comment(String text) { // ignore } - public void docdecl( String text ) - { + public void docdecl(String text) { // ignore } - public void endDocument() - { + public void endDocument() { // ignore } - public XmlSerializer endTag( String namespace, String name ) - { + public XmlSerializer endTag(String namespace, String name) { return null; } - public void entityRef( String text ) - { + public void entityRef(String text) { // ignore } - public void flush() - { + public void flush() { // ignore } - public int getDepth() - { + public int getDepth() { return 0; } - public boolean getFeature( String name ) - { + public boolean getFeature(String name) { return false; } - public String getName() - { + public String getName() { return null; } - public String getNamespace() - { + public String getNamespace() { return null; } - public String getPrefix( String namespace, boolean generatePrefix ) - { + public String getPrefix(String namespace, boolean generatePrefix) { return null; } - public Object getProperty( String name ) - { + public Object getProperty(String name) { return null; } - public void ignorableWhitespace( String text ) - { + public void ignorableWhitespace(String text) { // ignore } - public void processingInstruction( String text ) - { + public void processingInstruction(String text) { // ignore } - public void setFeature( String name, boolean state ) - { + public void setFeature(String name, boolean state) { // ignore } - public void setOutput( OutputStream os, String encoding ) - { + public void setOutput(OutputStream os, String encoding) { // ignore } - public void setPrefix( String prefix, String namespace ) - { + public void setPrefix(String prefix, String namespace) { // ignore } - public void setProperty( String name, Object value ) - { + public void setProperty(String name, Object value) { // ignore } - public void startDocument( String encoding, Boolean standalone ) - { + public void startDocument(String encoding, Boolean standalone) { // ignore } - public XmlSerializer startTag( String namespace, String name ) - throws IOException - { - output.write( name ); + public XmlSerializer startTag(String namespace, String name) throws IOException { + output.write(name); return this; } - public XmlSerializer text( String text ) - { + public XmlSerializer text(String text) { return null; } - public XmlSerializer text( char[] buf, int start, int len ) - { + public XmlSerializer text(char[] buf, int start, int len) { return null; } } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-plexus-utils-new/src/main/java/org/codehaus/plexus/util/xml/pull/XmlSerializer.java b/its/core-it-support/core-it-plugins/maven-it-plugin-plexus-utils-new/src/main/java/org/codehaus/plexus/util/xml/pull/XmlSerializer.java index 3de35068e6..f7e2472023 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-plexus-utils-new/src/main/java/org/codehaus/plexus/util/xml/pull/XmlSerializer.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-plexus-utils-new/src/main/java/org/codehaus/plexus/util/xml/pull/XmlSerializer.java @@ -1,5 +1,3 @@ -package org.codehaus.plexus.util.xml.pull; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.codehaus.plexus.util.xml.pull; * "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 + * 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 @@ -18,6 +16,7 @@ package org.codehaus.plexus.util.xml.pull; * specific language governing permissions and limitations * under the License. */ +package org.codehaus.plexus.util.xml.pull; import java.io.IOException; import java.io.OutputStream; @@ -26,36 +25,29 @@ import java.io.Writer; /** * */ -public interface XmlSerializer -{ +public interface XmlSerializer { - void setFeature( String name, boolean state ) - throws IllegalArgumentException, IllegalStateException; + void setFeature(String name, boolean state) throws IllegalArgumentException, IllegalStateException; - boolean getFeature( String name ); + boolean getFeature(String name); - void setProperty( String name, Object value ) - throws IllegalArgumentException, IllegalStateException; + void setProperty(String name, Object value) throws IllegalArgumentException, IllegalStateException; - Object getProperty( String name ); + Object getProperty(String name); - void setOutput( OutputStream os, String encoding ) - throws IOException, IllegalArgumentException, IllegalStateException; + void setOutput(OutputStream os, String encoding) + throws IOException, IllegalArgumentException, IllegalStateException; - void setOutput( Writer writer ) - throws IOException, IllegalArgumentException, IllegalStateException; + void setOutput(Writer writer) throws IOException, IllegalArgumentException, IllegalStateException; - void startDocument( String encoding, Boolean standalone ) - throws IOException, IllegalArgumentException, IllegalStateException; + void startDocument(String encoding, Boolean standalone) + throws IOException, IllegalArgumentException, IllegalStateException; - void endDocument() - throws IOException, IllegalArgumentException, IllegalStateException; + void endDocument() throws IOException, IllegalArgumentException, IllegalStateException; - void setPrefix( String prefix, String namespace ) - throws IOException, IllegalArgumentException, IllegalStateException; + void setPrefix(String prefix, String namespace) throws IOException, IllegalArgumentException, IllegalStateException; - String getPrefix( String namespace, boolean generatePrefix ) - throws IllegalArgumentException; + String getPrefix(String namespace, boolean generatePrefix) throws IllegalArgumentException; int getDepth(); @@ -63,39 +55,31 @@ public interface XmlSerializer String getName(); - XmlSerializer startTag( String namespace, String name ) - throws IOException, IllegalArgumentException, IllegalStateException; + XmlSerializer startTag(String namespace, String name) + throws IOException, IllegalArgumentException, IllegalStateException; - XmlSerializer attribute( String namespace, String name, String value ) - throws IOException, IllegalArgumentException, IllegalStateException; + XmlSerializer attribute(String namespace, String name, String value) + throws IOException, IllegalArgumentException, IllegalStateException; - XmlSerializer endTag( String namespace, String name ) - throws IOException, IllegalArgumentException, IllegalStateException; + XmlSerializer endTag(String namespace, String name) + throws IOException, IllegalArgumentException, IllegalStateException; - XmlSerializer text( String text ) - throws IOException, IllegalArgumentException, IllegalStateException; + XmlSerializer text(String text) throws IOException, IllegalArgumentException, IllegalStateException; - XmlSerializer text( char[] buf, int start, int len ) - throws IOException, IllegalArgumentException, IllegalStateException; + XmlSerializer text(char[] buf, int start, int len) + throws IOException, IllegalArgumentException, IllegalStateException; - void cdsect( String text ) - throws IOException, IllegalArgumentException, IllegalStateException; + void cdsect(String text) throws IOException, IllegalArgumentException, IllegalStateException; - void entityRef( String text ) - throws IOException, IllegalArgumentException, IllegalStateException; + void entityRef(String text) throws IOException, IllegalArgumentException, IllegalStateException; - void processingInstruction( String text ) - throws IOException, IllegalArgumentException, IllegalStateException; + void processingInstruction(String text) throws IOException, IllegalArgumentException, IllegalStateException; - void comment( String text ) - throws IOException, IllegalArgumentException, IllegalStateException; + void comment(String text) throws IOException, IllegalArgumentException, IllegalStateException; - void docdecl( String text ) - throws IOException, IllegalArgumentException, IllegalStateException; + void docdecl(String text) throws IOException, IllegalArgumentException, IllegalStateException; - void ignorableWhitespace( String text ) - throws IOException, IllegalArgumentException, IllegalStateException; + void ignorableWhitespace(String text) throws IOException, IllegalArgumentException, IllegalStateException; - void flush() - throws IOException; + void flush() throws IOException; } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-plugin-dependency/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-plugin-dependency/pom.xml index 5c64ef5bf3..e5598cb58a 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-plugin-dependency/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-plugin-dependency/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 - maven-it-plugins org.apache.maven.its.plugins + maven-it-plugins 2.1-SNAPSHOT @@ -57,4 +55,3 @@ under the License. - diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-plugin-dependency/src/main/java/org/apache/maven/plugin/coreit/DerivedItMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-plugin-dependency/src/main/java/org/apache/maven/plugin/coreit/DerivedItMojo.java index 8b348035f5..f0ab90b16b 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-plugin-dependency/src/main/java/org/apache/maven/plugin/coreit/DerivedItMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-plugin-dependency/src/main/java/org/apache/maven/plugin/coreit/DerivedItMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,9 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; @@ -25,14 +26,10 @@ import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; -import java.io.File; - /** - */ -@Mojo( name = "test", defaultPhase = LifecyclePhase.PROCESS_SOURCES ) -public class DerivedItMojo - extends EvalMojo -{ + */ +@Mojo(name = "test", defaultPhase = LifecyclePhase.PROCESS_SOURCES) +public class DerivedItMojo extends EvalMojo { /** * The path to the output file for the properties with the expression values. For each expression given by the * parameter {@link #expressions}, a similar named properties key will be used to save the expression value. If an @@ -41,15 +38,11 @@ public class DerivedItMojo @Parameter private File file; - public void execute() - throws MojoFailureException, MojoExecutionException - { - if ( file != null ) - { - super.setOutputFile( file ); + public void execute() throws MojoFailureException, MojoExecutionException { + if (file != null) { + super.setOutputFile(file); } super.execute(); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-project-interpolation/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-project-interpolation/pom.xml index c2994ed03c..32a6a516d0 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-project-interpolation/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-project-interpolation/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 - maven-it-plugins org.apache.maven.its.plugins + maven-it-plugins 2.1-SNAPSHOT diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-project-interpolation/src/main/java/org/apache/maven/plugin/coreit/PluginParamInterpolationMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-project-interpolation/src/main/java/org/apache/maven/plugin/coreit/PluginParamInterpolationMojo.java index baef8095c6..a525910caa 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-project-interpolation/src/main/java/org/apache/maven/plugin/coreit/PluginParamInterpolationMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-project-interpolation/src/main/java/org/apache/maven/plugin/coreit/PluginParamInterpolationMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; import java.io.File; @@ -31,10 +30,8 @@ import org.apache.maven.project.MavenProject; /** * */ -@Mojo( name = "check-plugin", defaultPhase = LifecyclePhase.VALIDATE ) -public class PluginParamInterpolationMojo - extends AbstractMojo -{ +@Mojo(name = "check-plugin", defaultPhase = LifecyclePhase.VALIDATE) +public class PluginParamInterpolationMojo extends AbstractMojo { /** * myDirectory */ @@ -44,25 +41,22 @@ public class PluginParamInterpolationMojo /** * The current Maven project. */ - @Parameter( defaultValue = "${project}" ) + @Parameter(defaultValue = "${project}") private MavenProject project; - public void execute() - throws MojoExecutionException - { - myDirectory = normalize( myDirectory ); - String value = normalize( new File( project.getBuild().getDirectory(), "foo" ).getAbsolutePath() ); + public void execute() throws MojoExecutionException { + myDirectory = normalize(myDirectory); + String value = normalize(new File(project.getBuild().getDirectory(), "foo").getAbsolutePath()); - if ( !myDirectory.equals( value ) ) - { - throw new MojoExecutionException( "Directory supplied: " + myDirectory - + " is not the same as the project build directory: " + project.getBuild().getDirectory() - + " + '/foo'" ); + if (!myDirectory.equals(value)) { + throw new MojoExecutionException("Directory supplied: " + myDirectory + + " is not the same as the project build directory: " + + project.getBuild().getDirectory() + + " + '/foo'"); } } - private String normalize( String src ) - { - return src.replace( '/', File.separatorChar ).replace( '\\', File.separatorChar ); + private String normalize(String src) { + return src.replace('/', File.separatorChar).replace('\\', File.separatorChar); } } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-project-interpolation/src/main/java/org/apache/maven/plugin/coreit/PropertyInterpolationMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-project-interpolation/src/main/java/org/apache/maven/plugin/coreit/PropertyInterpolationMojo.java index 071820dd12..ae9ee2f03b 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-project-interpolation/src/main/java/org/apache/maven/plugin/coreit/PropertyInterpolationMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-project-interpolation/src/main/java/org/apache/maven/plugin/coreit/PropertyInterpolationMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; import java.io.File; @@ -31,32 +30,26 @@ import org.apache.maven.project.MavenProject; * * @phase validate */ -@Mojo( name = "check-property" ) -public class PropertyInterpolationMojo - extends AbstractMojo -{ +@Mojo(name = "check-property") +public class PropertyInterpolationMojo extends AbstractMojo { /** * The current Maven project. */ - @Parameter( defaultValue = "${project}" ) + @Parameter(defaultValue = "${project}") private MavenProject project; - public void execute() - throws MojoExecutionException - { - String value = normalize( project.getProperties().getProperty( "myDirectory" ) ); - String targetValue = normalize( new File( project.getBuild().getDirectory(), "foo" ).getAbsolutePath() ); + public void execute() throws MojoExecutionException { + String value = normalize(project.getProperties().getProperty("myDirectory")); + String targetValue = normalize(new File(project.getBuild().getDirectory(), "foo").getAbsolutePath()); - if ( !value.equals( targetValue ) ) - { - throw new MojoExecutionException( "Property value of 'myDirectory': " + value - + " should equal the 'foo' subpath of the project build directory: " + targetValue ); + if (!value.equals(targetValue)) { + throw new MojoExecutionException("Property value of 'myDirectory': " + value + + " should equal the 'foo' subpath of the project build directory: " + targetValue); } } - private String normalize( String src ) - { - return src.replace( '/', File.separatorChar ).replace( '\\', File.separatorChar ); + private String normalize(String src) { + return src.replace('/', File.separatorChar).replace('\\', File.separatorChar); } } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-project-interpolation/src/main/java/org/apache/maven/plugin/coreit/PropertyInterpolationVerifierMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-project-interpolation/src/main/java/org/apache/maven/plugin/coreit/PropertyInterpolationVerifierMojo.java index 5f69edce41..8e59681485 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-project-interpolation/src/main/java/org/apache/maven/plugin/coreit/PropertyInterpolationVerifierMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-project-interpolation/src/main/java/org/apache/maven/plugin/coreit/PropertyInterpolationVerifierMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,10 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.util.Enumeration; +import java.util.Properties; import org.apache.maven.model.Model; import org.apache.maven.plugin.AbstractMojo; @@ -28,53 +30,42 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; -import java.util.Enumeration; -import java.util.Properties; - /** - */ -@Mojo( name = "verify-property", defaultPhase = LifecyclePhase.VALIDATE ) -public class PropertyInterpolationVerifierMojo - extends AbstractMojo -{ + */ +@Mojo(name = "verify-property", defaultPhase = LifecyclePhase.VALIDATE) +public class PropertyInterpolationVerifierMojo extends AbstractMojo { /** * The current Maven project. */ - @Parameter( defaultValue = "${project}" ) + @Parameter(defaultValue = "${project}") private MavenProject project; /** * The properties. */ - @Parameter( property = "clsldr.pluginClassLoaderOutput" ) + @Parameter(property = "clsldr.pluginClassLoaderOutput") private Properties properties; - public void execute() - throws MojoExecutionException, MojoFailureException - { + public void execute() throws MojoExecutionException, MojoFailureException { Model model = project.getModel(); - if ( properties == null ) - { + if (properties == null) { return; } Enumeration e = properties.propertyNames(); - while ( e.hasMoreElements() ) - { + while (e.hasMoreElements()) { String name = (String) e.nextElement(); - String value = properties.getProperty( name ); - if ( !value.equals( model.getProperties().getProperty( name ) ) ) - { - throw new MojoExecutionException( "Properties do not match: Name = " + name + ", Value = " + value ); + String value = properties.getProperty(name); + if (!value.equals(model.getProperties().getProperty(name))) { + throw new MojoExecutionException("Properties do not match: Name = " + name + ", Value = " + value); } - if ( value.contains( "${" ) ) - { - throw new MojoExecutionException( "Unresolved value: Name = " + name + ", Value = " + value ); + if (value.contains("${")) { + throw new MojoExecutionException("Unresolved value: Name = " + name + ", Value = " + value); } - getLog().info( "Property match: Name = " + name + ", Value = " + value ); + getLog().info("Property match: Name = " + name + ", Value = " + value); } } } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-project/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-project/pom.xml index 8d5fdefad0..0c077683a9 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-project/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-project/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 - maven-it-plugins org.apache.maven.its.plugins + maven-it-plugins 2.1-SNAPSHOT @@ -32,9 +30,7 @@ under the License. maven-plugin Maven IT Plugin :: Project - - A test plugin that can build Maven project instances from local/remote POMs. - + A test plugin that can build Maven project instances from local/remote POMs. 2010 diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-project/src/main/java/org/apache/maven/plugin/coreit/AbstractPomMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-project/src/main/java/org/apache/maven/plugin/coreit/AbstractPomMojo.java index 1b0ad340ed..2c7c204140 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-project/src/main/java/org/apache/maven/plugin/coreit/AbstractPomMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-project/src/main/java/org/apache/maven/plugin/coreit/AbstractPomMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,12 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.Properties; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; @@ -25,17 +29,10 @@ import org.apache.maven.plugins.annotations.Component; import org.apache.maven.project.MavenProject; import org.apache.maven.project.MavenProjectBuilder; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.Properties; - /** * @author Benjamin Bentmann */ -public abstract class AbstractPomMojo - extends AbstractMojo -{ +public abstract class AbstractPomMojo extends AbstractMojo { /** * The project builder. @@ -43,41 +40,30 @@ public abstract class AbstractPomMojo @Component protected MavenProjectBuilder builder; - protected void dump( Properties props, String key, MavenProject project ) - { - put( props, key + "project.id", project.getId() ); - put( props, key + "project.name", project.getName() ); - put( props, key + "project.description", project.getDescription() ); - if ( project.getArtifact() != null ) - { - put( props, key + "artifact.id", project.getArtifact().getId() ); + protected void dump(Properties props, String key, MavenProject project) { + put(props, key + "project.id", project.getId()); + put(props, key + "project.name", project.getName()); + put(props, key + "project.description", project.getDescription()); + if (project.getArtifact() != null) { + put(props, key + "artifact.id", project.getArtifact().getId()); } } - protected void put( Properties props, String key, Object value ) - { - if ( value != null ) - { - props.setProperty( key, value.toString() ); + protected void put(Properties props, String key, Object value) { + if (value != null) { + props.setProperty(key, value.toString()); } } - protected void store( Properties props, File file ) - throws MojoExecutionException - { - try - { + protected void store(Properties props, File file) throws MojoExecutionException { + try { file.getParentFile().mkdirs(); - try ( FileOutputStream os = new FileOutputStream( file ) ) - { - props.store( os, "[MAVEN-CORE-IT-LOG]" ); + try (FileOutputStream os = new FileOutputStream(file)) { + props.store(os, "[MAVEN-CORE-IT-LOG]"); } - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Failed to dump POMs: " + e.getMessage(), e ); + } catch (IOException e) { + throw new MojoExecutionException("Failed to dump POMs: " + e.getMessage(), e); } } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-project/src/main/java/org/apache/maven/plugin/coreit/BuildLocalPomMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-project/src/main/java/org/apache/maven/plugin/coreit/BuildLocalPomMojo.java index 2aac41caca..4eaeb13fa9 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-project/src/main/java/org/apache/maven/plugin/coreit/BuildLocalPomMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-project/src/main/java/org/apache/maven/plugin/coreit/BuildLocalPomMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,10 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; +import java.util.Properties; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.plugin.MojoExecutionException; @@ -25,29 +27,24 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; -import java.io.File; -import java.util.Properties; - /** * Builds the local POMs. * * @author Benjamin Bentmann - */ -@Mojo( name = "local-pom" ) -public class BuildLocalPomMojo - extends AbstractPomMojo -{ + */ +@Mojo(name = "local-pom") +public class BuildLocalPomMojo extends AbstractPomMojo { /** * The properties file to dump the POM info to. */ - @Parameter( defaultValue = "target/pom.properties" ) + @Parameter(defaultValue = "target/pom.properties") private File propertiesFile; /** * The local repository. */ - @Parameter( defaultValue = "${localRepository}", readonly = true, required = true ) + @Parameter(defaultValue = "${localRepository}", readonly = true, required = true) private ArtifactRepository localRepository; /** @@ -62,33 +59,25 @@ public class BuildLocalPomMojo * * @throws MojoExecutionException If the artifact file has not been set. */ - public void execute() - throws MojoExecutionException - { + public void execute() throws MojoExecutionException { Properties props = new Properties(); - getLog().info( "[MAVEN-CORE-IT-LOG] Building local POMs" ); + getLog().info("[MAVEN-CORE-IT-LOG] Building local POMs"); - if ( files != null ) - { - for ( File file : files ) - { - getLog().info( "[MAVEN-CORE-IT-LOG] Building " + file ); + if (files != null) { + for (File file : files) { + getLog().info("[MAVEN-CORE-IT-LOG] Building " + file); - try - { - MavenProject project = builder.build( file, localRepository, null ); + try { + MavenProject project = builder.build(file, localRepository, null); - dump( props, file.getName() + ".", project ); - } - catch ( Exception e ) - { - getLog().warn( "Failed to build local POM for " + file, e ); + dump(props, file.getName() + ".", project); + } catch (Exception e) { + getLog().warn("Failed to build local POM for " + file, e); } } } - store( props, propertiesFile ); + store(props, propertiesFile); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-project/src/main/java/org/apache/maven/plugin/coreit/BuildRemotePomMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-project/src/main/java/org/apache/maven/plugin/coreit/BuildRemotePomMojo.java index a7da046b1f..ed9a10e4dd 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-project/src/main/java/org/apache/maven/plugin/coreit/BuildRemotePomMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-project/src/main/java/org/apache/maven/plugin/coreit/BuildRemotePomMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,11 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; +import java.util.List; +import java.util.Properties; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.factory.ArtifactFactory; @@ -29,37 +32,31 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; -import java.io.File; -import java.util.List; -import java.util.Properties; - /** * Builds the remote POMs of user-specified artifacts. This mimics in part the Maven Remote Resources Plugin. * * @author Benjamin Bentmann * - */ -@Mojo( name = "remote-pom" ) -public class BuildRemotePomMojo - extends AbstractPomMojo -{ + */ +@Mojo(name = "remote-pom") +public class BuildRemotePomMojo extends AbstractPomMojo { /** * The properties file to dump the POM info to. */ - @Parameter( defaultValue = "target/pom.properties" ) + @Parameter(defaultValue = "target/pom.properties") private File propertiesFile; /** * The local repository. */ - @Parameter( defaultValue = "${localRepository}", readonly = true, required = true ) + @Parameter(defaultValue = "${localRepository}", readonly = true, required = true) private ArtifactRepository localRepository; /** * The remote repositories of the current Maven project. */ - @Parameter( defaultValue = "${project.remoteArtifactRepositories}", readonly = true, required = true ) + @Parameter(defaultValue = "${project.remoteArtifactRepositories}", readonly = true, required = true) private List remoteRepositories; /** @@ -81,43 +78,37 @@ public class BuildRemotePomMojo * * @throws MojoExecutionException If the artifact file has not been set. */ - public void execute() - throws MojoExecutionException - { + public void execute() throws MojoExecutionException { Properties props = new Properties(); - getLog().info( "[MAVEN-CORE-IT-LOG] Building remote POMs" ); + getLog().info("[MAVEN-CORE-IT-LOG] Building remote POMs"); - if ( dependencies != null ) - { - for ( Dependency dependency : dependencies ) - { - Artifact artifact = - factory.createArtifactWithClassifier( dependency.getGroupId(), dependency.getArtifactId(), - dependency.getVersion(), dependency.getType(), - dependency.getClassifier() ); + if (dependencies != null) { + for (Dependency dependency : dependencies) { + Artifact artifact = factory.createArtifactWithClassifier( + dependency.getGroupId(), + dependency.getArtifactId(), + dependency.getVersion(), + dependency.getType(), + dependency.getClassifier()); String id = artifact.getId(); - getLog().info( "[MAVEN-CORE-IT-LOG] Building " + id ); + getLog().info("[MAVEN-CORE-IT-LOG] Building " + id); - try - { - MavenProject project = builder.buildFromRepository( artifact, remoteRepositories, localRepository ); + try { + MavenProject project = builder.buildFromRepository(artifact, remoteRepositories, localRepository); - dump( props, id + ".", project ); - } - catch ( Exception e ) - { - getLog().warn( "Failed to build remote POM for " + artifact.getId(), e ); + dump(props, id + ".", project); + } catch (Exception e) { + getLog().warn("Failed to build remote POM for " + artifact.getId(), e); } - put( props, id + ".file", artifact.getFile() ); - put( props, id + ".version", artifact.getVersion() ); + put(props, id + ".file", artifact.getFile()); + put(props, id + ".version", artifact.getVersion()); } } - store( props, propertiesFile ); + store(props, propertiesFile); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-setter/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-setter/pom.xml index 97f7fa31ba..bf5c5f468d 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-setter/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-setter/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 - maven-it-plugins org.apache.maven.its.plugins + maven-it-plugins 2.1-SNAPSHOT maven-it-plugin-setter - Plugin to check that attribute injection through setter method - (instead of direct parameter injection) works. maven-plugin Maven IT Plugin :: Setter + Plugin to check that attribute injection through setter method + (instead of direct parameter injection) works. 2006 diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-setter/src/main/java/org/apache/maven/plugin/coreit/CoreItMojoWithSetters.java b/its/core-it-support/core-it-plugins/maven-it-plugin-setter/src/main/java/org/apache/maven/plugin/coreit/CoreItMojoWithSetters.java index 48f14aaca8..9afca4bac1 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-setter/src/main/java/org/apache/maven/plugin/coreit/CoreItMojoWithSetters.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-setter/src/main/java/org/apache/maven/plugin/coreit/CoreItMojoWithSetters.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,29 +16,28 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; - /** * Mojo to check that attribute injection through setter method (instead of direct parameter injection) works. */ -@Mojo( name = "setter-touch" ) -public class CoreItMojoWithSetters - extends AbstractMojo -{ - @Parameter( defaultValue = "${project.build.directory}", required = true ) +@Mojo(name = "setter-touch") +public class CoreItMojoWithSetters extends AbstractMojo { + @Parameter(defaultValue = "${project.build.directory}", required = true) private String outputDirectoryValue; /** */ - @Parameter( name = "foo" ) + @Parameter(name = "foo") private String fooValue; /** @@ -52,17 +49,15 @@ public class CoreItMojoWithSetters // Setters // ---------------------------------------------------------------------- - public void setOutputDirectory( String outputDirectory ) - { + public void setOutputDirectory(String outputDirectory) { this.outputDirectoryValue = outputDirectory; } boolean setFooSetterExecuted; - public void setFoo( String fooValue ) - { + public void setFoo(String fooValue) { - getLog().info( "setFoo: " + fooValue ); + getLog().info("setFoo: " + fooValue); this.fooValue = fooValue; @@ -71,10 +66,9 @@ public class CoreItMojoWithSetters boolean setBarSetterExecuted; - public void setBar( String barValue ) - { + public void setBar(String barValue) { - getLog().info( "setBar: " + barValue ); + getLog().info("setBar: " + barValue); this.bar = barValue + ".baz"; @@ -85,56 +79,45 @@ public class CoreItMojoWithSetters // // ---------------------------------------------------------------------- + public void execute() throws MojoExecutionException { + touch(new File(outputDirectoryValue), "touch.txt"); - public void execute() - throws MojoExecutionException - { - touch( new File( outputDirectoryValue ), "touch.txt" ); - - File outDir = new File( outputDirectoryValue ); + File outDir = new File(outputDirectoryValue); // Test parameter setting - if ( fooValue != null && setFooSetterExecuted ) - { + if (fooValue != null && setFooSetterExecuted) { - getLog().info( "fooValue != null && setFooSetterExecuted" ); + getLog().info("fooValue != null && setFooSetterExecuted"); - touch( outDir, fooValue ); + touch(outDir, fooValue); } - if ( bar != null && setBarSetterExecuted ) - { + if (bar != null && setBarSetterExecuted) { - getLog().info( "bar != null && setBarSetterExecuted" ); + getLog().info("bar != null && setBarSetterExecuted"); - touch( outDir, bar ); + touch(outDir, bar); } } - private void touch( File dir, String file ) - throws MojoExecutionException - { + private void touch(File dir, String file) throws MojoExecutionException { - getLog().info( "touch: " + dir.getPath() + ":" + file ); + getLog().info("touch: " + dir.getPath() + ":" + file); - try - { - if ( !dir.exists() ) - { - dir.mkdirs(); - } + try { + if (!dir.exists()) { + dir.mkdirs(); + } - File touch = new File( dir, file ); + File touch = new File(dir, file); - FileWriter w = new FileWriter( touch ); + FileWriter w = new FileWriter(touch); - w.write( file ); + w.write(file); - w.close(); - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Error touching file", e ); + w.close(); + } catch (IOException e) { + throw new MojoExecutionException("Error touching file", e); } } } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-settings/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-settings/pom.xml index 18b0a4492d..dbc0c6bfc1 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-settings/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-settings/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 - maven-it-plugins org.apache.maven.its.plugins + maven-it-plugins 2.1-SNAPSHOT @@ -32,9 +30,7 @@ under the License. maven-plugin Maven IT Plugin :: Settings - - A test plugin that dumps settings. - + A test plugin that dumps settings. 2012 diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-settings/src/main/java/org/apache/maven/plugin/coreit/SettingsReadItMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-settings/src/main/java/org/apache/maven/plugin/coreit/SettingsReadItMojo.java index 5f55e70dd7..7992b0bea4 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-settings/src/main/java/org/apache/maven/plugin/coreit/SettingsReadItMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-settings/src/main/java/org/apache/maven/plugin/coreit/SettingsReadItMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,11 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; @@ -27,40 +30,28 @@ import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.settings.Settings; import org.apache.maven.settings.io.xpp3.SettingsXpp3Writer; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; - /** * Goal which read settings and dump it to a file * - */ -@Mojo( name = "settings-read", defaultPhase = LifecyclePhase.VALIDATE ) -public class SettingsReadItMojo - extends AbstractMojo -{ - @Parameter( defaultValue = "${settings}", required = true, readonly = true ) + */ +@Mojo(name = "settings-read", defaultPhase = LifecyclePhase.VALIDATE) +public class SettingsReadItMojo extends AbstractMojo { + @Parameter(defaultValue = "${settings}", required = true, readonly = true) private Settings settings; - @Parameter( defaultValue = "target/settings-dump.xml", required = true ) + @Parameter(defaultValue = "target/settings-dump.xml", required = true) private File dumpFile; - public void execute() - throws MojoExecutionException - { - if ( dumpFile.exists() ) - { + public void execute() throws MojoExecutionException { + if (dumpFile.exists()) { dumpFile.delete(); } dumpFile.getParentFile().mkdirs(); - try ( FileWriter fw = new FileWriter( dumpFile ) ) - { + try (FileWriter fw = new FileWriter(dumpFile)) { SettingsXpp3Writer writer = new SettingsXpp3Writer(); - writer.write( fw, settings ); - } - catch ( IOException e ) - { - throw new MojoExecutionException( e.getMessage(), e ); + writer.write(fw, settings); + } catch (IOException e) { + throw new MojoExecutionException(e.getMessage(), e); } } } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-singleton-component/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-singleton-component/pom.xml index 0c79f3a243..525cba8f1b 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-singleton-component/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-singleton-component/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 - maven-it-plugins org.apache.maven.its.plugins + maven-it-plugins 2.1-SNAPSHOT @@ -32,9 +30,7 @@ under the License. maven-plugin Maven IT Plugin :: Singleton Component - - A test plugin to check that the lookup of a singleton component works reliably. - + A test plugin to check that the lookup of a singleton component works reliably. 2009 diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-singleton-component/src/main/java/org/apache/maven/plugin/coreit/DefaultComponent.java b/its/core-it-support/core-it-plugins/maven-it-plugin-singleton-component/src/main/java/org/apache/maven/plugin/coreit/DefaultComponent.java index 1b790ff335..833c7a1c62 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-singleton-component/src/main/java/org/apache/maven/plugin/coreit/DefaultComponent.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-singleton-component/src/main/java/org/apache/maven/plugin/coreit/DefaultComponent.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; import org.codehaus.plexus.component.annotations.Component; @@ -26,21 +25,16 @@ import org.codehaus.plexus.component.annotations.Component; * * @author Benjamin Bentmann */ -@Component ( role = TestComponent.class ) -public class DefaultComponent - implements TestComponent -{ +@Component(role = TestComponent.class) +public class DefaultComponent implements TestComponent { private final String id; - public DefaultComponent() - { - id = Integer.toString( System.identityHashCode( this ) ); + public DefaultComponent() { + id = Integer.toString(System.identityHashCode(this)); } - public String getId() - { + public String getId() { return id; } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-singleton-component/src/main/java/org/apache/maven/plugin/coreit/ItMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-singleton-component/src/main/java/org/apache/maven/plugin/coreit/ItMojo.java index 95832f9d60..b3013ffc00 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-singleton-component/src/main/java/org/apache/maven/plugin/coreit/ItMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-singleton-component/src/main/java/org/apache/maven/plugin/coreit/ItMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,13 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugins.annotations.Component; -import org.apache.maven.plugins.annotations.LifecyclePhase; -import org.apache.maven.plugins.annotations.Mojo; -import org.apache.maven.plugins.annotations.Parameter; +package org.apache.maven.plugin.coreit; import java.io.File; import java.io.FileOutputStream; @@ -33,21 +25,26 @@ import java.util.List; import java.util.Map; import java.util.Properties; +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugins.annotations.Component; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; + /** * Requires a singleton component in various ways and dumps the ids to a properties file. * * @author Benjamin Bentmann * - */ -@Mojo( name = "it", defaultPhase = LifecyclePhase.INITIALIZE ) -public class ItMojo - extends AbstractMojo -{ + */ +@Mojo(name = "it", defaultPhase = LifecyclePhase.INITIALIZE) +public class ItMojo extends AbstractMojo { /** * The path to the output file. */ - @Parameter( property = "touch.outputFile", defaultValue = "target/comp.properties" ) + @Parameter(property = "touch.outputFile", defaultValue = "target/comp.properties") private File outputFile; /** @@ -60,7 +57,7 @@ public class ItMojo /** * Component lookup with explicit role hint. */ - @Component( hint = "default" ) + @Component(hint = "default") private TestComponent componentWithRoleHint; /** @@ -80,39 +77,34 @@ public class ItMojo * * @throws MojoExecutionException If the output file could not be created. */ - public void execute() - throws MojoExecutionException - { - TestComponent componentFromMap = (TestComponent) componentMap.values().iterator().next(); - TestComponent componentFromList = (TestComponent) componentList.iterator().next(); + public void execute() throws MojoExecutionException { + TestComponent componentFromMap = + (TestComponent) componentMap.values().iterator().next(); + TestComponent componentFromList = + (TestComponent) componentList.iterator().next(); - getLog().info( "[MAVEN-CORE-IT-LOG] Using component: " + componentWithoutRoleHint ); - getLog().info( "[MAVEN-CORE-IT-LOG] Using component: " + componentWithRoleHint ); - getLog().info( "[MAVEN-CORE-IT-LOG] Using component: " + componentFromMap ); - getLog().info( "[MAVEN-CORE-IT-LOG] Using component: " + componentFromList ); + getLog().info("[MAVEN-CORE-IT-LOG] Using component: " + componentWithoutRoleHint); + getLog().info("[MAVEN-CORE-IT-LOG] Using component: " + componentWithRoleHint); + getLog().info("[MAVEN-CORE-IT-LOG] Using component: " + componentFromMap); + getLog().info("[MAVEN-CORE-IT-LOG] Using component: " + componentFromList); Properties props = new Properties(); - props.setProperty( "id.0", componentWithoutRoleHint.getId() ); - props.setProperty( "id.1", componentWithRoleHint.getId() ); - props.setProperty( "id.2", componentFromMap.getId() ); - props.setProperty( "id.3", componentFromList.getId() ); + props.setProperty("id.0", componentWithoutRoleHint.getId()); + props.setProperty("id.1", componentWithRoleHint.getId()); + props.setProperty("id.2", componentFromMap.getId()); + props.setProperty("id.3", componentFromList.getId()); - getLog().info( "[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile); - try - { + try { outputFile.getParentFile().mkdirs(); - try ( FileOutputStream os = new FileOutputStream( outputFile ) ) - { - props.store( os, "MAVEN-CORE-IT-LOG" ); + try (FileOutputStream os = new FileOutputStream(outputFile)) { + props.store(os, "MAVEN-CORE-IT-LOG"); } - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Output file could not be created: " + outputFile, e ); + } catch (IOException e) { + throw new MojoExecutionException("Output file could not be created: " + outputFile, e); } - getLog().info( "[MAVEN-CORE-IT-LOG] Created output file: " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Created output file: " + outputFile); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-singleton-component/src/main/java/org/apache/maven/plugin/coreit/TestComponent.java b/its/core-it-support/core-it-plugins/maven-it-plugin-singleton-component/src/main/java/org/apache/maven/plugin/coreit/TestComponent.java index de3256fad5..6a83a888a3 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-singleton-component/src/main/java/org/apache/maven/plugin/coreit/TestComponent.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-singleton-component/src/main/java/org/apache/maven/plugin/coreit/TestComponent.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,15 +16,14 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; /** * A dummy component. * * @author Benjamin Bentmann */ -public interface TestComponent -{ +public interface TestComponent { String getId(); - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-site/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-site/pom.xml index d44f828be9..7ffc7eef34 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-site/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-site/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 - maven-it-plugins org.apache.maven.its.plugins + maven-it-plugins 2.1-SNAPSHOT @@ -32,9 +30,7 @@ under the License. maven-plugin Maven IT Plugin :: Site - - A test plugin that works with reports. - + A test plugin that works with reports. 2008 diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-site/src/main/java/org/apache/maven/plugin/coreit/GenerateMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-site/src/main/java/org/apache/maven/plugin/coreit/GenerateMojo.java index 25f6a56d2a..9e237e211f 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-site/src/main/java/org/apache/maven/plugin/coreit/GenerateMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-site/src/main/java/org/apache/maven/plugin/coreit/GenerateMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,14 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Method; +import java.lang.reflect.Proxy; +import java.util.List; +import java.util.Locale; import org.apache.maven.doxia.sink.Sink; import org.apache.maven.plugin.AbstractMojo; @@ -28,45 +34,36 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.reporting.MavenReport; -import java.io.File; -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.Method; -import java.lang.reflect.Proxy; -import java.util.List; -import java.util.Locale; - /** * Generates the available/configured reports. * * @author Benjamin Bentmann */ -@Mojo( name = "generate", defaultPhase = LifecyclePhase.SITE, requiresReports = true ) -public class GenerateMojo - extends AbstractMojo -{ +@Mojo(name = "generate", defaultPhase = LifecyclePhase.SITE, requiresReports = true) +public class GenerateMojo extends AbstractMojo { /** * The path to the output directory of the site. */ - @Parameter( defaultValue = "${project.reporting.outputDirectory}" ) + @Parameter(defaultValue = "${project.reporting.outputDirectory}") private File outputDirectory; /** * The language for the reports. */ - @Parameter( defaultValue = "en" ) + @Parameter(defaultValue = "en") private String language = "en"; /** * A flag whether to ignore errors from reports and continue the generation. */ - @Parameter( defaultValue = "false" ) + @Parameter(defaultValue = "false") private boolean ignoreErrors; /** * The reports configured for the current build. */ - @Parameter( defaultValue = "${reports}", required = true, readonly = true ) + @Parameter(defaultValue = "${reports}", required = true, readonly = true) private List reports; /** @@ -74,52 +71,37 @@ public class GenerateMojo * * @throws MojoExecutionException If the output file could not be created. */ - public void execute() - throws MojoExecutionException, MojoFailureException - { - getLog().info( "[MAVEN-CORE-IT-LOG] Using output directory " + outputDirectory ); + public void execute() throws MojoExecutionException, MojoFailureException { + getLog().info("[MAVEN-CORE-IT-LOG] Using output directory " + outputDirectory); - Locale locale = new Locale( language ); - getLog().info( "[MAVEN-CORE-IT-LOG] Using locale " + locale ); + Locale locale = new Locale(language); + getLog().info("[MAVEN-CORE-IT-LOG] Using locale " + locale); - InvocationHandler handler = new InvocationHandler() - { + InvocationHandler handler = new InvocationHandler() { - public Object invoke( Object proxy, Method method, Object[] args ) - throws Throwable - { + public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { return null; } - }; - Sink sink = (Sink) Proxy.newProxyInstance( getClass().getClassLoader(), new Class[]{ Sink.class }, handler ); + Sink sink = (Sink) Proxy.newProxyInstance(getClass().getClassLoader(), new Class[] {Sink.class}, handler); - for ( Object report1 : reports ) - { + for (Object report1 : reports) { MavenReport report = (MavenReport) report1; - if ( report.canGenerateReport() ) - { - getLog().info( "[MAVEN-CORE-IT-LOG] Generating report " + report ); - try - { - report.setReportOutputDirectory( outputDirectory ); - report.generate( sink, locale ); - } - catch ( Throwable e ) - { - getLog().warn( "[MAVEN-CORE-IT-LOG] " + e, e ); - if ( !ignoreErrors ) - { - throw new MojoExecutionException( "Failed to generate report " + report, e ); + if (report.canGenerateReport()) { + getLog().info("[MAVEN-CORE-IT-LOG] Generating report " + report); + try { + report.setReportOutputDirectory(outputDirectory); + report.generate(sink, locale); + } catch (Throwable e) { + getLog().warn("[MAVEN-CORE-IT-LOG] " + e, e); + if (!ignoreErrors) { + throw new MojoExecutionException("Failed to generate report " + report, e); } } - } - else - { - getLog().info( "[MAVEN-CORE-IT-LOG] Skipping report " + report ); + } else { + getLog().info("[MAVEN-CORE-IT-LOG] Skipping report " + report); } } } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-site/src/main/java/org/apache/maven/plugin/coreit/InfoReport.java b/its/core-it-support/core-it-plugins/maven-it-plugin-site/src/main/java/org/apache/maven/plugin/coreit/InfoReport.java index d6df5fb647..76912a72ce 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-site/src/main/java/org/apache/maven/plugin/coreit/InfoReport.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-site/src/main/java/org/apache/maven/plugin/coreit/InfoReport.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,14 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.util.Locale; +import java.util.Properties; import org.apache.maven.doxia.sink.Sink; import org.apache.maven.plugin.AbstractMojo; @@ -27,13 +33,6 @@ import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.reporting.MavenReport; import org.apache.maven.reporting.MavenReportException; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.util.Locale; -import java.util.Properties; - /** * Creates a properties file in the site output directory. * @@ -42,15 +41,12 @@ import java.util.Properties; * @author Benjamin Bentmann * */ -public class InfoReport - extends AbstractMojo - implements MavenReport -{ +public class InfoReport extends AbstractMojo implements MavenReport { /** * The base directory of the current Maven project. */ - @Parameter( defaultValue = "${basedir}", required = true, readonly = true ) + @Parameter(defaultValue = "${basedir}", required = true, readonly = true) private File basedir; /** @@ -58,13 +54,13 @@ public class InfoReport * locale.language, locale.country and locale.variant indicate the report's * locale. */ - @Parameter( defaultValue = "info.properties" ) + @Parameter(defaultValue = "info.properties") private String infoFile = "info.properties"; /** * The path to the output directory of the site. */ - @Parameter( defaultValue = "${project.reporting.outputDirectory}" ) + @Parameter(defaultValue = "${project.reporting.outputDirectory}") private File outputDirectory; /** @@ -78,60 +74,46 @@ public class InfoReport * @throws MojoExecutionException If the output file could not be created. * @throws MojoFailureException If the output file has not been set. */ - public void execute() - throws MojoExecutionException, MojoFailureException - { - getLog().info( "[MAVEN-CORE-IT-LOG] Using output file path: " + infoFile ); + public void execute() throws MojoExecutionException, MojoFailureException { + getLog().info("[MAVEN-CORE-IT-LOG] Using output file path: " + infoFile); - if ( infoFile == null || infoFile.length() <= 0 ) - { - throw new MojoFailureException( "Path name for output file has not been specified" ); + if (infoFile == null || infoFile.length() <= 0) { + throw new MojoFailureException("Path name for output file has not been specified"); } - File outputFile = new File( outputDirectory, infoFile ); - if ( !outputFile.isAbsolute() ) - { - outputFile = new File( new File( basedir, outputDirectory.getPath() ), infoFile ).getAbsoluteFile(); + File outputFile = new File(outputDirectory, infoFile); + if (!outputFile.isAbsolute()) { + outputFile = new File(new File(basedir, outputDirectory.getPath()), infoFile).getAbsoluteFile(); } Properties props = new Properties(); - props.setProperty( "site.output.directory", outputDirectory.getPath() ); - if ( locale != null ) - { - props.setProperty( "locale.language", locale.getLanguage() ); - props.setProperty( "locale.country", locale.getCountry() ); - props.setProperty( "locale.variant", locale.getVariant() ); + props.setProperty("site.output.directory", outputDirectory.getPath()); + if (locale != null) { + props.setProperty("locale.language", locale.getLanguage()); + props.setProperty("locale.country", locale.getCountry()); + props.setProperty("locale.variant", locale.getVariant()); } - getLog().info( "[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile); OutputStream out = null; - try - { + try { outputFile.getParentFile().mkdirs(); - out = new FileOutputStream( outputFile ); - props.store( out, "MAVEN-CORE-IT-LOG" ); - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Output file could not be created: " + outputFile, e ); - } - finally - { - if ( out != null ) - { - try - { + out = new FileOutputStream(outputFile); + props.store(out, "MAVEN-CORE-IT-LOG"); + } catch (IOException e) { + throw new MojoExecutionException("Output file could not be created: " + outputFile, e); + } finally { + if (out != null) { + try { out.close(); - } - catch ( IOException e ) - { + } catch (IOException e) { // just ignore } } } - getLog().info( "[MAVEN-CORE-IT-LOG] Created output file: " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Created output file: " + outputFile); } /** @@ -139,58 +121,44 @@ public class InfoReport * * @throws MavenReportException If the report could not be created. */ - public void generate( Sink sink, Locale locale ) - throws MavenReportException - { + public void generate(Sink sink, Locale locale) throws MavenReportException { this.locale = locale; - try - { + try { execute(); - } - catch ( Exception e ) - { - throw new MavenReportException( "Report could not be created", e ); + } catch (Exception e) { + throw new MavenReportException("Report could not be created", e); } } - public String getOutputName() - { + public String getOutputName() { return "info"; } - public String getCategoryName() - { + public String getCategoryName() { return "Project Reports"; } - public String getName( Locale locale ) - { + public String getName(Locale locale) { return "name"; } - public String getDescription( Locale locale ) - { + public String getDescription(Locale locale) { return "description"; } - public void setReportOutputDirectory( File outputDirectory ) - { + public void setReportOutputDirectory(File outputDirectory) { this.outputDirectory = outputDirectory; } - public File getReportOutputDirectory() - { + public File getReportOutputDirectory() { return outputDirectory; } - public boolean isExternalReport() - { + public boolean isExternalReport() { return true; } - public boolean canGenerateReport() - { + public boolean canGenerateReport() { return true; } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-site/src/main/java/org/apache/maven/plugin/coreit/ListMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-site/src/main/java/org/apache/maven/plugin/coreit/ListMojo.java index 13b7a0daa2..9bf578b831 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-site/src/main/java/org/apache/maven/plugin/coreit/ListMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-site/src/main/java/org/apache/maven/plugin/coreit/ListMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,13 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; -import org.apache.maven.plugins.annotations.LifecyclePhase; -import org.apache.maven.plugins.annotations.Mojo; -import org.apache.maven.plugins.annotations.Parameter; +package org.apache.maven.plugin.coreit; import java.io.File; import java.io.FileOutputStream; @@ -33,29 +25,34 @@ import java.io.OutputStream; import java.util.List; import java.util.Properties; +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; + /** * Lists the available/configured reports in a properties file. * * @author Benjamin Bentmann * */ -@Mojo( name = "list", defaultPhase = LifecyclePhase.INITIALIZE, requiresReports = true ) -public class ListMojo - extends AbstractMojo -{ +@Mojo(name = "list", defaultPhase = LifecyclePhase.INITIALIZE, requiresReports = true) +public class ListMojo extends AbstractMojo { /** * The path to the properties file used to list the available reports. The properties file will have a key named * reports that gives the total count of reports. The keys reports.0, * reports.1 etc. will be used to denote the qualified class names of the reports. */ - @Parameter( property = "site.properties", defaultValue = "target/reports.properties" ) + @Parameter(property = "site.properties", defaultValue = "target/reports.properties") private File reportsFile; /** * The reports configured for the current build. */ - @Parameter( defaultValue = "${reports}", required = true, readonly = true ) + @Parameter(defaultValue = "${reports}", required = true, readonly = true) private List reports; /** @@ -63,49 +60,36 @@ public class ListMojo * * @throws MojoExecutionException If the output file could not be created. */ - public void execute() - throws MojoExecutionException, MojoFailureException - { + public void execute() throws MojoExecutionException, MojoFailureException { Properties reportProperties = new Properties(); - reportProperties.setProperty( "reports", "" + reports.size() ); + reportProperties.setProperty("reports", "" + reports.size()); - for ( int i = 0; i < reports.size(); i++ ) - { - Object report = reports.get( i ); - getLog().info( "[MAVEN-CORE-IT-LOG] Listing report " + report ); - reportProperties.setProperty( "reports." + i, report.getClass().getName() ); + for (int i = 0; i < reports.size(); i++) { + Object report = reports.get(i); + getLog().info("[MAVEN-CORE-IT-LOG] Listing report " + report); + reportProperties.setProperty("reports." + i, report.getClass().getName()); } - getLog().info( "[MAVEN-CORE-IT-LOG] Creating output file " + reportsFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Creating output file " + reportsFile); OutputStream out = null; - try - { + try { reportsFile.getParentFile().mkdirs(); - out = new FileOutputStream( reportsFile ); - reportProperties.store( out, "MAVEN-CORE-IT-LOG" ); - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Output file could not be created: " + reportsFile, e ); - } - finally - { - if ( out != null ) - { - try - { + out = new FileOutputStream(reportsFile); + reportProperties.store(out, "MAVEN-CORE-IT-LOG"); + } catch (IOException e) { + throw new MojoExecutionException("Output file could not be created: " + reportsFile, e); + } finally { + if (out != null) { + try { out.close(); - } - catch ( IOException e ) - { + } catch (IOException e) { // just ignore } } } - getLog().info( "[MAVEN-CORE-IT-LOG] Created output file " + reportsFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Created output file " + reportsFile); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-toolchain/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-toolchain/pom.xml index e30c06cf2b..abae54cde9 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-toolchain/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-toolchain/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 - maven-it-plugins org.apache.maven.its.plugins + maven-it-plugins 2.1-SNAPSHOT diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-toolchain/src/main/java/org/apache/maven/plugin/coreit/CoreItMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-toolchain/src/main/java/org/apache/maven/plugin/coreit/CoreItMojo.java index d5c7c3cc8f..e04db73508 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-toolchain/src/main/java/org/apache/maven/plugin/coreit/CoreItMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-toolchain/src/main/java/org/apache/maven/plugin/coreit/CoreItMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,16 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ - -import org.apache.maven.execution.MavenSession; -import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugins.annotations.Component; -import org.apache.maven.plugins.annotations.LifecyclePhase; -import org.apache.maven.plugins.annotations.Mojo; -import org.apache.maven.plugins.annotations.Parameter; -import org.apache.maven.toolchain.ToolchainManagerPrivate; -import org.apache.maven.toolchain.ToolchainPrivate; +package org.apache.maven.plugin.coreit; import java.io.File; import java.io.FileOutputStream; @@ -39,12 +28,20 @@ import java.util.Arrays; import java.util.Iterator; import java.util.Properties; +import org.apache.maven.execution.MavenSession; +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugins.annotations.Component; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.toolchain.ToolchainManagerPrivate; +import org.apache.maven.toolchain.ToolchainPrivate; + /** - */ -@Mojo( name = "toolchain", defaultPhase = LifecyclePhase.VALIDATE ) -public class CoreItMojo - extends AbstractMojo -{ + */ +@Mojo(name = "toolchain", defaultPhase = LifecyclePhase.VALIDATE) +public class CoreItMojo extends AbstractMojo { /** */ @@ -54,122 +51,96 @@ public class CoreItMojo /** * The current Maven session holding the selected toolchain. */ - @Parameter( defaultValue = "${session}", readonly = true, required = true ) + @Parameter(defaultValue = "${session}", readonly = true, required = true) private MavenSession session; /** * The path to the output file for the properties. */ - @Parameter( property = "toolchain.outputFile", defaultValue = "${project.build.directory}/toolchains.properties" ) + @Parameter(property = "toolchain.outputFile", defaultValue = "${project.build.directory}/toolchains.properties") private File outputFile; /** * The type identifier of the toolchain, e.g. "jdk". */ - @Parameter( property = "toolchain.type" ) + @Parameter(property = "toolchain.type") private String type; /** * The name of the tool, e.g. "javac". */ - @Parameter( property = "toolchain.tool" ) + @Parameter(property = "toolchain.tool") private String tool; /** * The zero-based index of the toolchain to select and store in the build context. */ - @Parameter( property = "toolchain.selected" ) + @Parameter(property = "toolchain.selected") private int selected; - public void execute() - throws MojoExecutionException - { + public void execute() throws MojoExecutionException { ToolchainPrivate[] tcs = getToolchains(); - getLog().info( "[MAVEN-CORE-IT-LOG] Toolchains in plugin: " + Arrays.asList( tcs ) ); + getLog().info("[MAVEN-CORE-IT-LOG] Toolchains in plugin: " + Arrays.asList(tcs)); - if ( selected >= 0 ) - { - if ( selected < tcs.length ) - { + if (selected >= 0) { + if (selected < tcs.length) { ToolchainPrivate toolchain = tcs[selected]; - toolchainManager.storeToolchainToBuildContext( toolchain, session ); - } - else - { - getLog().warn( - "[MAVEN-CORE-IT-LOG] Toolchain #" + selected + " can't be selected, found only " + tcs.length ); + toolchainManager.storeToolchainToBuildContext(toolchain, session); + } else { + getLog().warn("[MAVEN-CORE-IT-LOG] Toolchain #" + selected + " can't be selected, found only " + + tcs.length); } } Properties properties = new Properties(); int count = 1; - for ( Iterator i = Arrays.asList( tcs ).iterator(); i.hasNext(); count++ ) - { + for (Iterator i = Arrays.asList(tcs).iterator(); i.hasNext(); count++) { ToolchainPrivate toolchain = i.next(); - String foundTool = toolchain.findTool( tool ); - if ( foundTool != null ) - { - properties.setProperty( "tool." + count, foundTool ); + String foundTool = toolchain.findTool(tool); + if (foundTool != null) { + properties.setProperty("tool." + count, foundTool); } } OutputStream out = null; - try - { + try { outputFile.getParentFile().mkdirs(); - out = new FileOutputStream( outputFile ); - properties.store( out, "MAVEN-CORE-IT-LOG" ); - } - catch ( IOException e ) - { - throw new MojoExecutionException( e.getMessage(), e ); - } - finally - { - if ( out != null ) - { - try - { + out = new FileOutputStream(outputFile); + properties.store(out, "MAVEN-CORE-IT-LOG"); + } catch (IOException e) { + throw new MojoExecutionException(e.getMessage(), e); + } finally { + if (out != null) { + try { out.close(); - } - catch ( IOException e ) - { + } catch (IOException e) { // ignore } } } } - private ToolchainPrivate[] getToolchains() - throws MojoExecutionException - { + private ToolchainPrivate[] getToolchains() throws MojoExecutionException { Class managerClass = toolchainManager.getClass(); - try - { - try - { + try { + try { // try 2.x style API - Method oldMethod = managerClass.getMethod( "getToolchainsForType", new Class[]{ String.class } ); + Method oldMethod = managerClass.getMethod("getToolchainsForType", new Class[] {String.class}); - return (ToolchainPrivate[]) oldMethod.invoke( toolchainManager, new Object[]{ type } ); - } - catch ( NoSuchMethodException e ) - { + return (ToolchainPrivate[]) oldMethod.invoke(toolchainManager, new Object[] {type}); + } catch (NoSuchMethodException e) { // try 3.x style API Method newMethod = - managerClass.getMethod( "getToolchainsForType", new Class[]{ String.class, MavenSession.class } ); + managerClass.getMethod("getToolchainsForType", new Class[] {String.class, MavenSession.class}); - return (ToolchainPrivate[]) newMethod.invoke( toolchainManager, new Object[]{ type, session } ); + return (ToolchainPrivate[]) newMethod.invoke(toolchainManager, new Object[] {type, session}); } - } - catch ( NoSuchMethodException | InvocationTargetException | IllegalAccessException e ) - { - throw new MojoExecutionException( "Incompatible toolchain API", e ); + } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) { + throw new MojoExecutionException("Incompatible toolchain API", e); } } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-toolchain/src/main/java/org/apache/maven/plugin/coreit/FindToolMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-toolchain/src/main/java/org/apache/maven/plugin/coreit/FindToolMojo.java index d92615e20b..11884b1a6b 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-toolchain/src/main/java/org/apache/maven/plugin/coreit/FindToolMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-toolchain/src/main/java/org/apache/maven/plugin/coreit/FindToolMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; import java.io.File; import java.io.FileOutputStream; @@ -39,11 +38,9 @@ import org.apache.maven.toolchain.ToolchainManager; * Finds a tool from a previously selected toolchain. This tests the public API just like toolchain-enabled plugins * would do. * - */ -@Mojo( name = "find-tool", defaultPhase = LifecyclePhase.VALIDATE ) -public class FindToolMojo - extends AbstractMojo -{ + */ +@Mojo(name = "find-tool", defaultPhase = LifecyclePhase.VALIDATE) +public class FindToolMojo extends AbstractMojo { /** */ @@ -53,68 +50,55 @@ public class FindToolMojo /** * The current Maven session holding the selected toolchain. */ - @Parameter( defaultValue = "${session}", required = true, readonly = true ) + @Parameter(defaultValue = "${session}", required = true, readonly = true) private MavenSession session; /** * The path to the output file for the properties. */ - @Parameter( property = "toolchain.outputFile", defaultValue = "${project.build.directory}/tool.properties" ) + @Parameter(property = "toolchain.outputFile", defaultValue = "${project.build.directory}/tool.properties") private File outputFile; /** * The type identifier of the toolchain, e.g. "jdk". */ - @Parameter( property = "toolchain.type" ) + @Parameter(property = "toolchain.type") private String type; /** * The name of the tool, e.g. "javac". */ - @Parameter( property = "toolchain.tool" ) + @Parameter(property = "toolchain.tool") private String tool; - public void execute() - throws MojoExecutionException - { - Toolchain toolchain = toolchainManager.getToolchainFromBuildContext( type, session ); + public void execute() throws MojoExecutionException { + Toolchain toolchain = toolchainManager.getToolchainFromBuildContext(type, session); - getLog().info( "[MAVEN-CORE-IT-LOG] Toolchain in session: " + toolchain ); + getLog().info("[MAVEN-CORE-IT-LOG] Toolchain in session: " + toolchain); Properties properties = new Properties(); - if ( toolchain != null ) - { - properties.setProperty( "toolchain.type", toolchain.getType() ); + if (toolchain != null) { + properties.setProperty("toolchain.type", toolchain.getType()); - String path = toolchain.findTool( tool ); - if ( path != null ) - { - properties.setProperty( "tool." + tool, path ); + String path = toolchain.findTool(tool); + if (path != null) { + properties.setProperty("tool." + tool, path); } } OutputStream out = null; - try - { + try { outputFile.getParentFile().mkdirs(); - out = new FileOutputStream( outputFile ); - properties.store( out, "MAVEN-CORE-IT-LOG" ); - } - catch ( IOException e ) - { - throw new MojoExecutionException( e.getMessage(), e ); - } - finally - { - if ( out != null ) - { - try - { + out = new FileOutputStream(outputFile); + properties.store(out, "MAVEN-CORE-IT-LOG"); + } catch (IOException e) { + throw new MojoExecutionException(e.getMessage(), e); + } finally { + if (out != null) { + try { out.close(); - } - catch ( IOException e ) - { + } catch (IOException e) { // ignore } } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-touch/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-touch/pom.xml index d39cf33045..e328670399 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-touch/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-touch/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 - maven-it-plugins org.apache.maven.its.plugins + maven-it-plugins 2.1-SNAPSHOT diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-touch/src/main/java/org/apache/maven/plugin/coreit/CopyPomMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-touch/src/main/java/org/apache/maven/plugin/coreit/CopyPomMojo.java index afc6eecf18..71e8595cfd 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-touch/src/main/java/org/apache/maven/plugin/coreit/CopyPomMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-touch/src/main/java/org/apache/maven/plugin/coreit/CopyPomMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,12 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; @@ -25,60 +29,46 @@ import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; - /** * Mojo which makes a copy of the POM using MavenProject.getFile() to locate the file. * - */ -@Mojo( name = "copy-pom", defaultPhase = LifecyclePhase.GENERATE_SOURCES ) -public class CopyPomMojo - extends AbstractMojo -{ + */ +@Mojo(name = "copy-pom", defaultPhase = LifecyclePhase.GENERATE_SOURCES) +public class CopyPomMojo extends AbstractMojo { /** */ - @Parameter( defaultValue = "${project.file}" ) + @Parameter(defaultValue = "${project.file}") private File pomFile; /** */ - @Parameter( defaultValue = "${project.build.directory}/pom-copy.xml", required = true ) + @Parameter(defaultValue = "${project.build.directory}/pom-copy.xml", required = true) private String outputFile; - public void execute() - throws MojoExecutionException - { - try - { - File dest = new File( outputFile ); + public void execute() throws MojoExecutionException { + try { + File dest = new File(outputFile); File dir = dest.getParentFile(); - if ( !dir.exists() ) - { + if (!dir.exists()) { dir.mkdirs(); } - getLog().info( "Copying POM to file: " + dest.getAbsolutePath() ); + getLog().info("Copying POM to file: " + dest.getAbsolutePath()); - FileInputStream in = new FileInputStream( pomFile ); - FileOutputStream out = new FileOutputStream( dest ); + FileInputStream in = new FileInputStream(pomFile); + FileOutputStream out = new FileOutputStream(dest); int read = -1; byte[] buf = new byte[4 * 1024]; - while ( ( read = in.read( buf ) ) > -1 ) - { - out.write( buf, 0, read ); + while ((read = in.read(buf)) > -1) { + out.write(buf, 0, read); } in.close(); out.close(); - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Error copying POM", e ); + } catch (IOException e) { + throw new MojoExecutionException("Error copying POM", e); } } } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-touch/src/main/java/org/apache/maven/plugin/coreit/CoreItTouchMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-touch/src/main/java/org/apache/maven/plugin/coreit/CoreItTouchMojo.java index 8ad9c76509..f1315df6da 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-touch/src/main/java/org/apache/maven/plugin/coreit/CoreItTouchMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-touch/src/main/java/org/apache/maven/plugin/coreit/CoreItTouchMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,12 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.util.Map; import org.apache.maven.artifact.Artifact; import org.apache.maven.plugin.AbstractMojo; @@ -27,33 +31,26 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.util.Map; - /** * Mojo that creates one touch.txt or more files with configured filenames in target/ * directory, or cause failure if desired, and set build final name to 'coreitified' * - */ -@Mojo( name = "touch", defaultPhase = LifecyclePhase.PROCESS_SOURCES ) -public class CoreItTouchMojo - extends AbstractMojo -{ - @Parameter( defaultValue = "${project}" ) + */ +@Mojo(name = "touch", defaultPhase = LifecyclePhase.PROCESS_SOURCES) +public class CoreItTouchMojo extends AbstractMojo { + @Parameter(defaultValue = "${project}") private MavenProject project; /** * Output directory for touched files. */ - @Parameter( defaultValue = "${project.build.directory}", required = true ) + @Parameter(defaultValue = "${project.build.directory}", required = true) private String outputDirectory; /** * Test setting of plugin-artifacts on the PluginDescriptor instance. */ - @Parameter( defaultValue = "${plugin.artifactMap}", required = true ) + @Parameter(defaultValue = "${plugin.artifactMap}", required = true) private Map pluginArtifacts; /** @@ -61,12 +58,12 @@ public class CoreItTouchMojo * value is relative: a touch.txt file will be created in specified directory, to be able * to check that absolute value is at right place. */ - @Parameter( defaultValue = "target/test-basedir-alignment" ) + @Parameter(defaultValue = "target/test-basedir-alignment") private File basedirAlignmentDirectory; /** */ - @Parameter( alias = "pluginFile" ) + @Parameter(alias = "pluginFile") private String pluginItem = "foo"; /** @@ -77,85 +74,71 @@ public class CoreItTouchMojo /** * Touch a file named after artifact absolute file name, replacing '/' and ':' by '_' and adding ".txt". */ - @Parameter( property = "artifactToFile" ) + @Parameter(property = "artifactToFile") private String artifactToFile; /** * Should the goal cause a failure before doing anything else? */ - @Parameter( property = "fail" ) + @Parameter(property = "fail") private boolean fail = false; - public void execute() - throws MojoExecutionException - { - if ( fail ) - { - throw new MojoExecutionException( "Failing per \'fail\' parameter" - + " (specified in pom or system properties)" ); + public void execute() throws MojoExecutionException { + if (fail) { + throw new MojoExecutionException( + "Failing per \'fail\' parameter" + " (specified in pom or system properties)"); } - File outDir = new File( outputDirectory ); + File outDir = new File(outputDirectory); - touch( outDir, "touch.txt" ); + touch(outDir, "touch.txt"); // This parameter should be aligned to the basedir as the parameter type is specified // as java.io.File - if ( !basedirAlignmentDirectory.isAbsolute() ) - { - throw new MojoExecutionException( "basedirAlignmentDirectory not aligned" ); + if (!basedirAlignmentDirectory.isAbsolute()) { + throw new MojoExecutionException("basedirAlignmentDirectory not aligned"); } - touch( basedirAlignmentDirectory, "touch.txt" ); + touch(basedirAlignmentDirectory, "touch.txt"); // Test parameter setting - if ( pluginItem != null ) - { - touch( outDir, pluginItem ); + if (pluginItem != null) { + touch(outDir, pluginItem); } - if ( goalItem != null ) - { - touch( outDir, goalItem ); + if (goalItem != null) { + touch(outDir, goalItem); } - if ( artifactToFile != null ) - { - Artifact artifact = pluginArtifacts.get( artifactToFile ); + if (artifactToFile != null) { + Artifact artifact = pluginArtifacts.get(artifactToFile); File artifactFile = artifact.getFile(); - String filename = artifactFile.getAbsolutePath().replace( '/', '_' ).replace( ':', '_' ) + ".txt"; + String filename = artifactFile.getAbsolutePath().replace('/', '_').replace(':', '_') + ".txt"; - touch( outDir, filename ); + touch(outDir, filename); } - project.getBuild().setFinalName( "coreitified" ); + project.getBuild().setFinalName("coreitified"); } - private void touch( File dir, String file ) - throws MojoExecutionException - { - try - { - if ( !dir.exists() ) - { - dir.mkdirs(); - } + private void touch(File dir, String file) throws MojoExecutionException { + try { + if (!dir.exists()) { + dir.mkdirs(); + } - File touch = new File( dir, file ); + File touch = new File(dir, file); - getLog().info( "Touching file: " + touch.getAbsolutePath() ); + getLog().info("Touching file: " + touch.getAbsolutePath()); - FileWriter w = new FileWriter( touch ); + FileWriter w = new FileWriter(touch); - w.write( file ); + w.write(file); - w.close(); - } - - catch ( IOException e ) - { - throw new MojoExecutionException( "Error touching file", e ); + w.close(); + } catch (IOException e) { + throw new MojoExecutionException("Error touching file", e); } } } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-uses-properties/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-uses-properties/pom.xml index d1a13c1a9c..b81307ea87 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-uses-properties/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-uses-properties/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 - maven-it-plugins org.apache.maven.its.plugins + maven-it-plugins 2.1-SNAPSHOT diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-uses-properties/src/main/java/org/apache/maven/plugin/coreit/UsesPropertiesMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-uses-properties/src/main/java/org/apache/maven/plugin/coreit/UsesPropertiesMojo.java index 0bb5e13b24..1c86201149 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-uses-properties/src/main/java/org/apache/maven/plugin/coreit/UsesPropertiesMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-uses-properties/src/main/java/org/apache/maven/plugin/coreit/UsesPropertiesMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,11 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; +import java.io.FileOutputStream; +import java.util.Properties; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; @@ -25,41 +28,32 @@ import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; -import java.util.Properties; -import java.io.FileOutputStream; -import java.io.File; - /** */ -@Mojo( name = "generate-properties", defaultPhase = LifecyclePhase.VALIDATE ) -public class UsesPropertiesMojo - extends AbstractMojo -{ +@Mojo(name = "generate-properties", defaultPhase = LifecyclePhase.VALIDATE) +public class UsesPropertiesMojo extends AbstractMojo { /** */ - @Parameter( defaultValue = "${basedir}" ) + @Parameter(defaultValue = "${basedir}") private File basedir; /** */ - @Parameter( defaultValue = "${project.properties}" ) + @Parameter(defaultValue = "${project.properties}") private Properties properties; - public void execute() - throws MojoExecutionException - { - try - { - File file = new File( basedir, "target/project.properties" ); + public void execute() throws MojoExecutionException { + try { + File file = new File(basedir, "target/project.properties"); file.getParentFile().mkdirs(); - FileOutputStream fos = new FileOutputStream( file ); + FileOutputStream fos = new FileOutputStream(file); - properties.store( fos, "# Properties generated by the execution of a mojo that uses" - + " interpolated POM values for configuration." ); - } - catch ( Exception e ) - { - getLog().error( "Error creating mojo generated properties.", e ); + properties.store( + fos, + "# Properties generated by the execution of a mojo that uses" + + " interpolated POM values for configuration."); + } catch (Exception e) { + getLog().error("Error creating mojo generated properties.", e); } } } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-uses-wagon/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-uses-wagon/pom.xml index 0f2240b3ed..f30ae62df6 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-uses-wagon/pom.xml +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-uses-wagon/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 - maven-it-plugins org.apache.maven.its.plugins + maven-it-plugins 2.1-SNAPSHOT diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-uses-wagon/src/main/java/org/apache/maven/plugin/coreit/DumpAuthMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-uses-wagon/src/main/java/org/apache/maven/plugin/coreit/DumpAuthMojo.java index d355556c5c..fe8772ef89 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-uses-wagon/src/main/java/org/apache/maven/plugin/coreit/DumpAuthMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-uses-wagon/src/main/java/org/apache/maven/plugin/coreit/DumpAuthMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,13 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.util.Properties; import org.apache.maven.artifact.manager.WagonManager; import org.apache.maven.plugin.AbstractMojo; @@ -29,26 +34,18 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.wagon.authentication.AuthenticationInfo; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.util.Properties; - /** * Dumps the authentication info registered with the wagon manager for a server to a properties file. * * @author Benjamin Bentmann */ -@Mojo( name = "dump-auth", defaultPhase = LifecyclePhase.VALIDATE ) -public class DumpAuthMojo - extends AbstractMojo -{ +@Mojo(name = "dump-auth", defaultPhase = LifecyclePhase.VALIDATE) +public class DumpAuthMojo extends AbstractMojo { /** * Project base directory used for manual path alignment. */ - @Parameter( defaultValue = "${basedir}", readonly = true ) + @Parameter(defaultValue = "${basedir}", readonly = true) private File basedir; /** @@ -60,7 +57,7 @@ public class DumpAuthMojo /** * The path to the properties file used to dump the auth infos. */ - @Parameter( property = "wagon.propertiesFile" ) + @Parameter(property = "wagon.propertiesFile") private File propertiesFile; /** @@ -74,80 +71,59 @@ public class DumpAuthMojo * * @throws MojoFailureException If the output file could not be created. */ - public void execute() - throws MojoExecutionException, MojoFailureException - { + public void execute() throws MojoExecutionException, MojoFailureException { Properties authProperties = new Properties(); - for ( String serverId : serverIds ) - { - getLog().info( "[MAVEN-CORE-IT-LOG] Getting authentication info for server " + serverId ); + for (String serverId : serverIds) { + getLog().info("[MAVEN-CORE-IT-LOG] Getting authentication info for server " + serverId); - AuthenticationInfo authInfo = wagonManager.getAuthenticationInfo( serverId ); - if ( authInfo != null ) - { - if ( authInfo.getUserName() != null ) - { - authProperties.setProperty( serverId + ".username", authInfo.getUserName() ); + AuthenticationInfo authInfo = wagonManager.getAuthenticationInfo(serverId); + if (authInfo != null) { + if (authInfo.getUserName() != null) { + authProperties.setProperty(serverId + ".username", authInfo.getUserName()); } - if ( authInfo.getPassword() != null ) - { - authProperties.setProperty( serverId + ".password", authInfo.getPassword() ); + if (authInfo.getPassword() != null) { + authProperties.setProperty(serverId + ".password", authInfo.getPassword()); } - if ( authInfo.getPrivateKey() != null ) - { - authProperties.setProperty( serverId + ".privateKey", authInfo.getPrivateKey() ); + if (authInfo.getPrivateKey() != null) { + authProperties.setProperty(serverId + ".privateKey", authInfo.getPrivateKey()); } - if ( authInfo.getPassphrase() != null ) - { - authProperties.setProperty( serverId + ".passphrase", authInfo.getPassphrase() ); + if (authInfo.getPassphrase() != null) { + authProperties.setProperty(serverId + ".passphrase", authInfo.getPassphrase()); } - getLog().info( "[MAVEN-CORE-IT-LOG] username = " + authInfo.getUserName() ); - getLog().info( "[MAVEN-CORE-IT-LOG] password = " + authInfo.getPassword() ); - getLog().info( "[MAVEN-CORE-IT-LOG] private key = " + authInfo.getPrivateKey() ); - getLog().info( "[MAVEN-CORE-IT-LOG] passphrase = " + authInfo.getPassphrase() ); - } - else - { - getLog().info( "[MAVEN-CORE-IT-LOG] (no authentication info available)" ); + getLog().info("[MAVEN-CORE-IT-LOG] username = " + authInfo.getUserName()); + getLog().info("[MAVEN-CORE-IT-LOG] password = " + authInfo.getPassword()); + getLog().info("[MAVEN-CORE-IT-LOG] private key = " + authInfo.getPrivateKey()); + getLog().info("[MAVEN-CORE-IT-LOG] passphrase = " + authInfo.getPassphrase()); + } else { + getLog().info("[MAVEN-CORE-IT-LOG] (no authentication info available)"); } } - if ( !propertiesFile.isAbsolute() ) - { - propertiesFile = new File( basedir, propertiesFile.getPath() ); + if (!propertiesFile.isAbsolute()) { + propertiesFile = new File(basedir, propertiesFile.getPath()); } - getLog().info( "[MAVEN-CORE-IT-LOG] Creating output file " + propertiesFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Creating output file " + propertiesFile); OutputStream out = null; - try - { + try { propertiesFile.getParentFile().mkdirs(); - out = new FileOutputStream( propertiesFile ); - authProperties.store( out, "MAVEN-CORE-IT-LOG" ); - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Output file could not be created: " + propertiesFile, e ); - } - finally - { - if ( out != null ) - { - try - { + out = new FileOutputStream(propertiesFile); + authProperties.store(out, "MAVEN-CORE-IT-LOG"); + } catch (IOException e) { + throw new MojoExecutionException("Output file could not be created: " + propertiesFile, e); + } finally { + if (out != null) { + try { out.close(); - } - catch ( IOException e ) - { + } catch (IOException e) { // just ignore } } } - getLog().info( "[MAVEN-CORE-IT-LOG] Created output file " + propertiesFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Created output file " + propertiesFile); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-uses-wagon/src/main/java/org/apache/maven/plugin/coreit/DumpVersionMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-uses-wagon/src/main/java/org/apache/maven/plugin/coreit/DumpVersionMojo.java index 2270ea5b66..df70743b66 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-uses-wagon/src/main/java/org/apache/maven/plugin/coreit/DumpVersionMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-uses-wagon/src/main/java/org/apache/maven/plugin/coreit/DumpVersionMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,14 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.Properties; import org.apache.maven.artifact.manager.WagonManager; import org.apache.maven.plugin.AbstractMojo; @@ -27,27 +33,18 @@ import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.Properties; - /** * Dumps the version info for a wagon provider to a properties file. * * @author Benjamin Bentmann */ -@Mojo( name = "dump-version", defaultPhase = LifecyclePhase.VALIDATE ) -public class DumpVersionMojo - extends AbstractMojo -{ +@Mojo(name = "dump-version", defaultPhase = LifecyclePhase.VALIDATE) +public class DumpVersionMojo extends AbstractMojo { /** * Project base directory used for manual path alignment. */ - @Parameter( defaultValue = "${basedir}", readonly = true ) + @Parameter(defaultValue = "${basedir}", readonly = true) private File basedir; /** @@ -59,25 +56,25 @@ public class DumpVersionMojo /** * The path to the properties file used to dump the auth infos. */ - @Parameter( property = "wagon.propertiesFile" ) + @Parameter(property = "wagon.propertiesFile") private File propertiesFile; /** * The role hint for the provider of interest. */ - @Parameter( property = "wagon.providerHint" ) + @Parameter(property = "wagon.providerHint") private String providerHint; /** * The group id for the provider of interest. */ - @Parameter( property = "wagon.providerGroupId" ) + @Parameter(property = "wagon.providerGroupId") private String providerGroupId; /** * The artifact id for the provider of interest. */ - @Parameter( property = "wagon.providerArtifactId" ) + @Parameter(property = "wagon.providerArtifactId") private String providerArtifactId; /** @@ -85,64 +82,46 @@ public class DumpVersionMojo * * @throws MojoExecutionException If the output file could not be created. */ - public void execute() - throws MojoExecutionException - { + public void execute() throws MojoExecutionException { Properties wagonProperties = new Properties(); Object wagon; - try - { - wagon = wagonManager.getWagon( providerHint ); + try { + wagon = wagonManager.getWagon(providerHint); String resource = "/META-INF/maven/" + providerGroupId + "/" + providerArtifactId + "/pom.properties"; - InputStream is = wagon.getClass().getResourceAsStream( resource ); - wagonProperties.load( is ); - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Wagon properties could not be read: " + e.getMessage(), e ); - } - catch ( Exception e ) - { - getLog().info( "[MAVEN-CORE-IT-LOG] No wagon available for " + providerHint ); - wagonProperties.setProperty( "missing", "true" ); + InputStream is = wagon.getClass().getResourceAsStream(resource); + wagonProperties.load(is); + } catch (IOException e) { + throw new MojoExecutionException("Wagon properties could not be read: " + e.getMessage(), e); + } catch (Exception e) { + getLog().info("[MAVEN-CORE-IT-LOG] No wagon available for " + providerHint); + wagonProperties.setProperty("missing", "true"); } - if ( !propertiesFile.isAbsolute() ) - { - propertiesFile = new File( basedir, propertiesFile.getPath() ); + if (!propertiesFile.isAbsolute()) { + propertiesFile = new File(basedir, propertiesFile.getPath()); } - getLog().info( "[MAVEN-CORE-IT-LOG] Creating output file " + propertiesFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Creating output file " + propertiesFile); OutputStream out = null; - try - { + try { propertiesFile.getParentFile().mkdirs(); - out = new FileOutputStream( propertiesFile ); - wagonProperties.store( out, "MAVEN-CORE-IT-LOG" ); - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Output file could not be created: " + propertiesFile, e ); - } - finally - { - if ( out != null ) - { - try - { + out = new FileOutputStream(propertiesFile); + wagonProperties.store(out, "MAVEN-CORE-IT-LOG"); + } catch (IOException e) { + throw new MojoExecutionException("Output file could not be created: " + propertiesFile, e); + } finally { + if (out != null) { + try { out.close(); - } - catch ( IOException e ) - { + } catch (IOException e) { // just ignore } } } - getLog().info( "[MAVEN-CORE-IT-LOG] Created output file " + propertiesFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Created output file " + propertiesFile); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-uses-wagon/src/main/java/org/apache/maven/plugin/coreit/LoadResourceMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-uses-wagon/src/main/java/org/apache/maven/plugin/coreit/LoadResourceMojo.java index 96148d9153..a4171ab23f 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-uses-wagon/src/main/java/org/apache/maven/plugin/coreit/LoadResourceMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-uses-wagon/src/main/java/org/apache/maven/plugin/coreit/LoadResourceMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,16 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.net.URL; +import java.util.Collections; +import java.util.List; +import java.util.Properties; import org.apache.maven.artifact.manager.WagonManager; import org.apache.maven.plugin.AbstractMojo; @@ -29,25 +37,14 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.wagon.repository.Repository; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.net.URL; -import java.util.Collections; -import java.util.List; -import java.util.Properties; - /** * Loads resources from a class loader used to load a wagon provider. The wagon is merely used to access the extension * class loader it came from which is otherwise not accessible to a plugin. * * @author Benjamin Bentmann */ -@Mojo( name = "load-resource", defaultPhase = LifecyclePhase.VALIDATE ) -public class LoadResourceMojo - extends AbstractMojo -{ +@Mojo(name = "load-resource", defaultPhase = LifecyclePhase.VALIDATE) +public class LoadResourceMojo extends AbstractMojo { /** * The Wagon manager used to retrieve wagon providers. @@ -58,20 +55,20 @@ public class LoadResourceMojo /** * The path to the properties file used to track the results of the resource loading via the wagon's class loader. */ - @Parameter( property = "wagon.wagonClassLoaderOutput" ) + @Parameter(property = "wagon.wagonClassLoaderOutput") private File wagonClassLoaderOutput; /** * The role hint for the wagon provider to load. The class loader of this provider will be used to load the * resources. */ - @Parameter( property = "wagon.wagonProtocol" ) + @Parameter(property = "wagon.wagonProtocol") private String wagonProtocol; /** * The repository to load the wagon for, if applicable. */ - @Parameter( property = "wagon.repositoryId" ) + @Parameter(property = "wagon.repositoryId") private String repositoryId; /** @@ -88,93 +85,68 @@ public class LoadResourceMojo * * @throws MojoFailureException If the attached file has not been set. */ - public void execute() - throws MojoExecutionException, MojoFailureException - { - getLog().info( "[MAVEN-CORE-IT-LOG] Looking up wagon for protocol " + wagonProtocol ); + public void execute() throws MojoExecutionException, MojoFailureException { + getLog().info("[MAVEN-CORE-IT-LOG] Looking up wagon for protocol " + wagonProtocol); Object wagon; - try - { - if ( repositoryId != null ) - { - wagon = wagonManager.getWagon( new Repository( repositoryId, wagonProtocol + "://host/path" ) ); + try { + if (repositoryId != null) { + wagon = wagonManager.getWagon(new Repository(repositoryId, wagonProtocol + "://host/path")); + } else { + wagon = wagonManager.getWagon(wagonProtocol); } - else - { - wagon = wagonManager.getWagon( wagonProtocol ); - } - } - catch ( Exception e ) - { - throw new MojoExecutionException( "Failed to load wagon for protocol " + wagonProtocol, e ); + } catch (Exception e) { + throw new MojoExecutionException("Failed to load wagon for protocol " + wagonProtocol, e); } ClassLoader classLoader = wagon.getClass().getClassLoader(); - getLog().info( "[MAVEN-CORE-IT-LOG] Using class loader " + classLoader ); + getLog().info("[MAVEN-CORE-IT-LOG] Using class loader " + classLoader); Properties loaderProperties = new Properties(); - loaderProperties.setProperty( "wagon.class", wagon.getClass().getName() ); + loaderProperties.setProperty("wagon.class", wagon.getClass().getName()); - if ( resourcePaths != null ) - { - for ( String path : resourcePaths ) - { - getLog().info( "[MAVEN-CORE-IT-LOG] Loading resource " + path ); + if (resourcePaths != null) { + for (String path : resourcePaths) { + getLog().info("[MAVEN-CORE-IT-LOG] Loading resource " + path); - URL url = classLoader.getResource( path ); - getLog().info( "[MAVEN-CORE-IT-LOG] Loaded resource from " + url ); - if ( url != null ) - { - loaderProperties.setProperty( path, url.toString() ); + URL url = classLoader.getResource(path); + getLog().info("[MAVEN-CORE-IT-LOG] Loaded resource from " + url); + if (url != null) { + loaderProperties.setProperty(path, url.toString()); } - try - { - List urls = Collections.list( classLoader.getResources( path ) ); - loaderProperties.setProperty( path + ".count", "" + urls.size() ); - for ( int j = 0; j < urls.size(); j++ ) - { - loaderProperties.setProperty( path + "." + j, urls.get( j ).toString() ); + try { + List urls = Collections.list(classLoader.getResources(path)); + loaderProperties.setProperty(path + ".count", "" + urls.size()); + for (int j = 0; j < urls.size(); j++) { + loaderProperties.setProperty(path + "." + j, urls.get(j).toString()); } - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Resources could not be enumerated: " + path, e ); + } catch (IOException e) { + throw new MojoExecutionException("Resources could not be enumerated: " + path, e); } } } - getLog().info( "[MAVEN-CORE-IT-LOG] Creating output file " + wagonClassLoaderOutput ); + getLog().info("[MAVEN-CORE-IT-LOG] Creating output file " + wagonClassLoaderOutput); OutputStream out = null; - try - { + try { wagonClassLoaderOutput.getParentFile().mkdirs(); - out = new FileOutputStream( wagonClassLoaderOutput ); - loaderProperties.store( out, "MAVEN-CORE-IT-LOG" ); - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Output file could not be created: " + wagonClassLoaderOutput, e ); - } - finally - { - if ( out != null ) - { - try - { + out = new FileOutputStream(wagonClassLoaderOutput); + loaderProperties.store(out, "MAVEN-CORE-IT-LOG"); + } catch (IOException e) { + throw new MojoExecutionException("Output file could not be created: " + wagonClassLoaderOutput, e); + } finally { + if (out != null) { + try { out.close(); - } - catch ( IOException e ) - { + } catch (IOException e) { // just ignore } } } - getLog().info( "[MAVEN-CORE-IT-LOG] Created output file " + wagonClassLoaderOutput ); + getLog().info("[MAVEN-CORE-IT-LOG] Created output file " + wagonClassLoaderOutput); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-uses-wagon/src/main/java/org/apache/maven/plugin/coreit/LookupWagonMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-uses-wagon/src/main/java/org/apache/maven/plugin/coreit/LookupWagonMojo.java index 0d1bd501d9..278868010a 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-uses-wagon/src/main/java/org/apache/maven/plugin/coreit/LookupWagonMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-uses-wagon/src/main/java/org/apache/maven/plugin/coreit/LookupWagonMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,13 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.util.Properties; import org.apache.maven.artifact.manager.WagonManager; import org.apache.maven.plugin.AbstractMojo; @@ -30,12 +35,6 @@ import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.wagon.Wagon; import org.apache.maven.wagon.repository.Repository; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.util.Properties; - /** * Loads resources from a class loader used to load a wagon provider. The wagon is merely used to access the extension * class loader it came from which is otherwise not accessible to a plugin. @@ -43,10 +42,8 @@ import java.util.Properties; * @author Benjamin Bentmann * */ -@Mojo( name = "lookup-wagon", defaultPhase = LifecyclePhase.VALIDATE ) -public class LookupWagonMojo - extends AbstractMojo -{ +@Mojo(name = "lookup-wagon", defaultPhase = LifecyclePhase.VALIDATE) +public class LookupWagonMojo extends AbstractMojo { /** * The Wagon manager used to retrieve wagon providers. @@ -57,7 +54,7 @@ public class LookupWagonMojo /** * The path to the properties file used to track the results of the wagon lookups. */ - @Parameter( property = "wagon.outputFile" ) + @Parameter(property = "wagon.outputFile") private File outputFile; /** @@ -71,63 +68,47 @@ public class LookupWagonMojo * * @throws MojoFailureException If the attached file has not been set. */ - public void execute() - throws MojoExecutionException, MojoFailureException - { + public void execute() throws MojoExecutionException, MojoFailureException { Properties loaderProperties = new Properties(); - if ( urls != null ) - { - for ( int i = 0; i < urls.length; i++ ) - { + if (urls != null) { + for (int i = 0; i < urls.length; i++) { String url = urls[i]; - getLog().info( "[MAVEN-CORE-IT-LOG] Looking up wagon for URL " + url ); + getLog().info("[MAVEN-CORE-IT-LOG] Looking up wagon for URL " + url); - try - { - Repository repo = new Repository( "repo-" + i, url ); - Wagon wagon = wagonManager.getWagon( repo ); - getLog().info( "[MAVEN-CORE-IT-LOG] " + wagon ); + try { + Repository repo = new Repository("repo-" + i, url); + Wagon wagon = wagonManager.getWagon(repo); + getLog().info("[MAVEN-CORE-IT-LOG] " + wagon); - loaderProperties.setProperty( url + ".hash", Integer.toString( System.identityHashCode( wagon ) ) ); - loaderProperties.setProperty( url + ".class", wagon.getClass().getName() ); - } - catch ( Exception e ) - { - getLog().warn( "[MAVEN-CORE-IT-LOG] Failed to look up wagon for URL " + url, e ); + loaderProperties.setProperty(url + ".hash", Integer.toString(System.identityHashCode(wagon))); + loaderProperties.setProperty( + url + ".class", wagon.getClass().getName()); + } catch (Exception e) { + getLog().warn("[MAVEN-CORE-IT-LOG] Failed to look up wagon for URL " + url, e); } } } - getLog().info( "[MAVEN-CORE-IT-LOG] Creating output file " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Creating output file " + outputFile); OutputStream out = null; - try - { + try { outputFile.getParentFile().mkdirs(); - out = new FileOutputStream( outputFile ); - loaderProperties.store( out, "MAVEN-CORE-IT-LOG" ); - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Output file could not be created: " + outputFile, e ); - } - finally - { - if ( out != null ) - { - try - { + out = new FileOutputStream(outputFile); + loaderProperties.store(out, "MAVEN-CORE-IT-LOG"); + } catch (IOException e) { + throw new MojoExecutionException("Output file could not be created: " + outputFile, e); + } finally { + if (out != null) { + try { out.close(); - } - catch ( IOException e ) - { + } catch (IOException e) { // just ignore } } } - getLog().info( "[MAVEN-CORE-IT-LOG] Created output file " + outputFile ); + getLog().info("[MAVEN-CORE-IT-LOG] Created output file " + outputFile); } - } diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-uses-wagon/src/main/java/org/apache/maven/plugin/coreit/UsesWagonMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-uses-wagon/src/main/java/org/apache/maven/plugin/coreit/UsesWagonMojo.java index 064dacc423..c26a352a15 100644 --- a/its/core-it-support/core-it-plugins/maven-it-plugin-uses-wagon/src/main/java/org/apache/maven/plugin/coreit/UsesWagonMojo.java +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-uses-wagon/src/main/java/org/apache/maven/plugin/coreit/UsesWagonMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.plugin.coreit; * "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 + * 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 @@ -18,6 +16,7 @@ package org.apache.maven.plugin.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugin.coreit; import org.apache.maven.artifact.manager.WagonManager; import org.apache.maven.plugin.AbstractMojo; @@ -31,64 +30,47 @@ import org.apache.maven.wagon.providers.ssh.jsch.ScpWagon; /** */ -@Mojo( name = "use-wagon", defaultPhase = LifecyclePhase.VALIDATE ) -public class UsesWagonMojo - extends AbstractMojo -{ +@Mojo(name = "use-wagon", defaultPhase = LifecyclePhase.VALIDATE) +public class UsesWagonMojo extends AbstractMojo { /** */ @Component private WagonManager wagonManager; - public void execute() - throws MojoExecutionException - { + public void execute() throws MojoExecutionException { Wagon fileWagon; - try - { - getLog().info( "[MAVEN-CORE-IT-LOG] Looking up wagon for protocol file" ); - fileWagon = wagonManager.getWagon( "file" ); + try { + getLog().info("[MAVEN-CORE-IT-LOG] Looking up wagon for protocol file"); + fileWagon = wagonManager.getWagon("file"); + } catch (Exception e) { + throw new MojoExecutionException(e.getMessage(), e); } - catch ( Exception e ) - { - throw new MojoExecutionException( e.getMessage(), e ); - } - try - { + try { FileWagon theWagon = (FileWagon) fileWagon; - } - catch ( ClassCastException e ) - { - getLog().error( "", e ); - getLog().error( "Plugin Class Loaded by " + FileWagon.class.getClassLoader() ); - getLog().error( "Wagon Class Loaded by " + fileWagon.getClass().getClassLoader() ); + } catch (ClassCastException e) { + getLog().error("", e); + getLog().error("Plugin Class Loaded by " + FileWagon.class.getClassLoader()); + getLog().error("Wagon Class Loaded by " + fileWagon.getClass().getClassLoader()); throw e; } Wagon scpWagon; - try - { - getLog().info( "[MAVEN-CORE-IT-LOG] Looking up wagon for protocol scp" ); - scpWagon = wagonManager.getWagon( "scp" ); + try { + getLog().info("[MAVEN-CORE-IT-LOG] Looking up wagon for protocol scp"); + scpWagon = wagonManager.getWagon("scp"); + } catch (Exception e) { + throw new MojoExecutionException(e.getMessage(), e); } - catch ( Exception e ) - { - throw new MojoExecutionException( e.getMessage(), e ); - } - try - { + try { ScpWagon theWagon = (ScpWagon) scpWagon; - } - catch ( ClassCastException e ) - { - getLog().error( "", e ); - getLog().error( "Plugin Class Loaded by " + ScpWagon.class.getClassLoader() ); - getLog().error( "Wagon Class Loaded by " + scpWagon.getClass().getClassLoader() ); + } catch (ClassCastException e) { + getLog().error("", e); + getLog().error("Plugin Class Loaded by " + ScpWagon.class.getClassLoader()); + getLog().error("Wagon Class Loaded by " + scpWagon.getClass().getClassLoader()); throw e; } } - } diff --git a/its/core-it-support/core-it-plugins/mng5805-extension/pom.xml b/its/core-it-support/core-it-plugins/mng5805-extension/pom.xml index ce7cdd1ea4..6c7ad38133 100644 --- a/its/core-it-support/core-it-plugins/mng5805-extension/pom.xml +++ b/its/core-it-support/core-it-plugins/mng5805-extension/pom.xml @@ -1,5 +1,4 @@ - - - + 4.0.0 - maven-it-plugins org.apache.maven.its.plugins + maven-it-plugins 2.1-SNAPSHOT diff --git a/its/core-it-support/core-it-plugins/mng5805-extension2/pom.xml b/its/core-it-support/core-it-plugins/mng5805-extension2/pom.xml index c6a24f6f65..4a6702f9b3 100644 --- a/its/core-it-support/core-it-plugins/mng5805-extension2/pom.xml +++ b/its/core-it-support/core-it-plugins/mng5805-extension2/pom.xml @@ -1,5 +1,4 @@ - - - + 4.0.0 - maven-it-plugins org.apache.maven.its.plugins + maven-it-plugins 2.1-SNAPSHOT diff --git a/its/core-it-support/core-it-plugins/mng5805-plugin-dep/pom.xml b/its/core-it-support/core-it-plugins/mng5805-plugin-dep/pom.xml index 1c29232f41..9a57757d6a 100644 --- a/its/core-it-support/core-it-plugins/mng5805-plugin-dep/pom.xml +++ b/its/core-it-support/core-it-plugins/mng5805-plugin-dep/pom.xml @@ -1,5 +1,4 @@ - - - + 4.0.0 - maven-it-plugins org.apache.maven.its.plugins + maven-it-plugins 2.1-SNAPSHOT @@ -33,5 +30,4 @@ under the License. Maven IT Plugin :: mng-5805 plugin-dep - diff --git a/its/core-it-support/core-it-plugins/mng5805-plugin-dep/src/main/java/org/apache/maven/its/mng5805/TestClass1.java b/its/core-it-support/core-it-plugins/mng5805-plugin-dep/src/main/java/org/apache/maven/its/mng5805/TestClass1.java index ac6ebf9de3..19920af558 100644 --- a/its/core-it-support/core-it-plugins/mng5805-plugin-dep/src/main/java/org/apache/maven/its/mng5805/TestClass1.java +++ b/its/core-it-support/core-it-plugins/mng5805-plugin-dep/src/main/java/org/apache/maven/its/mng5805/TestClass1.java @@ -1,5 +1,3 @@ -package org.apache.maven.its.mng5805; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,11 +16,9 @@ package org.apache.maven.its.mng5805; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.its.mng5805; /** * A test class */ -public class TestClass1 -{ - -} +public class TestClass1 {} diff --git a/its/core-it-support/core-it-plugins/mng5805-plugin/pom.xml b/its/core-it-support/core-it-plugins/mng5805-plugin/pom.xml index cfe7bbccd8..f8f684f6d4 100644 --- a/its/core-it-support/core-it-plugins/mng5805-plugin/pom.xml +++ b/its/core-it-support/core-it-plugins/mng5805-plugin/pom.xml @@ -1,5 +1,4 @@ - - - + 4.0.0 - maven-it-plugins org.apache.maven.its.plugins + maven-it-plugins 2.1-SNAPSHOT diff --git a/its/core-it-support/core-it-plugins/mng5805-plugin/src/main/java/org/apache/maven/its/mng5805/plugin/TestMojo.java b/its/core-it-support/core-it-plugins/mng5805-plugin/src/main/java/org/apache/maven/its/mng5805/plugin/TestMojo.java index c9f4b6b0a5..0437388b1c 100644 --- a/its/core-it-support/core-it-plugins/mng5805-plugin/src/main/java/org/apache/maven/its/mng5805/plugin/TestMojo.java +++ b/its/core-it-support/core-it-plugins/mng5805-plugin/src/main/java/org/apache/maven/its/mng5805/plugin/TestMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.its.mng5805.plugin; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,7 @@ package org.apache.maven.its.mng5805.plugin; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.its.mng5805.plugin; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; @@ -25,29 +24,22 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; /** - */ -@Mojo( name = "test" ) -public class TestMojo - extends AbstractMojo -{ + */ +@Mojo(name = "test") +public class TestMojo extends AbstractMojo { /** */ - @Parameter( defaultValue = "org.apache.maven.its.mng5805.DoesNotExist" ) + @Parameter(defaultValue = "org.apache.maven.its.mng5805.DoesNotExist") private String className; - public void execute() - throws MojoExecutionException - { + public void execute() throws MojoExecutionException { - getLog().info( "CLASS_NAME=" + className ); + getLog().info("CLASS_NAME=" + className); - try - { - Class.forName( className ); - } - catch ( ClassNotFoundException e ) - { - throw new MojoExecutionException( e.getMessage(), e ); + try { + Class.forName(className); + } catch (ClassNotFoundException e) { + throw new MojoExecutionException(e.getMessage(), e); } } } diff --git a/its/core-it-support/core-it-plugins/mng5958-extension/pom.xml b/its/core-it-support/core-it-plugins/mng5958-extension/pom.xml index beec4cf569..e921274cb5 100644 --- a/its/core-it-support/core-it-plugins/mng5958-extension/pom.xml +++ b/its/core-it-support/core-it-plugins/mng5958-extension/pom.xml @@ -1,5 +1,4 @@ - - - + 4.0.0 - maven-it-plugins org.apache.maven.its.plugins + maven-it-plugins 2.1-SNAPSHOT diff --git a/its/core-it-support/core-it-plugins/mng5958-extension/src/main/java/org/apache/maven/its/mng5958/AbstractLifecycleMapping.java b/its/core-it-support/core-it-plugins/mng5958-extension/src/main/java/org/apache/maven/its/mng5958/AbstractLifecycleMapping.java index a319b1c705..94d814f5f4 100644 --- a/its/core-it-support/core-it-plugins/mng5958-extension/src/main/java/org/apache/maven/its/mng5958/AbstractLifecycleMapping.java +++ b/its/core-it-support/core-it-plugins/mng5958-extension/src/main/java/org/apache/maven/its/mng5958/AbstractLifecycleMapping.java @@ -1,5 +1,3 @@ -package org.apache.maven.its.mng5958; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,7 @@ package org.apache.maven.its.mng5958; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.its.mng5958; import java.util.LinkedHashMap; import java.util.List; @@ -29,40 +28,34 @@ import org.apache.maven.lifecycle.mapping.LifecycleMapping; /** * @author Anton Tanasenko */ -public abstract class AbstractLifecycleMapping implements LifecycleMapping -{ +public abstract class AbstractLifecycleMapping implements LifecycleMapping { private Map lifecycleMap; - public Map getLifecycles() - { - if ( lifecycleMap != null ) - { + public Map getLifecycles() { + if (lifecycleMap != null) { return lifecycleMap; } lifecycleMap = new LinkedHashMap<>(); Lifecycle lifecycle = new Lifecycle(); - lifecycle.setId( "default" ); - lifecycle.setPhases( initPhases() ); + lifecycle.setId("default"); + lifecycle.setPhases(initPhases()); - lifecycleMap.put( "default", lifecycle ); + lifecycleMap.put("default", lifecycle); return lifecycleMap; } - public Map getPhases( String lifecycle ) - { - Lifecycle lifecycleMapping = getLifecycles().get( lifecycle ); - if ( lifecycleMapping != null ) - { + public Map getPhases(String lifecycle) { + Lifecycle lifecycleMapping = getLifecycles().get(lifecycle); + if (lifecycleMapping != null) { return lifecycleMapping.getPhases(); } return null; } - public List getOptionalMojos( String lifecycle ) - { + public List getOptionalMojos(String lifecycle) { return null; } diff --git a/its/core-it-support/core-it-plugins/mng5958-extension/src/main/java/org/apache/maven/its/mng5958/BadLifecycleMapping.java b/its/core-it-support/core-it-plugins/mng5958-extension/src/main/java/org/apache/maven/its/mng5958/BadLifecycleMapping.java index ac35886141..050c34436f 100644 --- a/its/core-it-support/core-it-plugins/mng5958-extension/src/main/java/org/apache/maven/its/mng5958/BadLifecycleMapping.java +++ b/its/core-it-support/core-it-plugins/mng5958-extension/src/main/java/org/apache/maven/its/mng5958/BadLifecycleMapping.java @@ -1,5 +1,3 @@ -package org.apache.maven.its.mng5958; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,7 @@ package org.apache.maven.its.mng5958; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.its.mng5958; import java.util.LinkedHashMap; import java.util.Map; @@ -27,19 +26,16 @@ import org.apache.maven.lifecycle.mapping.LifecyclePhase; /** * @author Anton Tanasenko */ -public class BadLifecycleMapping extends AbstractLifecycleMapping -{ +public class BadLifecycleMapping extends AbstractLifecycleMapping { @Override - protected Map initPhases() - { + protected Map initPhases() { Map phases = new LinkedHashMap<>(); LifecyclePhase lp = new LifecyclePhase(); - lp.set( "org.apache.maven.its.plugins:mng-5805-pkg-type-mojo-configuration-plugin:2.1-SNAPSHOT:test" ); + lp.set("org.apache.maven.its.plugins:mng-5805-pkg-type-mojo-configuration-plugin:2.1-SNAPSHOT:test"); - phases.put( "validate", lp ); + phases.put("validate", lp); return phases; } - } diff --git a/its/core-it-support/core-it-plugins/mng5958-extension/src/main/java/org/apache/maven/its/mng5958/GoodLifecycleMapping.java b/its/core-it-support/core-it-plugins/mng5958-extension/src/main/java/org/apache/maven/its/mng5958/GoodLifecycleMapping.java index d87cc1dd15..cc38cefcfa 100644 --- a/its/core-it-support/core-it-plugins/mng5958-extension/src/main/java/org/apache/maven/its/mng5958/GoodLifecycleMapping.java +++ b/its/core-it-support/core-it-plugins/mng5958-extension/src/main/java/org/apache/maven/its/mng5958/GoodLifecycleMapping.java @@ -1,5 +1,3 @@ -package org.apache.maven.its.mng5958; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,7 @@ package org.apache.maven.its.mng5958; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.its.mng5958; import java.util.LinkedHashMap; import java.util.Map; @@ -25,16 +24,14 @@ import java.util.Map; /** * @author Anton Tanasenko */ -public class GoodLifecycleMapping extends AbstractLifecycleMapping -{ +public class GoodLifecycleMapping extends AbstractLifecycleMapping { @Override - protected Map initPhases() - { + protected Map initPhases() { Map phases = new LinkedHashMap<>(); - phases.put( "validate", - "org.apache.maven.its.plugins:mng-5805-pkg-type-mojo-configuration-plugin:2.1-SNAPSHOT:test" ); + phases.put( + "validate", + "org.apache.maven.its.plugins:mng-5805-pkg-type-mojo-configuration-plugin:2.1-SNAPSHOT:test"); return phases; } - } diff --git a/its/core-it-support/core-it-plugins/mng6759-plugin-resolves-project-dependencies/pom.xml b/its/core-it-support/core-it-plugins/mng6759-plugin-resolves-project-dependencies/pom.xml index f6b0bb0d87..2436520a03 100644 --- a/its/core-it-support/core-it-plugins/mng6759-plugin-resolves-project-dependencies/pom.xml +++ b/its/core-it-support/core-it-plugins/mng6759-plugin-resolves-project-dependencies/pom.xml @@ -1,5 +1,4 @@ - - - + 4.0.0 - maven-it-plugins org.apache.maven.its.plugins + maven-it-plugins 2.1-SNAPSHOT diff --git a/its/core-it-support/core-it-plugins/mng6759-plugin-resolves-project-dependencies/src/main/java/org/apache/maven/its/mng6759/plugin/TestMojo.java b/its/core-it-support/core-it-plugins/mng6759-plugin-resolves-project-dependencies/src/main/java/org/apache/maven/its/mng6759/plugin/TestMojo.java index bda47854d3..e0ac1eae32 100644 --- a/its/core-it-support/core-it-plugins/mng6759-plugin-resolves-project-dependencies/src/main/java/org/apache/maven/its/mng6759/plugin/TestMojo.java +++ b/its/core-it-support/core-it-plugins/mng6759-plugin-resolves-project-dependencies/src/main/java/org/apache/maven/its/mng6759/plugin/TestMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.its.mng6759.plugin; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,8 +16,10 @@ package org.apache.maven.its.mng6759.plugin; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.its.mng6759.plugin; import java.util.Arrays; + import org.apache.maven.ProjectDependenciesResolver; import org.apache.maven.artifact.resolver.ArtifactNotFoundException; import org.apache.maven.artifact.resolver.ArtifactResolutionException; @@ -35,32 +35,24 @@ import org.apache.maven.project.MavenProject; /** * Resolves the project dependency tree */ -@Mojo( name = "resolve", defaultPhase = LifecyclePhase.GENERATE_RESOURCES, threadSafe = true ) -public class TestMojo - extends AbstractMojo -{ +@Mojo(name = "resolve", defaultPhase = LifecyclePhase.GENERATE_RESOURCES, threadSafe = true) +public class TestMojo extends AbstractMojo { - @Parameter( defaultValue = "${project}", readonly = true, required = true ) + @Parameter(defaultValue = "${project}", readonly = true, required = true) private MavenProject project; - @Parameter( defaultValue = "${session}", readonly = true, required = true ) + @Parameter(defaultValue = "${session}", readonly = true, required = true) private MavenSession mavenSession; - @Component( hint = "default" ) + @Component(hint = "default") protected ProjectDependenciesResolver dependencyResolver; - public void execute() - throws MojoExecutionException - { + public void execute() throws MojoExecutionException { - try - { - dependencyResolver.resolve( project, Arrays.asList( "test" ), mavenSession ); + try { + dependencyResolver.resolve(project, Arrays.asList("test"), mavenSession); + } catch (ArtifactResolutionException | ArtifactNotFoundException e) { + throw new MojoExecutionException(e.getMessage(), e); } - catch ( ArtifactResolutionException | ArtifactNotFoundException e ) - { - throw new MojoExecutionException( e.getMessage(), e ); - } - } } diff --git a/its/core-it-support/core-it-plugins/mng7529-plugin/pom.xml b/its/core-it-support/core-it-plugins/mng7529-plugin/pom.xml index a9a8a80cd2..17f2edc884 100644 --- a/its/core-it-support/core-it-plugins/mng7529-plugin/pom.xml +++ b/its/core-it-support/core-it-plugins/mng7529-plugin/pom.xml @@ -1,5 +1,4 @@ - - - + 4.0.0 - maven-it-plugins org.apache.maven.its.plugins + maven-it-plugins 2.1-SNAPSHOT mng-7529-version-range-repository-selection-plugin maven-plugin + Maven IT Plugin :: mng-7529 plugin + 3.6.0 - Maven IT Plugin :: mng-7529 plugin - org.apache.maven @@ -51,10 +48,10 @@ under the License. provided - org.apache.maven - maven-core - ${maven-version} - provided + org.apache.maven + maven-core + ${maven-version} + provided org.apache.maven diff --git a/its/core-it-support/core-it-plugins/mng7529-plugin/src/main/java/org/apache/maven/its/mng7529/plugin/ResolveMojo.java b/its/core-it-support/core-it-plugins/mng7529-plugin/src/main/java/org/apache/maven/its/mng7529/plugin/ResolveMojo.java index 5582f112e9..c6de9c7afd 100644 --- a/its/core-it-support/core-it-plugins/mng7529-plugin/src/main/java/org/apache/maven/its/mng7529/plugin/ResolveMojo.java +++ b/its/core-it-support/core-it-plugins/mng7529-plugin/src/main/java/org/apache/maven/its/mng7529/plugin/ResolveMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.its.mng7529.plugin; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.its.mng7529.plugin; * "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 + * 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 @@ -18,6 +16,7 @@ package org.apache.maven.its.mng7529.plugin; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.its.mng7529.plugin; import org.apache.maven.execution.MavenSession; import org.apache.maven.plugin.AbstractMojo; @@ -37,41 +36,33 @@ import org.apache.maven.project.ProjectDependenciesResolver; * Attempts to resolve a single artifact from dependencies with the project dependency resolver, * and logs the results for the Verifier to look at. */ -@Mojo( name = "resolve", requiresDependencyResolution = ResolutionScope.NONE ) -public class ResolveMojo - extends AbstractMojo -{ - @Parameter( defaultValue = "${project}", readonly = true, required = true ) +@Mojo(name = "resolve", requiresDependencyResolution = ResolutionScope.NONE) +public class ResolveMojo extends AbstractMojo { + @Parameter(defaultValue = "${project}", readonly = true, required = true) private MavenProject project; - @Parameter( defaultValue = "${session}", readonly = true, required = true ) + @Parameter(defaultValue = "${session}", readonly = true, required = true) private MavenSession mavenSession; @Component private ProjectDependenciesResolver dependencyResolver; - public void execute() - throws MojoExecutionException - { + public void execute() throws MojoExecutionException { - try - { - DefaultProjectBuildingRequest buildingRequest = new DefaultProjectBuildingRequest( - mavenSession.getProjectBuildingRequest() ); - buildingRequest.setRemoteRepositories( project.getRemoteArtifactRepositories() ); + try { + DefaultProjectBuildingRequest buildingRequest = + new DefaultProjectBuildingRequest(mavenSession.getProjectBuildingRequest()); + buildingRequest.setRemoteRepositories(project.getRemoteArtifactRepositories()); DependencyResolutionRequest request = new DefaultDependencyResolutionRequest(); - request.setMavenProject( project ); - request.setRepositorySession( buildingRequest.getRepositorySession() ); + request.setMavenProject(project); + request.setRepositorySession(buildingRequest.getRepositorySession()); - DependencyResolutionResult result = dependencyResolver.resolve( request ); + DependencyResolutionResult result = dependencyResolver.resolve(request); - getLog().info( "Resolution successful, resolved ok" ); - } - catch ( Exception e ) - { - getLog().error( "Resolution failed, could not resolve ranged dependency" - + " (you hit MNG-7529)" ); + getLog().info("Resolution successful, resolved ok"); + } catch (Exception e) { + getLog().error("Resolution failed, could not resolve ranged dependency" + " (you hit MNG-7529)"); } } } diff --git a/its/core-it-support/core-it-plugins/pom.xml b/its/core-it-support/core-it-plugins/pom.xml index 40ed164c92..ef7f6ba889 100644 --- a/its/core-it-support/core-it-plugins/pom.xml +++ b/its/core-it-support/core-it-plugins/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 diff --git a/its/core-it-support/core-it-support-artifacts/pom.xml b/its/core-it-support/core-it-support-artifacts/pom.xml index 1b9115ffb9..ac26ab88fb 100644 --- a/its/core-it-support/core-it-support-artifacts/pom.xml +++ b/its/core-it-support/core-it-support-artifacts/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 @@ -45,10 +43,10 @@ under the License. - package single + package diff --git a/its/core-it-support/core-it-toolchain/pom.xml b/its/core-it-support/core-it-toolchain/pom.xml index 9b4cb7bd30..eb21cdbe1a 100644 --- a/its/core-it-support/core-it-toolchain/pom.xml +++ b/its/core-it-support/core-it-toolchain/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 diff --git a/its/core-it-support/core-it-toolchain/src/main/java/org/apache/maven/coreit/toolchain/CoreItToolchain.java b/its/core-it-support/core-it-toolchain/src/main/java/org/apache/maven/coreit/toolchain/CoreItToolchain.java index 9bc51e81a6..a05efaef96 100644 --- a/its/core-it-support/core-it-toolchain/src/main/java/org/apache/maven/coreit/toolchain/CoreItToolchain.java +++ b/its/core-it-support/core-it-toolchain/src/main/java/org/apache/maven/coreit/toolchain/CoreItToolchain.java @@ -1,5 +1,3 @@ -package org.apache.maven.coreit.toolchain; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,7 @@ package org.apache.maven.coreit.toolchain; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.coreit.toolchain; import java.util.Map; @@ -28,35 +27,27 @@ import org.apache.maven.toolchain.model.ToolchainModel; /** * @author Benjamin Bentmann */ -public class CoreItToolchain - implements Toolchain, ToolchainPrivate -{ +public class CoreItToolchain implements Toolchain, ToolchainPrivate { private ToolchainModel model; - public CoreItToolchain( ToolchainModel model ) - { + public CoreItToolchain(ToolchainModel model) { this.model = model; } - public String getType() - { + public String getType() { return "coreit"; } - public String findTool( String toolName ) - { + public String findTool(String toolName) { return toolName; } - public ToolchainModel getModel() - { + public ToolchainModel getModel() { return model; } - public boolean matchesRequirements( Map requirements ) - { + public boolean matchesRequirements(Map requirements) { return true; } - } diff --git a/its/core-it-support/core-it-toolchain/src/main/java/org/apache/maven/coreit/toolchain/CoreItToolchainFactory.java b/its/core-it-support/core-it-toolchain/src/main/java/org/apache/maven/coreit/toolchain/CoreItToolchainFactory.java index 62bd828b45..004ac24dd7 100644 --- a/its/core-it-support/core-it-toolchain/src/main/java/org/apache/maven/coreit/toolchain/CoreItToolchainFactory.java +++ b/its/core-it-support/core-it-toolchain/src/main/java/org/apache/maven/coreit/toolchain/CoreItToolchainFactory.java @@ -1,5 +1,3 @@ -package org.apache.maven.coreit.toolchain; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,6 +16,7 @@ package org.apache.maven.coreit.toolchain; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.coreit.toolchain; import org.apache.maven.toolchain.MisconfiguredToolchainException; import org.apache.maven.toolchain.ToolchainFactory; @@ -27,23 +26,16 @@ import org.apache.maven.toolchain.model.ToolchainModel; /** * @author Benjamin Bentmann */ -public class CoreItToolchainFactory - implements ToolchainFactory -{ +public class CoreItToolchainFactory implements ToolchainFactory { - public ToolchainPrivate createDefaultToolchain() - { + public ToolchainPrivate createDefaultToolchain() { return null; } - public ToolchainPrivate createToolchain( ToolchainModel model ) - throws MisconfiguredToolchainException - { - if ( model == null ) - { + public ToolchainPrivate createToolchain(ToolchainModel model) throws MisconfiguredToolchainException { + if (model == null) { return null; } - return new CoreItToolchain( model ); + return new CoreItToolchain(model); } - } diff --git a/its/core-it-support/core-it-wagon/pom.xml b/its/core-it-support/core-it-wagon/pom.xml index 2df737ec17..cb2cb20369 100644 --- a/its/core-it-support/core-it-wagon/pom.xml +++ b/its/core-it-support/core-it-wagon/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 diff --git a/its/core-it-support/core-it-wagon/src/main/java/org/apache/maven/wagon/providers/coreit/CoreItHttpWagon.java b/its/core-it-support/core-it-wagon/src/main/java/org/apache/maven/wagon/providers/coreit/CoreItHttpWagon.java index 1141e59799..cbaab7e016 100644 --- a/its/core-it-support/core-it-wagon/src/main/java/org/apache/maven/wagon/providers/coreit/CoreItHttpWagon.java +++ b/its/core-it-support/core-it-wagon/src/main/java/org/apache/maven/wagon/providers/coreit/CoreItHttpWagon.java @@ -1,5 +1,3 @@ -package org.apache.maven.wagon.providers.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.wagon.providers.coreit; * "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 + * 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 @@ -18,6 +16,16 @@ package org.apache.maven.wagon.providers.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.wagon.providers.coreit; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.Properties; import org.apache.maven.wagon.AbstractWagon; import org.apache.maven.wagon.ConnectionException; @@ -30,160 +38,118 @@ import org.apache.maven.wagon.authorization.AuthorizationException; import org.apache.maven.wagon.resource.Resource; import org.codehaus.plexus.component.annotations.Component; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.Properties; - /** * Shamelessly copied from ScpExternalWagon in this same project... */ -@Component( role = org.apache.maven.wagon.Wagon.class, hint = "http-coreit", instantiationStrategy = "per-lookup" ) -public class CoreItHttpWagon - extends AbstractWagon -{ - public void get( String resourceName, File destination ) - throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException - { +@Component(role = org.apache.maven.wagon.Wagon.class, hint = "http-coreit", instantiationStrategy = "per-lookup") +public class CoreItHttpWagon extends AbstractWagon { + public void get(String resourceName, File destination) + throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException { InputData inputData = new InputData(); - Resource resource = new Resource( resourceName ); + Resource resource = new Resource(resourceName); - fireGetInitiated( resource, destination ); + fireGetInitiated(resource, destination); - inputData.setResource( resource ); + inputData.setResource(resource); - fillInputData( inputData ); + fillInputData(inputData); InputStream is = inputData.getInputStream(); - if ( is == null ) - { + if (is == null) { throw new TransferFailedException( - getRepository().getUrl() + " - Could not open input stream for resource: '" + resource + "'" ); + getRepository().getUrl() + " - Could not open input stream for resource: '" + resource + "'"); } - createParentDirectories( destination ); + createParentDirectories(destination); - getTransfer( inputData.getResource(), destination, is ); + getTransfer(inputData.getResource(), destination, is); } - public boolean getIfNewer( String resourceName, File destination, long timestamp ) - throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException - { + public boolean getIfNewer(String resourceName, File destination, long timestamp) + throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException { return false; } - public void put( File source, String resourceName ) - throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException - { + public void put(File source, String resourceName) + throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException { OutputData outputData = new OutputData(); - Resource resource = new Resource( resourceName ); + Resource resource = new Resource(resourceName); - firePutInitiated( resource, source ); + firePutInitiated(resource, source); - outputData.setResource( resource ); + outputData.setResource(resource); - fillOutputData( outputData ); + fillOutputData(outputData); OutputStream os = outputData.getOutputStream(); - if ( os == null ) - { + if (os == null) { throw new TransferFailedException( - getRepository().getUrl() + " - Could not open output stream for resource: '" + resource + "'" ); + getRepository().getUrl() + " - Could not open output stream for resource: '" + resource + "'"); } - putTransfer( outputData.getResource(), source, os, true ); + putTransfer(outputData.getResource(), source, os, true); } - public void closeConnection() - throws ConnectionException - { - File f = new File( "target/wagon-data" ); - try - { + public void closeConnection() throws ConnectionException { + File f = new File("target/wagon-data"); + try { f.getParentFile().mkdirs(); f.createNewFile(); - } - catch ( IOException e ) - { - throw new ConnectionException( e.getMessage(), e ); + } catch (IOException e) { + throw new ConnectionException(e.getMessage(), e); } } - public void fillInputData( InputData inputData ) - throws TransferFailedException, ResourceDoesNotExistException - { - try - { + public void fillInputData(InputData inputData) throws TransferFailedException, ResourceDoesNotExistException { + try { String resName = inputData.getResource().getName(); InputStream is = null; - if ( resName.endsWith( ".sha1" ) ) - { - is = new ByteArrayInputStream( "c96e29be962f9d8123b584b8f51d66b347d268d4".getBytes( "UTF-8" ) ); + if (resName.endsWith(".sha1")) { + is = new ByteArrayInputStream("c96e29be962f9d8123b584b8f51d66b347d268d4".getBytes("UTF-8")); + } else if (resName.endsWith(".md5")) { + is = new ByteArrayInputStream("d2b637ab8965308490bc6482c860dfc5".getBytes("UTF-8")); + } else { + is = new ByteArrayInputStream("".getBytes("UTF-8")); } - else if ( resName.endsWith( ".md5" ) ) - { - is = new ByteArrayInputStream( "d2b637ab8965308490bc6482c860dfc5".getBytes( "UTF-8" ) ); - } - else - { - is = new ByteArrayInputStream( "".getBytes( "UTF-8" ) ); - } - inputData.setInputStream( is ); - } - catch ( IOException e ) - { - throw new TransferFailedException( "Broken JVM", e ); + inputData.setInputStream(is); + } catch (IOException e) { + throw new TransferFailedException("Broken JVM", e); } } - public void fillOutputData( OutputData outputData ) - throws TransferFailedException - { + public void fillOutputData(OutputData outputData) throws TransferFailedException { Properties props = new Properties(); - if ( getRepository().getPermissions() != null ) - { + if (getRepository().getPermissions() != null) { String dirPerms = getRepository().getPermissions().getDirectoryMode(); - if ( dirPerms != null ) - { - props.setProperty( "directory.mode", dirPerms ); + if (dirPerms != null) { + props.setProperty("directory.mode", dirPerms); } String filePerms = getRepository().getPermissions().getFileMode(); - if ( filePerms != null ) - { - props.setProperty( "file.mode", filePerms ); + if (filePerms != null) { + props.setProperty("file.mode", filePerms); } } - try - { - new File( "target" ).mkdirs(); + try { + new File("target").mkdirs(); - try ( OutputStream os = new FileOutputStream( "target/wagon.properties" ) ) - { - props.store( os, "MAVEN-CORE-IT-WAGON" ); + try (OutputStream os = new FileOutputStream("target/wagon.properties")) { + props.store(os, "MAVEN-CORE-IT-WAGON"); } - } - catch ( IOException e ) - { - throw new TransferFailedException( e.getMessage(), e ); + } catch (IOException e) { + throw new TransferFailedException(e.getMessage(), e); } - outputData.setOutputStream( new ByteArrayOutputStream() ); + outputData.setOutputStream(new ByteArrayOutputStream()); } - public void openConnection() - throws ConnectionException, AuthenticationException - { + public void openConnection() throws ConnectionException, AuthenticationException { // ignore } } diff --git a/its/core-it-support/core-it-wagon/src/main/java/org/apache/maven/wagon/providers/coreit/CoreItWagon.java b/its/core-it-support/core-it-wagon/src/main/java/org/apache/maven/wagon/providers/coreit/CoreItWagon.java index fdd1098e6d..59941de487 100644 --- a/its/core-it-support/core-it-wagon/src/main/java/org/apache/maven/wagon/providers/coreit/CoreItWagon.java +++ b/its/core-it-support/core-it-wagon/src/main/java/org/apache/maven/wagon/providers/coreit/CoreItWagon.java @@ -1,5 +1,3 @@ -package org.apache.maven.wagon.providers.coreit; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.wagon.providers.coreit; * "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 + * 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 @@ -18,6 +16,16 @@ package org.apache.maven.wagon.providers.coreit; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.wagon.providers.coreit; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.Properties; import org.apache.maven.wagon.AbstractWagon; import org.apache.maven.wagon.ConnectionException; @@ -31,174 +39,130 @@ import org.apache.maven.wagon.authorization.AuthorizationException; import org.apache.maven.wagon.resource.Resource; import org.codehaus.plexus.component.annotations.Component; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.Properties; - /** * Shamelessly copied from ScpExternalWagon in this same project... */ -@Component( role = org.apache.maven.wagon.Wagon.class, hint = "coreit", instantiationStrategy = "per-lookup" ) -public class CoreItWagon - extends AbstractWagon -{ - public void get( String resourceName, File destination ) - throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException - { +@Component(role = org.apache.maven.wagon.Wagon.class, hint = "coreit", instantiationStrategy = "per-lookup") +public class CoreItWagon extends AbstractWagon { + public void get(String resourceName, File destination) + throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException { InputData inputData = new InputData(); - Resource resource = new Resource( resourceName ); + Resource resource = new Resource(resourceName); - fireGetInitiated( resource, destination ); + fireGetInitiated(resource, destination); - inputData.setResource( resource ); + inputData.setResource(resource); - fillInputData( inputData ); + fillInputData(inputData); InputStream is = inputData.getInputStream(); - if ( is == null ) - { + if (is == null) { throw new TransferFailedException( - getRepository().getUrl() + " - Could not open input stream for resource: '" + resource + "'" ); + getRepository().getUrl() + " - Could not open input stream for resource: '" + resource + "'"); } - createParentDirectories( destination ); + createParentDirectories(destination); - getTransfer( inputData.getResource(), destination, is ); + getTransfer(inputData.getResource(), destination, is); } - public boolean getIfNewer( String resourceName, File destination, long timestamp ) - throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException - { + public boolean getIfNewer(String resourceName, File destination, long timestamp) + throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException { return false; } - public void put( File source, String resourceName ) - throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException - { + public void put(File source, String resourceName) + throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException { OutputData outputData = new OutputData(); - Resource resource = new Resource( resourceName ); + Resource resource = new Resource(resourceName); - firePutInitiated( resource, source ); + firePutInitiated(resource, source); - outputData.setResource( resource ); + outputData.setResource(resource); - fillOutputData( outputData ); + fillOutputData(outputData); OutputStream os = outputData.getOutputStream(); - if ( os == null ) - { + if (os == null) { throw new TransferFailedException( - getRepository().getUrl() + " - Could not open output stream for resource: '" + resource + "'" ); + getRepository().getUrl() + " - Could not open output stream for resource: '" + resource + "'"); } - putTransfer( outputData.getResource(), source, os, true ); + putTransfer(outputData.getResource(), source, os, true); } - public void closeConnection() - throws ConnectionException - { - File f = new File( "target/wagon-data" ); - try - { + public void closeConnection() throws ConnectionException { + File f = new File("target/wagon-data"); + try { f.getParentFile().mkdirs(); f.createNewFile(); - } - catch ( IOException e ) - { - throw new ConnectionException( e.getMessage(), e ); + } catch (IOException e) { + throw new ConnectionException(e.getMessage(), e); } } - public void fillInputData( InputData inputData ) - throws TransferFailedException, ResourceDoesNotExistException - { - try - { + public void fillInputData(InputData inputData) throws TransferFailedException, ResourceDoesNotExistException { + try { String resName = inputData.getResource().getName(); InputStream is = null; - if ( resName.endsWith( ".sha1" ) ) - { - is = new ByteArrayInputStream( "c96e29be962f9d8123b584b8f51d66b347d268d4".getBytes( "UTF-8" ) ); + if (resName.endsWith(".sha1")) { + is = new ByteArrayInputStream("c96e29be962f9d8123b584b8f51d66b347d268d4".getBytes("UTF-8")); + } else if (resName.endsWith(".md5")) { + is = new ByteArrayInputStream("d2b637ab8965308490bc6482c860dfc5".getBytes("UTF-8")); + } else { + is = new ByteArrayInputStream("".getBytes("UTF-8")); } - else if ( resName.endsWith( ".md5" ) ) - { - is = new ByteArrayInputStream( "d2b637ab8965308490bc6482c860dfc5".getBytes( "UTF-8" ) ); - } - else - { - is = new ByteArrayInputStream( "".getBytes( "UTF-8" ) ); - } - inputData.setInputStream( is ); - } - catch ( IOException e ) - { - throw new TransferFailedException( "Broken JVM", e ); + inputData.setInputStream(is); + } catch (IOException e) { + throw new TransferFailedException("Broken JVM", e); } } - public void fillOutputData( OutputData outputData ) - throws TransferFailedException - { + public void fillOutputData(OutputData outputData) throws TransferFailedException { Properties props = new Properties(); - if ( getRepository().getPermissions() != null ) - { + if (getRepository().getPermissions() != null) { String dirPerms = getRepository().getPermissions().getDirectoryMode(); - put( props, "directory.mode", dirPerms ); + put(props, "directory.mode", dirPerms); String filePerms = getRepository().getPermissions().getFileMode(); - put( props, "file.mode", filePerms ); + put(props, "file.mode", filePerms); } AuthenticationInfo auth = getAuthenticationInfo(); - if ( auth != null ) - { - put( props, "username", auth.getUserName() ); - put( props, "password", auth.getPassword() ); - put( props, "privateKey", auth.getPrivateKey() ); - put( props, "passphrase", auth.getPassphrase() ); + if (auth != null) { + put(props, "username", auth.getUserName()); + put(props, "password", auth.getPassword()); + put(props, "privateKey", auth.getPrivateKey()); + put(props, "passphrase", auth.getPassphrase()); } - try - { - File file = new File( System.getProperty( "user.dir" ), "target/wagon.properties" ).getAbsoluteFile(); + try { + File file = new File(System.getProperty("user.dir"), "target/wagon.properties").getAbsoluteFile(); file.getParentFile().mkdirs(); - try ( OutputStream os = new FileOutputStream( file ) ) - { - props.store( os, "MAVEN-CORE-IT-WAGON" ); + try (OutputStream os = new FileOutputStream(file)) { + props.store(os, "MAVEN-CORE-IT-WAGON"); } - } - catch ( IOException e ) - { - throw new TransferFailedException( e.getMessage(), e ); + } catch (IOException e) { + throw new TransferFailedException(e.getMessage(), e); } - outputData.setOutputStream( new ByteArrayOutputStream() ); + outputData.setOutputStream(new ByteArrayOutputStream()); } - public void openConnection() - throws ConnectionException, AuthenticationException - { + public void openConnection() throws ConnectionException, AuthenticationException { // ignore } - private void put( Properties props, String key, String value ) - { - if ( value != null ) - { - props.setProperty( key, value ); + private void put(Properties props, String key, String value) { + if (value != null) { + props.setProperty(key, value); } } - } diff --git a/its/core-it-support/core-it-wagon/src/main/java/org/apache/maven/wagon/providers/ssh/external/ScpExternalWagon.java b/its/core-it-support/core-it-wagon/src/main/java/org/apache/maven/wagon/providers/ssh/external/ScpExternalWagon.java index f608bb40ae..d0eac5ffe0 100644 --- a/its/core-it-support/core-it-wagon/src/main/java/org/apache/maven/wagon/providers/ssh/external/ScpExternalWagon.java +++ b/its/core-it-support/core-it-wagon/src/main/java/org/apache/maven/wagon/providers/ssh/external/ScpExternalWagon.java @@ -1,5 +1,3 @@ -package org.apache.maven.wagon.providers.ssh.external; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.wagon.providers.ssh.external; * "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 + * 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 @@ -18,6 +16,16 @@ package org.apache.maven.wagon.providers.ssh.external; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.wagon.providers.ssh.external; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.Properties; import org.apache.maven.wagon.AbstractWagon; import org.apache.maven.wagon.ConnectionException; @@ -30,154 +38,111 @@ import org.apache.maven.wagon.authorization.AuthorizationException; import org.apache.maven.wagon.resource.Resource; import org.codehaus.plexus.component.annotations.Component; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.Properties; - /** * NOTE: Plexus will only pick this correctly if the Class package and name are the same as that in core. This is * because the core component descriptor is read, but the class is read from the latter JAR. */ -@Component( role = org.apache.maven.wagon.Wagon.class, hint = "scpexe", instantiationStrategy = "per-lookup" ) -public class ScpExternalWagon - extends AbstractWagon -{ - public void get( String resourceName, File destination ) - throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException - { +@Component(role = org.apache.maven.wagon.Wagon.class, hint = "scpexe", instantiationStrategy = "per-lookup") +public class ScpExternalWagon extends AbstractWagon { + public void get(String resourceName, File destination) + throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException { InputData inputData = new InputData(); - Resource resource = new Resource( resourceName ); + Resource resource = new Resource(resourceName); - fireGetInitiated( resource, destination ); + fireGetInitiated(resource, destination); - inputData.setResource( resource ); + inputData.setResource(resource); - fillInputData( inputData ); + fillInputData(inputData); InputStream is = inputData.getInputStream(); - if ( is == null ) - { + if (is == null) { throw new TransferFailedException( - getRepository().getUrl() + " - Could not open input stream for resource: '" + resource + "'" ); + getRepository().getUrl() + " - Could not open input stream for resource: '" + resource + "'"); } - createParentDirectories( destination ); + createParentDirectories(destination); - getTransfer( inputData.getResource(), destination, is ); + getTransfer(inputData.getResource(), destination, is); } - public boolean getIfNewer( String resourceName, File destination, long timestamp ) - throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException - { + public boolean getIfNewer(String resourceName, File destination, long timestamp) + throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException { return false; } - public void put( File source, String resourceName ) - throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException - { + public void put(File source, String resourceName) + throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException { OutputData outputData = new OutputData(); - Resource resource = new Resource( resourceName ); + Resource resource = new Resource(resourceName); - firePutInitiated( resource, source ); + firePutInitiated(resource, source); - outputData.setResource( resource ); + outputData.setResource(resource); - writeTestProperties( source.getParentFile() ); + writeTestProperties(source.getParentFile()); - fillOutputData( outputData ); + fillOutputData(outputData); OutputStream os = outputData.getOutputStream(); - if ( os == null ) - { + if (os == null) { throw new TransferFailedException( - getRepository().getUrl() + " - Could not open output stream for resource: '" + resource + "'" ); + getRepository().getUrl() + " - Could not open output stream for resource: '" + resource + "'"); } - putTransfer( outputData.getResource(), source, os, true ); + putTransfer(outputData.getResource(), source, os, true); } - public void closeConnection() - throws ConnectionException - { - } + public void closeConnection() throws ConnectionException {} - public void fillInputData( InputData inputData ) - throws TransferFailedException, ResourceDoesNotExistException - { - try - { + public void fillInputData(InputData inputData) throws TransferFailedException, ResourceDoesNotExistException { + try { String resName = inputData.getResource().getName(); InputStream is = null; - if ( resName.endsWith( ".sha1" ) ) - { - is = new ByteArrayInputStream( "c96e29be962f9d8123b584b8f51d66b347d268d4".getBytes( "UTF-8" ) ); + if (resName.endsWith(".sha1")) { + is = new ByteArrayInputStream("c96e29be962f9d8123b584b8f51d66b347d268d4".getBytes("UTF-8")); + } else if (resName.endsWith(".md5")) { + is = new ByteArrayInputStream("d2b637ab8965308490bc6482c860dfc5".getBytes("UTF-8")); + } else { + is = new ByteArrayInputStream("".getBytes("UTF-8")); } - else if ( resName.endsWith( ".md5" ) ) - { - is = new ByteArrayInputStream( "d2b637ab8965308490bc6482c860dfc5".getBytes( "UTF-8" ) ); - } - else - { - is = new ByteArrayInputStream( "".getBytes( "UTF-8" ) ); - } - inputData.setInputStream( is ); - } - catch ( IOException e ) - { - throw new TransferFailedException( "Broken JVM", e ); + inputData.setInputStream(is); + } catch (IOException e) { + throw new TransferFailedException("Broken JVM", e); } } - public void writeTestProperties( File dir ) - throws TransferFailedException - { + public void writeTestProperties(File dir) throws TransferFailedException { Properties props = new Properties(); - if ( getRepository().getPermissions() != null ) - { + if (getRepository().getPermissions() != null) { String dirPerms = getRepository().getPermissions().getDirectoryMode(); - if ( dirPerms != null ) - { - props.setProperty( "directory.mode", dirPerms ); + if (dirPerms != null) { + props.setProperty("directory.mode", dirPerms); } String filePerms = getRepository().getPermissions().getFileMode(); - if ( filePerms != null ) - { - props.setProperty( "file.mode", filePerms ); + if (filePerms != null) { + props.setProperty("file.mode", filePerms); } } - try - { - try ( OutputStream os = new FileOutputStream( new File( dir, "wagon.properties" ) ) ) - { - props.store( os, "MAVEN-CORE-IT-WAGON" ); + try { + try (OutputStream os = new FileOutputStream(new File(dir, "wagon.properties"))) { + props.store(os, "MAVEN-CORE-IT-WAGON"); } - } - catch ( IOException e ) - { - throw new TransferFailedException( e.getMessage(), e ); + } catch (IOException e) { + throw new TransferFailedException(e.getMessage(), e); } } - public void fillOutputData( OutputData outputData ) - throws TransferFailedException - { - outputData.setOutputStream( new ByteArrayOutputStream() ); + public void fillOutputData(OutputData outputData) throws TransferFailedException { + outputData.setOutputStream(new ByteArrayOutputStream()); } - public void openConnection() - throws ConnectionException, AuthenticationException - { - } + public void openConnection() throws ConnectionException, AuthenticationException {} } diff --git a/its/core-it-support/maven-it-helper/pom.xml b/its/core-it-support/maven-it-helper/pom.xml index 2fdc6f104b..0e090bd49a 100644 --- a/its/core-it-support/maven-it-helper/pom.xml +++ b/its/core-it-support/maven-it-helper/pom.xml @@ -1,5 +1,4 @@ - - - + 4.0.0 @@ -41,8 +38,8 @@ under the License. 3.0 - plexus-utils org.codehaus.plexus + plexus-utils diff --git a/its/core-it-support/maven-it-helper/src/main/java/org/apache/maven/it/AbstractMavenIntegrationTestCase.java b/its/core-it-support/maven-it-helper/src/main/java/org/apache/maven/it/AbstractMavenIntegrationTestCase.java index 3b6c299571..7df7e5ce53 100644 --- a/its/core-it-support/maven-it-helper/src/main/java/org/apache/maven/it/AbstractMavenIntegrationTestCase.java +++ b/its/core-it-support/maven-it-helper/src/main/java/org/apache/maven/it/AbstractMavenIntegrationTestCase.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.it; * "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 + * 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 @@ -18,6 +16,7 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.it; import java.io.File; import java.io.FilterInputStream; @@ -46,8 +45,7 @@ import org.opentest4j.TestAbortedException; * @author Jason van Zyl * @author Kenney Westerhof */ -public abstract class AbstractMavenIntegrationTestCase -{ +public abstract class AbstractMavenIntegrationTestCase { /** * Save System.out for progress reports etc. */ @@ -57,7 +55,7 @@ public abstract class AbstractMavenIntegrationTestCase * The format for elapsed time. */ private static final DecimalFormat SECS_FORMAT = - new DecimalFormat( "(0.0 s)", new DecimalFormatSymbols( Locale.ENGLISH ) ); + new DecimalFormat("(0.0 s)", new DecimalFormatSymbols(Locale.ENGLISH)); /** * The zero-based column index where to print the test result. @@ -82,25 +80,20 @@ public abstract class AbstractMavenIntegrationTestCase protected static final String ALL_MAVEN_VERSIONS = "[2.0,)"; - protected AbstractMavenIntegrationTestCase( String versionRangeStr ) - { - this( versionRangeStr, DEFAULT_MATCH_PATTERN ); + protected AbstractMavenIntegrationTestCase(String versionRangeStr) { + this(versionRangeStr, DEFAULT_MATCH_PATTERN); } - protected AbstractMavenIntegrationTestCase( String versionRangeStr, String matchPattern ) - { + protected AbstractMavenIntegrationTestCase(String versionRangeStr, String matchPattern) { this.matchPattern = matchPattern; - requiresMavenVersion( versionRangeStr ); + requiresMavenVersion(versionRangeStr); } - @BeforeAll - static void setupInputStream() - { - if ( !( System.in instanceof NonCloseableInputStream ) ) - { - System.setIn( new NonCloseableInputStream( System.in ) ); + static void setupInputStream() { + if (!(System.in instanceof NonCloseableInputStream)) { + System.setIn(new NonCloseableInputStream(System.in)); } } @@ -109,18 +102,16 @@ public abstract class AbstractMavenIntegrationTestCase * * @return The Java version, never null. */ - private ArtifactVersion getJavaVersion() - { - if ( javaVersion == null ) - { - String version = System.getProperty( "java.version" ); - version = version.replaceAll( "[_-]", "." ); - Matcher matcher = Pattern.compile( "(?s).*?(([0-9]+\\.[0-9]+)(\\.[0-9]+)?).*" ).matcher( version ); - if ( matcher.matches() ) - { - version = matcher.group( 1 ); + private ArtifactVersion getJavaVersion() { + if (javaVersion == null) { + String version = System.getProperty("java.version"); + version = version.replaceAll("[_-]", "."); + Matcher matcher = + Pattern.compile("(?s).*?(([0-9]+\\.[0-9]+)(\\.[0-9]+)?).*").matcher(version); + if (matcher.matches()) { + version = matcher.group(1); } - javaVersion = new DefaultArtifactVersion( version ); + javaVersion = new DefaultArtifactVersion(version); } return javaVersion; } @@ -130,30 +121,23 @@ public abstract class AbstractMavenIntegrationTestCase * * @return The Maven version or null if unknown. */ - protected final ArtifactVersion getMavenVersion() - { - if ( mavenVersion == null ) - { - String version = System.getProperty( "maven.version", "" ); + protected final ArtifactVersion getMavenVersion() { + if (mavenVersion == null) { + String version = System.getProperty("maven.version", ""); - if ( version.length() <= 0 || version.startsWith( "${" ) ) - { - try - { - Verifier verifier = new Verifier( "" ); + if (version.length() <= 0 || version.startsWith("${")) { + try { + Verifier verifier = new Verifier(""); version = verifier.getMavenVersion(); - System.setProperty( "maven.version", version ); - } - catch ( VerificationException e ) - { + System.setProperty("maven.version", version); + } catch (VerificationException e) { e.printStackTrace(); } } // NOTE: If the version looks like "${...}" it has been configured from an undefined expression - if ( version != null && version.length() > 0 && !version.startsWith( "${" ) ) - { - mavenVersion = new DefaultArtifactVersion( version ); + if (version != null && version.length() > 0 && !version.startsWith("${")) { + mavenVersion = new DefaultArtifactVersion(version); } } return mavenVersion; @@ -164,27 +148,20 @@ public abstract class AbstractMavenIntegrationTestCase * by allowing tests to adjust to the current Maven version, or else simply avoid * executing altogether if the wrong version is present. */ - protected boolean matchesVersionRange( String versionRangeStr ) - { + protected boolean matchesVersionRange(String versionRangeStr) { VersionRange versionRange; - try - { - versionRange = VersionRange.createFromVersionSpec( versionRangeStr ); - } - catch ( InvalidVersionSpecificationException e ) - { - throw (RuntimeException) new IllegalArgumentException( "Invalid version range: " + versionRangeStr, e ); + try { + versionRange = VersionRange.createFromVersionSpec(versionRangeStr); + } catch (InvalidVersionSpecificationException e) { + throw (RuntimeException) new IllegalArgumentException("Invalid version range: " + versionRangeStr, e); } ArtifactVersion version = getMavenVersion(); - if ( version != null ) - { - return versionRange.containsVersion( removePattern( version ) ); - } - else - { - out.println( "WARNING: " + getITName() + ": version range '" + versionRange - + "' supplied but no Maven version found - returning true for match check." ); + if (version != null) { + return versionRange.containsVersion(removePattern(version)); + } else { + out.println("WARNING: " + getITName() + ": version range '" + versionRange + + "' supplied but no Maven version found - returning true for match check."); return true; } @@ -195,99 +172,74 @@ public abstract class AbstractMavenIntegrationTestCase * * @return */ - protected final boolean isSkipped() - { + protected final boolean isSkipped() { return skip; } - protected void runTest() - throws Throwable - { + protected void runTest() throws Throwable { String testName = getTestName(); - if ( testName.startsWith( "mng" ) || Character.isDigit( testName.charAt( 0 ) ) ) - { + if (testName.startsWith("mng") || Character.isDigit(testName.charAt(0))) { int mng = 4; - while ( Character.isDigit( testName.charAt( mng ) ) ) - { + while (Character.isDigit(testName.charAt(mng))) { mng++; } - out.print( AnsiSupport.bold( testName.substring( 0, mng ) ) ); - out.print( ' ' ); - out.print( testName.substring( mng ) ); - } - else - { - int index = testName.indexOf( ' ' ); - if ( index == -1 ) - { - out.print( testName ); + out.print(AnsiSupport.bold(testName.substring(0, mng))); + out.print(' '); + out.print(testName.substring(mng)); + } else { + int index = testName.indexOf(' '); + if (index == -1) { + out.print(testName); + } else { + out.print(AnsiSupport.bold(testName.substring(0, index))); + out.print(testName.substring(index)); } - else - { - out.print( AnsiSupport.bold( testName.substring( 0, index ) ) ); - out.print( testName.substring( index ) ); - } - out.print( '.' ); + out.print('.'); } - out.print( pad( RESULT_COLUMN - testName.length() ) ); - out.print( ' ' ); + out.print(pad(RESULT_COLUMN - testName.length())); + out.print(' '); - if ( skip ) - { - out.println( AnsiSupport.warning( "SKIPPED" ) + " - Maven version " + getMavenVersion() + " not in range " - + versionRange ); + if (skip) { + out.println(AnsiSupport.warning("SKIPPED") + " - Maven version " + getMavenVersion() + " not in range " + + versionRange); return; } - if ( "true".equals( System.getProperty( "useEmptyLocalRepository", "false" ) ) ) - { + if ("true".equals(System.getProperty("useEmptyLocalRepository", "false"))) { setupLocalRepo(); } invert = null; long milliseconds = System.currentTimeMillis(); - try - { + try { // TODO: JUNIT5 - //super.runTest(); + // super.runTest(); milliseconds = System.currentTimeMillis() - milliseconds; - if ( invert != null ) - { + if (invert != null) { throw invert; } - out.println( AnsiSupport.success( "OK" ) + " " + formatTime( milliseconds ) ); - } - catch ( UnsupportedJavaVersionException e ) - { - out.println( AnsiSupport.warning( "SKIPPED" ) + " - Java version " + e.javaVersion + " not in range " - + e.supportedRange ); + out.println(AnsiSupport.success("OK") + " " + formatTime(milliseconds)); + } catch (UnsupportedJavaVersionException e) { + out.println(AnsiSupport.warning("SKIPPED") + " - Java version " + e.javaVersion + " not in range " + + e.supportedRange); return; - } - catch ( UnsupportedMavenVersionException e ) - { - out.println( AnsiSupport.warning( "SKIPPED" ) + " - Maven version " + e.mavenVersion + " not in range " - + e.supportedRange ); + } catch (UnsupportedMavenVersionException e) { + out.println(AnsiSupport.warning("SKIPPED") + " - Maven version " + e.mavenVersion + " not in range " + + e.supportedRange); return; - } - catch ( BrokenMavenVersionException e ) - { - out.println( AnsiSupport.error( "UNEXPECTED OK" ) + " - Maven version " + e.mavenVersion - + " expected to fail " + formatTime( milliseconds ) ); - fail( "Expected failure when with Maven version " + e.mavenVersion ); - } - catch ( Throwable t ) - { + } catch (BrokenMavenVersionException e) { + out.println(AnsiSupport.error("UNEXPECTED OK") + " - Maven version " + e.mavenVersion + " expected to fail " + + formatTime(milliseconds)); + fail("Expected failure when with Maven version " + e.mavenVersion); + } catch (Throwable t) { milliseconds = System.currentTimeMillis() - milliseconds; - if ( invert != null ) - { - out.println( AnsiSupport.success( "EXPECTED FAIL" ) + " - Maven version " + invert.mavenVersion - + " expected to fail " + formatTime( milliseconds ) ); - } - else - { - out.println( AnsiSupport.error( "FAILURE" ) + " " + formatTime( milliseconds ) ); + if (invert != null) { + out.println(AnsiSupport.success("EXPECTED FAIL") + " - Maven version " + invert.mavenVersion + + " expected to fail " + formatTime(milliseconds)); + } else { + out.println(AnsiSupport.error("FAILURE") + " " + formatTime(milliseconds)); throw t; } } @@ -301,22 +253,17 @@ public abstract class AbstractMavenIntegrationTestCase * @param versionRange The version range that specifies the acceptable Java versions for the test, must not be * null. */ - protected void requiresJavaVersion( String versionRange ) - { + protected void requiresJavaVersion(String versionRange) { VersionRange range; - try - { - range = VersionRange.createFromVersionSpec( versionRange ); - } - catch ( InvalidVersionSpecificationException e ) - { - throw (RuntimeException) new IllegalArgumentException( "Invalid version range: " + versionRange, e ); + try { + range = VersionRange.createFromVersionSpec(versionRange); + } catch (InvalidVersionSpecificationException e) { + throw (RuntimeException) new IllegalArgumentException("Invalid version range: " + versionRange, e); } ArtifactVersion version = getJavaVersion(); - if ( !range.containsVersion( version ) ) - { - throw new UnsupportedJavaVersionException( version, range ); + if (!range.containsVersion(version)) { + throw new UnsupportedJavaVersionException(version, range); } } @@ -328,30 +275,22 @@ public abstract class AbstractMavenIntegrationTestCase * @param versionRange The version range that specifies the acceptable Maven versions for the test, must not be * null. */ - protected void requiresMavenVersion( String versionRange ) - { + protected void requiresMavenVersion(String versionRange) { VersionRange range; - try - { - range = VersionRange.createFromVersionSpec( versionRange ); - } - catch ( InvalidVersionSpecificationException e ) - { - throw (RuntimeException) new IllegalArgumentException( "Invalid version range: " + versionRange, e ); + try { + range = VersionRange.createFromVersionSpec(versionRange); + } catch (InvalidVersionSpecificationException e) { + throw (RuntimeException) new IllegalArgumentException("Invalid version range: " + versionRange, e); } ArtifactVersion version = getMavenVersion(); - if ( version != null ) - { - if ( !range.containsVersion( removePattern( version ) ) ) - { - throw new UnsupportedMavenVersionException( version, range ); + if (version != null) { + if (!range.containsVersion(removePattern(version))) { + throw new UnsupportedMavenVersionException(version, range); } - } - else - { - out.println( "WARNING: " + getITName() + ": version range '" + versionRange - + "' supplied but no Maven version found - not skipping test." ); + } else { + out.println("WARNING: " + getITName() + ": version range '" + versionRange + + "' supplied but no Maven version found - not skipping test."); } } @@ -363,265 +302,202 @@ public abstract class AbstractMavenIntegrationTestCase * * @param versionRange */ - protected void failingMavenVersions( String versionRange ) - { - assertNull( "Only call failingMavenVersions at most once per test", invert ); + protected void failingMavenVersions(String versionRange) { + assertNull("Only call failingMavenVersions at most once per test", invert); VersionRange range; - try - { - range = VersionRange.createFromVersionSpec( versionRange ); - } - catch ( InvalidVersionSpecificationException e ) - { - throw (RuntimeException) new IllegalArgumentException( "Invalid version range: " + versionRange, e ); + try { + range = VersionRange.createFromVersionSpec(versionRange); + } catch (InvalidVersionSpecificationException e) { + throw (RuntimeException) new IllegalArgumentException("Invalid version range: " + versionRange, e); } ArtifactVersion version = getMavenVersion(); - if ( version != null ) - { - if ( range.containsVersion( removePattern( version ) ) ) - { - invert = new BrokenMavenVersionException( version, range ); + if (version != null) { + if (range.containsVersion(removePattern(version))) { + invert = new BrokenMavenVersionException(version, range); } - } - else - { - out.println( "WARNING: " + getITName() + ": version range '" + versionRange - + "' supplied but no Maven version found - not marking test as expected to fail." ); + } else { + out.println("WARNING: " + getITName() + ": version range '" + versionRange + + "' supplied but no Maven version found - not marking test as expected to fail."); } } - private static class NonCloseableInputStream extends FilterInputStream - { - NonCloseableInputStream( InputStream delegate ) - { - super( delegate ); + private static class NonCloseableInputStream extends FilterInputStream { + NonCloseableInputStream(InputStream delegate) { + super(delegate); } @Override - public void close() throws IOException - { - } + public void close() throws IOException {} } - private class UnsupportedJavaVersionException - extends TestAbortedException - { - @SuppressWarnings( "checkstyle:visibilitymodifier" ) + private class UnsupportedJavaVersionException extends TestAbortedException { + @SuppressWarnings("checkstyle:visibilitymodifier") public ArtifactVersion javaVersion; - @SuppressWarnings( "checkstyle:visibilitymodifier" ) + @SuppressWarnings("checkstyle:visibilitymodifier") public VersionRange supportedRange; - private UnsupportedJavaVersionException( ArtifactVersion javaVersion, VersionRange supportedRange ) - { - super( "Java version " + javaVersion + " not in range " + supportedRange ); + private UnsupportedJavaVersionException(ArtifactVersion javaVersion, VersionRange supportedRange) { + super("Java version " + javaVersion + " not in range " + supportedRange); this.javaVersion = javaVersion; this.supportedRange = supportedRange; } - } - private class UnsupportedMavenVersionException - extends TestAbortedException - { - @SuppressWarnings( "checkstyle:visibilitymodifier" ) + private class UnsupportedMavenVersionException extends TestAbortedException { + @SuppressWarnings("checkstyle:visibilitymodifier") public ArtifactVersion mavenVersion; - @SuppressWarnings( "checkstyle:visibilitymodifier" ) + @SuppressWarnings("checkstyle:visibilitymodifier") public VersionRange supportedRange; - private UnsupportedMavenVersionException( ArtifactVersion mavenVersion, VersionRange supportedRange ) - { - super( "Maven version " + mavenVersion + " not in range " + supportedRange ); + private UnsupportedMavenVersionException(ArtifactVersion mavenVersion, VersionRange supportedRange) { + super("Maven version " + mavenVersion + " not in range " + supportedRange); this.mavenVersion = mavenVersion; this.supportedRange = supportedRange; } - } - private class BrokenMavenVersionException - extends RuntimeException - { - @SuppressWarnings( "checkstyle:visibilitymodifier" ) + private class BrokenMavenVersionException extends RuntimeException { + @SuppressWarnings("checkstyle:visibilitymodifier") public ArtifactVersion mavenVersion; - @SuppressWarnings( "checkstyle:visibilitymodifier" ) + @SuppressWarnings("checkstyle:visibilitymodifier") public VersionRange supportedRange; - private BrokenMavenVersionException( ArtifactVersion mavenVersion, VersionRange supportedRange ) - { + private BrokenMavenVersionException(ArtifactVersion mavenVersion, VersionRange supportedRange) { this.mavenVersion = mavenVersion; this.supportedRange = supportedRange; } - } - private String getITName() - { + private String getITName() { String simpleName = getClass().getName(); - int idx = simpleName.lastIndexOf( '.' ); - simpleName = idx >= 0 ? simpleName.substring( idx + 1 ) : simpleName; - simpleName = simpleName.startsWith( "MavenIT" ) ? simpleName.substring( "MavenIT".length() ) : simpleName; - simpleName = simpleName.endsWith( "Test" ) ? simpleName.substring( 0, simpleName.length() - 4 ) : simpleName; + int idx = simpleName.lastIndexOf('.'); + simpleName = idx >= 0 ? simpleName.substring(idx + 1) : simpleName; + simpleName = simpleName.startsWith("MavenIT") ? simpleName.substring("MavenIT".length()) : simpleName; + simpleName = simpleName.endsWith("Test") ? simpleName.substring(0, simpleName.length() - 4) : simpleName; return simpleName; } - private String getTestName() - { + private String getTestName() { String className = getITName(); String methodName = getName(); - if ( methodName.startsWith( "test" ) ) - { - methodName = methodName.substring( 4 ); + if (methodName.startsWith("test")) { + methodName = methodName.substring(4); } return className + '.' + methodName + "()"; } - private String pad( int chars ) - { - StringBuilder buffer = new StringBuilder( 128 ); - for ( int i = 0; i < chars; i++ ) - { - buffer.append( '.' ); + private String pad(int chars) { + StringBuilder buffer = new StringBuilder(128); + for (int i = 0; i < chars; i++) { + buffer.append('.'); } return buffer.toString(); } - private String formatTime( long milliseconds ) - { - return SECS_FORMAT.format( milliseconds / 1000.0 ); + private String formatTime(long milliseconds) { + return SECS_FORMAT.format(milliseconds / 1000.0); } - protected File setupLocalRepo() - throws IOException - { - String tempDirPath = System.getProperty( "maven.it.tmpdir", System.getProperty( "java.io.tmpdir" ) ); - File localRepo = new File( tempDirPath, "local-repository/" + getITName() ); - if ( localRepo.isDirectory() ) - { - FileUtils.deleteDirectory( localRepo ); + protected File setupLocalRepo() throws IOException { + String tempDirPath = System.getProperty("maven.it.tmpdir", System.getProperty("java.io.tmpdir")); + File localRepo = new File(tempDirPath, "local-repository/" + getITName()); + if (localRepo.isDirectory()) { + FileUtils.deleteDirectory(localRepo); } - System.setProperty( "maven.repo.local", localRepo.getAbsolutePath() ); + System.setProperty("maven.repo.local", localRepo.getAbsolutePath()); return localRepo; } - ArtifactVersion removePattern( ArtifactVersion version ) - { + ArtifactVersion removePattern(ArtifactVersion version) { String v = version.toString(); - Matcher m = Pattern.compile( matchPattern ).matcher( v ); + Matcher m = Pattern.compile(matchPattern).matcher(v); - if ( m.matches() ) - { - return new DefaultArtifactVersion( m.group( 1 ) ); + if (m.matches()) { + return new DefaultArtifactVersion(m.group(1)); } return version; } - protected Verifier newVerifier( String basedir ) - throws VerificationException - { - return newVerifier( basedir, false ); + protected Verifier newVerifier(String basedir) throws VerificationException { + return newVerifier(basedir, false); } - protected Verifier newVerifier( String basedir, String settings ) - throws VerificationException - { - return newVerifier( basedir, settings, false ); + protected Verifier newVerifier(String basedir, String settings) throws VerificationException { + return newVerifier(basedir, settings, false); } - protected Verifier newVerifier( String basedir, boolean debug ) - throws VerificationException - { - return newVerifier( basedir, "", debug ); + protected Verifier newVerifier(String basedir, boolean debug) throws VerificationException { + return newVerifier(basedir, "", debug); } - protected Verifier newVerifier( String basedir, String settings, boolean debug ) - throws VerificationException - { - Verifier verifier = new Verifier( basedir, debug ); + protected Verifier newVerifier(String basedir, String settings, boolean debug) throws VerificationException { + Verifier verifier = new Verifier(basedir, debug); - verifier.setAutoclean( false ); + verifier.setAutoclean(false); - if ( settings != null ) - { + if (settings != null) { File settingsFile; - if ( settings.length() > 0 ) - { - settingsFile = new File( "settings-" + settings + ".xml" ); - } - else - { - settingsFile = new File( "settings.xml" ); + if (settings.length() > 0) { + settingsFile = new File("settings-" + settings + ".xml"); + } else { + settingsFile = new File("settings.xml"); } - if ( !settingsFile.isAbsolute() ) - { - String settingsDir = System.getProperty( "maven.it.global-settings.dir", "" ); - if ( settingsDir.length() > 0 ) - { - settingsFile = new File( settingsDir, settingsFile.getPath() ); - } - else - { + if (!settingsFile.isAbsolute()) { + String settingsDir = System.getProperty("maven.it.global-settings.dir", ""); + if (settingsDir.length() > 0) { + settingsFile = new File(settingsDir, settingsFile.getPath()); + } else { // // Make is easier to run ITs from m2e in Maven IT mode without having to set any additional // properties. // - settingsFile = new File( "target/test-classes", settingsFile.getPath() ); + settingsFile = new File("target/test-classes", settingsFile.getPath()); } } String path = settingsFile.getAbsolutePath(); // dedicated CLI option only available since MNG-3914 - if ( matchesVersionRange( "[2.1.0,)" ) ) - { - verifier.addCliArgument( "--global-settings" ); - if ( path.indexOf( ' ' ) < 0 ) - { - verifier.addCliArgument( path ); + if (matchesVersionRange("[2.1.0,)")) { + verifier.addCliArgument("--global-settings"); + if (path.indexOf(' ') < 0) { + verifier.addCliArgument(path); + } else { + verifier.addCliArgument('"' + path + '"'); } - else - { - verifier.addCliArgument( '"' + path + '"' ); - } - } - else - { - verifier.getSystemProperties().put( "org.apache.maven.global-settings", path ); + } else { + verifier.getSystemProperties().put("org.apache.maven.global-settings", path); } } - try - { + try { // Java7 TLS protocol - if ( VersionRange.createFromVersionSpec( "(,1.8.0)" ).containsVersion( getJavaVersion() ) ) - { - verifier.addCliArgument( "-Dhttps.protocols=TLSv1.2" ); + if (VersionRange.createFromVersionSpec("(,1.8.0)").containsVersion(getJavaVersion())) { + verifier.addCliArgument("-Dhttps.protocols=TLSv1.2"); } // auto set source+target to lowest reasonable java version // Java9 requires at least 1.6 - if ( VersionRange.createFromVersionSpec( "[9,12)" ).containsVersion( getJavaVersion() ) ) - { - verifier.getSystemProperties().put( "maven.compiler.source", "1.8" ); - verifier.getSystemProperties().put( "maven.compiler.target", "1.8" ); - verifier.getSystemProperties().put( "maven.compiler.release", "8" ); + if (VersionRange.createFromVersionSpec("[9,12)").containsVersion(getJavaVersion())) { + verifier.getSystemProperties().put("maven.compiler.source", "1.8"); + verifier.getSystemProperties().put("maven.compiler.target", "1.8"); + verifier.getSystemProperties().put("maven.compiler.release", "8"); } // Java12 requires at least 7 - if ( VersionRange.createFromVersionSpec( "[12,)" ).containsVersion( getJavaVersion() ) ) - { - verifier.getSystemProperties().put( "maven.compiler.source", "8" ); - verifier.getSystemProperties().put( "maven.compiler.target", "8" ); - verifier.getSystemProperties().put( "maven.compiler.release", "8" ); + if (VersionRange.createFromVersionSpec("[12,)").containsVersion(getJavaVersion())) { + verifier.getSystemProperties().put("maven.compiler.source", "8"); + verifier.getSystemProperties().put("maven.compiler.target", "8"); + verifier.getSystemProperties().put("maven.compiler.release", "8"); } - } - catch ( InvalidVersionSpecificationException e ) - { + } catch (InvalidVersionSpecificationException e) { // noop } @@ -629,103 +505,79 @@ public abstract class AbstractMavenIntegrationTestCase } @BeforeEach - void setupContext( TestInfo testInfo ) - { + void setupContext(TestInfo testInfo) { testName = testInfo.getTestMethod().get().getName(); } - protected String getName() - { + protected String getName() { return testName; } - public static void assertCanonicalFileEquals( String message, File expected, File actual ) - throws IOException - { - assertEquals( message, expected.getCanonicalFile(), actual.getCanonicalFile() ); + public static void assertCanonicalFileEquals(String message, File expected, File actual) throws IOException { + assertEquals(message, expected.getCanonicalFile(), actual.getCanonicalFile()); } - public static void assertCanonicalFileEquals( File expected, File actual ) - throws IOException - { - assertCanonicalFileEquals( null, expected, actual ); + public static void assertCanonicalFileEquals(File expected, File actual) throws IOException { + assertCanonicalFileEquals(null, expected, actual); } - public static void assertCanonicalFileEquals( String message, String expected, String actual ) - throws IOException - { - assertCanonicalFileEquals( message, new File( expected ), new File( actual ) ); + public static void assertCanonicalFileEquals(String message, String expected, String actual) throws IOException { + assertCanonicalFileEquals(message, new File(expected), new File(actual)); } - public static void assertCanonicalFileEquals( String expected, String actual ) - throws IOException - { - assertCanonicalFileEquals( null, new File( expected ), new File( actual ) ); + public static void assertCanonicalFileEquals(String expected, String actual) throws IOException { + assertCanonicalFileEquals(null, new File(expected), new File(actual)); } - public static void assertEquals( Object o1, Object o2 ) - { - assertEquals( null, o1, o2 ); + public static void assertEquals(Object o1, Object o2) { + assertEquals(null, o1, o2); } - public static void assertEquals( String message, Object o1, Object o2 ) - { - org.junit.jupiter.api.Assertions.assertEquals( o1, o2, message ); + public static void assertEquals(String message, Object o1, Object o2) { + org.junit.jupiter.api.Assertions.assertEquals(o1, o2, message); } - public static void assertNotEquals( Object o1, Object o2 ) - { - assertNotEquals( null, o1, o2 ); + public static void assertNotEquals(Object o1, Object o2) { + assertNotEquals(null, o1, o2); } - public static void assertNotEquals( String message, Object o1, Object o2 ) - { - org.junit.jupiter.api.Assertions.assertNotEquals( o1, o2, message ); + public static void assertNotEquals(String message, Object o1, Object o2) { + org.junit.jupiter.api.Assertions.assertNotEquals(o1, o2, message); } - public static void assertTrue( boolean test ) - { - assertTrue( null, test ); + public static void assertTrue(boolean test) { + assertTrue(null, test); } - public static void assertTrue( String message, boolean test ) - { - org.junit.jupiter.api.Assertions.assertTrue( test, message ); + public static void assertTrue(String message, boolean test) { + org.junit.jupiter.api.Assertions.assertTrue(test, message); } - public static void assertFalse( boolean test ) - { - assertFalse( null, test ); + public static void assertFalse(boolean test) { + assertFalse(null, test); } - public static void assertFalse( String message, boolean test ) - { - org.junit.jupiter.api.Assertions.assertFalse( test, message ); + public static void assertFalse(String message, boolean test) { + org.junit.jupiter.api.Assertions.assertFalse(test, message); } - public static void assertNotNull( Object o ) - { - assertNotNull( null, o ); + public static void assertNotNull(Object o) { + assertNotNull(null, o); } - public static void assertNotNull( String message, Object o ) - { - org.junit.jupiter.api.Assertions.assertNotNull( o, message ); + public static void assertNotNull(String message, Object o) { + org.junit.jupiter.api.Assertions.assertNotNull(o, message); } - public static void assertNull( Object o ) - { - assertNull( null, o ); + public static void assertNull(Object o) { + assertNull(null, o); } - public static void assertNull( String message, Object o ) - { - org.junit.jupiter.api.Assertions.assertNull( o, message ); + public static void assertNull(String message, Object o) { + org.junit.jupiter.api.Assertions.assertNull(o, message); } - public static void fail( String message ) - { - org.junit.jupiter.api.Assertions.fail( message ); + public static void fail(String message) { + org.junit.jupiter.api.Assertions.fail(message); } - } diff --git a/its/core-it-support/maven-it-helper/src/main/java/org/apache/maven/it/AnsiSupport.java b/its/core-it-support/maven-it-helper/src/main/java/org/apache/maven/it/AnsiSupport.java index 1764ec9387..27de46ba99 100644 --- a/its/core-it-support/maven-it-helper/src/main/java/org/apache/maven/it/AnsiSupport.java +++ b/its/core-it-support/maven-it-helper/src/main/java/org/apache/maven/it/AnsiSupport.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.it; * "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 + * 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 @@ -18,33 +16,29 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.it; /** * Basic Ansi support: can't use Ansi because IT is executed in separate classloader. */ -class AnsiSupport -{ - private static final String ESC = String.valueOf( (char) 27 ) + '['; +class AnsiSupport { + private static final String ESC = String.valueOf((char) 27) + '['; private static final String NORMAL = ESC + "0;39m"; - static String success( String msg ) - { + static String success(String msg) { return ESC + "1;32m" + msg + NORMAL; } - static String warning( String msg ) - { + static String warning(String msg) { return ESC + "1;33m" + msg + NORMAL; } - static String error( String msg ) - { + static String error(String msg) { return ESC + "1;31m" + msg + NORMAL; } - static String bold( String msg ) - { + static String bold(String msg) { return ESC + "1m" + msg + NORMAL; } } diff --git a/its/core-it-support/maven-it-helper/src/test/java/org/apache/maven/it/MavenIntegrationTestCaseTest.java b/its/core-it-support/maven-it-helper/src/test/java/org/apache/maven/it/MavenIntegrationTestCaseTest.java index 3971d81328..1028ff412a 100644 --- a/its/core-it-support/maven-it-helper/src/test/java/org/apache/maven/it/MavenIntegrationTestCaseTest.java +++ b/its/core-it-support/maven-it-helper/src/test/java/org/apache/maven/it/MavenIntegrationTestCaseTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.it; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.it; * "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 + * 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 @@ -18,58 +16,51 @@ package org.apache.maven.it; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.it; import org.apache.maven.artifact.versioning.DefaultArtifactVersion; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; -public class MavenIntegrationTestCaseTest -{ +public class MavenIntegrationTestCaseTest { @Test - public void testRemovePatternForTestWithVersionRange() - { - AbstractMavenIntegrationTestCase test = new AbstractMavenIntegrationTestCase( "[2.0,)" ) - { - // test case with version range - }; + public void testRemovePatternForTestWithVersionRange() { + AbstractMavenIntegrationTestCase test = new AbstractMavenIntegrationTestCase("[2.0,)") { + // test case with version range + }; - assertVersionEquals( "2.1.0-M1", "2.1.0-M1", test ); - assertVersionEquals( "2.1.0-M1", "2.1.0-M1-SNAPSHOT", test ); - assertVersionEquals( "2.1.0-M1", "2.1.0-M1-RC1", test ); - assertVersionEquals( "2.1.0-M1", "2.1.0-M1-RC1-SNAPSHOT", test ); - assertVersionEquals( "2.0.10", "2.0.10", test ); - assertVersionEquals( "2.0.10", "2.0.10-SNAPSHOT", test ); - assertVersionEquals( "2.0.10", "2.0.10-RC1", test ); - assertVersionEquals( "2.0.10", "2.0.10-RC1-SNAPSHOT", test ); + assertVersionEquals("2.1.0-M1", "2.1.0-M1", test); + assertVersionEquals("2.1.0-M1", "2.1.0-M1-SNAPSHOT", test); + assertVersionEquals("2.1.0-M1", "2.1.0-M1-RC1", test); + assertVersionEquals("2.1.0-M1", "2.1.0-M1-RC1-SNAPSHOT", test); + assertVersionEquals("2.0.10", "2.0.10", test); + assertVersionEquals("2.0.10", "2.0.10-SNAPSHOT", test); + assertVersionEquals("2.0.10", "2.0.10-RC1", test); + assertVersionEquals("2.0.10", "2.0.10-RC1-SNAPSHOT", test); } - private static void assertVersionEquals( String expected, String version, AbstractMavenIntegrationTestCase test ) - { - assertEquals( expected, test.removePattern( new DefaultArtifactVersion( version ) ).toString() ); + private static void assertVersionEquals(String expected, String version, AbstractMavenIntegrationTestCase test) { + assertEquals( + expected, + test.removePattern(new DefaultArtifactVersion(version)).toString()); } @Test - public void testRequiresMavenVersion() - { - System.setProperty( "maven.version", "2.1" ); + public void testRequiresMavenVersion() { + System.setProperty("maven.version", "2.1"); - AbstractMavenIntegrationTestCase test = new AbstractMavenIntegrationTestCase( "[2.0,)" ) - { - // test case with version range - }; + AbstractMavenIntegrationTestCase test = new AbstractMavenIntegrationTestCase("[2.0,)") { + // test case with version range + }; - try - { - test.requiresMavenVersion( "[3.0,)" ); - } - catch ( RuntimeException e ) - { + try { + test.requiresMavenVersion("[3.0,)"); + } catch (RuntimeException e) { // expected } - test.requiresMavenVersion( "[2.0,)" ); + test.requiresMavenVersion("[2.0,)"); } - } diff --git a/its/core-it-support/maven-it-plugin-bootstrap/pom.xml b/its/core-it-support/maven-it-plugin-bootstrap/pom.xml index 6f08db497c..bfde342026 100644 --- a/its/core-it-support/maven-it-plugin-bootstrap/pom.xml +++ b/its/core-it-support/maven-it-plugin-bootstrap/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 diff --git a/its/core-it-support/maven-it-plugin-bootstrap/src/main/java/org/apache/maven/its/bootstrap/DownloadMojo.java b/its/core-it-support/maven-it-plugin-bootstrap/src/main/java/org/apache/maven/its/bootstrap/DownloadMojo.java index bf241c695c..241a68057a 100644 --- a/its/core-it-support/maven-it-plugin-bootstrap/src/main/java/org/apache/maven/its/bootstrap/DownloadMojo.java +++ b/its/core-it-support/maven-it-plugin-bootstrap/src/main/java/org/apache/maven/its/bootstrap/DownloadMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.its.bootstrap; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ package org.apache.maven.its.bootstrap; * "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 + * 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 @@ -18,6 +16,7 @@ package org.apache.maven.its.bootstrap; * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.its.bootstrap; import java.io.BufferedReader; import java.io.File; @@ -48,10 +47,8 @@ import org.eclipse.aether.resolution.DependencyRequest; * Boostrap plugin to download all required dependencies (provided in file) or to collect lifecycle bound build plugin * versions. */ -@Mojo( name = "download" ) -public class DownloadMojo - extends AbstractMojo -{ +@Mojo(name = "download") +public class DownloadMojo extends AbstractMojo { /** * A list of artifacts coordinates. @@ -74,90 +71,70 @@ public class DownloadMojo @Component private RepositorySystem repositorySystem; - @Parameter( defaultValue = "${session}", readonly = true ) + @Parameter(defaultValue = "${session}", readonly = true) private MavenSession session; @Override - public void execute() throws MojoFailureException - { + public void execute() throws MojoFailureException { // this or that: either resolver file listed artifacts or collect lifecycle packaging plugins - if ( file != null && file.exists() ) - { - System.out.println( "Collecting artifacts from file: " + file ); - try ( BufferedReader reader = new BufferedReader( new FileReader( file ) ) ) - { + if (file != null && file.exists()) { + System.out.println("Collecting artifacts from file: " + file); + try (BufferedReader reader = new BufferedReader(new FileReader(file))) { reader.lines() - .map( String::trim ) - .filter( s -> !s.isEmpty() && !s.startsWith( "#" ) ) - .forEach( artifacts::add ); + .map(String::trim) + .filter(s -> !s.isEmpty() && !s.startsWith("#")) + .forEach(artifacts::add); + } catch (IOException e) { + throw new MojoFailureException("Unable to read dependencies: " + file, e); } - catch ( IOException e ) - { - throw new MojoFailureException( "Unable to read dependencies: " + file, e ); - } - } - else - { + } else { MavenProject project = session.getCurrentProject(); - System.out.println( "Collecting build plugins from packaging: " + project.getPackaging() ); - for ( Plugin plugin : project.getBuildPlugins() ) - { - artifacts.add( plugin.getGroupId() + ":" + plugin.getArtifactId() + ":" + plugin.getVersion() ); + System.out.println("Collecting build plugins from packaging: " + project.getPackaging()); + for (Plugin plugin : project.getBuildPlugins()) { + artifacts.add(plugin.getGroupId() + ":" + plugin.getArtifactId() + ":" + plugin.getVersion()); } } - for ( String artifact : artifacts ) - { - if ( artifact != null ) - { - dependencies.add( toDependency( artifact ) ); + for (String artifact : artifacts) { + if (artifact != null) { + dependencies.add(toDependency(artifact)); } } ProjectBuildingRequest projectBuildingRequest = session.getProjectBuildingRequest(); RepositorySystemSession repositorySystemSession = projectBuildingRequest.getRepositorySession(); - List repos = RepositoryUtils.toRepos( projectBuildingRequest.getRemoteRepositories() ); + List repos = RepositoryUtils.toRepos(projectBuildingRequest.getRemoteRepositories()); - for ( Dependency dependency : dependencies ) - { - try - { - org.eclipse.aether.graph.Dependency root = RepositoryUtils.toDependency( - dependency, repositorySystemSession.getArtifactTypeRegistry() ); - CollectRequest collectRequest = new CollectRequest( root, null, repos ); - collectRequest.setRequestContext( "bootstrap" ); - DependencyRequest request = new DependencyRequest( collectRequest, null ) ; - System.out.println( "Resolving: " + root.getArtifact() ); - repositorySystem.resolveDependencies( repositorySystemSession, request ); - } - catch ( Exception e ) - { - throw new MojoFailureException( "Unable to resolve dependency: " + dependency, e ); + for (Dependency dependency : dependencies) { + try { + org.eclipse.aether.graph.Dependency root = + RepositoryUtils.toDependency(dependency, repositorySystemSession.getArtifactTypeRegistry()); + CollectRequest collectRequest = new CollectRequest(root, null, repos); + collectRequest.setRequestContext("bootstrap"); + DependencyRequest request = new DependencyRequest(collectRequest, null); + System.out.println("Resolving: " + root.getArtifact()); + repositorySystem.resolveDependencies(repositorySystemSession, request); + } catch (Exception e) { + throw new MojoFailureException("Unable to resolve dependency: " + dependency, e); } } } - - static Dependency toDependency( String artifact ) - throws MojoFailureException - { + static Dependency toDependency(String artifact) throws MojoFailureException { Dependency coordinate = new Dependency(); - String[] tokens = artifact.split( ":" ); - if ( tokens.length < 3 || tokens.length > 5 ) - { - throw new MojoFailureException( "Invalid artifact, you must specify " - + "groupId:artifactId:version[:packaging[:classifier]] " + artifact ); + String[] tokens = artifact.split(":"); + if (tokens.length < 3 || tokens.length > 5) { + throw new MojoFailureException("Invalid artifact, you must specify " + + "groupId:artifactId:version[:packaging[:classifier]] " + artifact); } - coordinate.setGroupId( tokens[0] ); - coordinate.setArtifactId( tokens[1] ); - coordinate.setVersion( tokens[2] ); - if ( tokens.length >= 4 ) - { - coordinate.setType( tokens[3] ); + coordinate.setGroupId(tokens[0]); + coordinate.setArtifactId(tokens[1]); + coordinate.setVersion(tokens[2]); + if (tokens.length >= 4) { + coordinate.setType(tokens[3]); } - if ( tokens.length == 5 ) - { - coordinate.setClassifier( tokens[4] ); + if (tokens.length == 5) { + coordinate.setClassifier(tokens[4]); } return coordinate; } diff --git a/its/pom.xml b/its/pom.xml index 9b254ef2d9..29dc3422f7 100644 --- a/its/pom.xml +++ b/its/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 @@ -43,20 +41,25 @@ under the License. + + core-it-support + core-it-suite + + scm:git:https://gitbox.apache.org/repos/asf/maven-integration-testing.git scm:git:https://gitbox.apache.org/repos/asf/maven-integration-testing.git - https://github.com/apache/maven-integration-testing/tree/${project.scm.tag} master + https://github.com/apache/maven-integration-testing/tree/${project.scm.tag} - - Jenkins - https://ci-builds.apache.org/job/Maven/job/maven-box/job/maven/ - jira https://issues.apache.org/jira/browse/MNG + + Jenkins + https://ci-builds.apache.org/job/Maven/job/maven-box/job/maven/ + apache.website @@ -75,11 +78,6 @@ under the License. 3.6.4 - - core-it-support - core-it-suite - - @@ -142,47 +140,14 @@ under the License. - apache.snapshots - Apache Snapshot Repository - https://repository.apache.org/snapshots false + apache.snapshots + Apache Snapshot Repository + https://repository.apache.org/snapshots - - - - reporting - - - - org.apache.maven.plugins - maven-project-info-reports-plugin - - false - - ${project.scm.connection} - ${project.scm.developerConnection} - - - - org.apache.maven.plugins - maven-jxr-plugin - - - default - - jxr - test-jxr - - - - - - - - @@ -229,18 +194,14 @@ under the License. org.apache.rat - - apache-rat-plugin - - - [0.11,) - + apache-rat-plugin + [0.11,) check - + @@ -289,4 +250,38 @@ under the License. + + + + reporting + + + + org.apache.maven.plugins + maven-project-info-reports-plugin + + false + + + ${project.scm.connection} + ${project.scm.developerConnection} + + + + org.apache.maven.plugins + maven-jxr-plugin + + + default + + jxr + test-jxr + + + + + + + +