This commit is contained in:
Guillaume Nodet 2023-06-02 11:57:19 +02:00
parent aedbb150f5
commit 386efc3d6c
902 changed files with 23349 additions and 31763 deletions

View File

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
@ -18,9 +17,7 @@ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
@ -77,8 +74,8 @@ under the License.
<proxy.host>localhost</proxy.host>
<proxy.port>80</proxy.port>
<proxy.type>none</proxy.type>
<proxy.user></proxy.user>
<proxy.pass></proxy.pass>
<proxy.user />
<proxy.pass />
<proxy.nonProxyHosts>localhost</proxy.nonProxyHosts>
<slf4jVersion>1.6.1</slf4jVersion>
<jetty9Version>9.4.50.v20221201</jetty9Version>
@ -486,8 +483,8 @@ under the License.
<directory>src/test/resources</directory>
</testResource>
<testResource>
<directory>src/test/resources-filtered</directory>
<filtering>true</filtering>
<directory>src/test/resources-filtered</directory>
</testResource>
</testResources>
<plugins>
@ -542,17 +539,6 @@ under the License.
</profile>
<profile>
<id>run-its</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>false</skip>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<!-- not really used but will force download in the local repo used -->
<dependency>
@ -574,6 +560,17 @@ under the License.
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>false</skip>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>maven-repo-local</id>
@ -625,7 +622,7 @@ under the License.
<jdk>(,1.8)</jdk>
</activation>
<properties>
<surefireMemory>-Xmx384m -XX:MaxPermSize=192m</surefireMemory>
<surefireMemory>-Xmx384m -XX:MaxPermSize=192m</surefireMemory>
</properties>
</profile>
<profile>
@ -676,10 +673,10 @@ under the License.
<executions>
<execution>
<id>download-maven-distro</id>
<phase>process-test-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<phase>process-test-resources</phase>
<configuration>
<artifactItems>
<artifactItem>
@ -702,20 +699,17 @@ under the License.
<executions>
<execution>
<id>unpack-maven-distro</id>
<phase>process-test-resources</phase>
<goals>
<goal>run</goal>
</goals>
<phase>process-test-resources</phase>
<configuration>
<target>
<delete dir="${mavenHome}" />
<unzip src="${project.build.directory}/maven-bin.zip"
dest="${mavenHome}">
<globmapper from="apache-maven-${mavenVersion}/*"
to="*" handledirsep="true" />
<unzip dest="${mavenHome}" src="${project.build.directory}/maven-bin.zip">
<globmapper from="apache-maven-${mavenVersion}/*" handledirsep="true" to="*" />
</unzip>
<chmod dir="${mavenHome}/bin" perm="ugo+rx"
includes="mvn,mvnDebug" />
<chmod dir="${mavenHome}/bin" includes="mvn,mvnDebug" perm="ugo+rx" />
</target>
</configuration>
</execution>
@ -748,19 +742,17 @@ under the License.
<executions>
<execution>
<id>unpack-maven-distro</id>
<phase>process-test-resources</phase>
<goals>
<goal>run</goal>
</goals>
<phase>process-test-resources</phase>
<configuration>
<target>
<delete dir="${mavenHome}" />
<unzip src="${mavenDistro}" dest="${mavenHome}">
<regexpmapper from="^([^/]+)/(.*)$"
to="\2" handledirsep="true" />
<unzip dest="${mavenHome}" src="${mavenDistro}">
<regexpmapper from="^([^/]+)/(.*)$" handledirsep="true" to="\2" />
</unzip>
<chmod dir="${mavenHome}/bin" perm="ugo+rx"
includes="mvn,mvnDebug" />
<chmod dir="${mavenHome}/bin" includes="mvn,mvnDebug" perm="ugo+rx" />
</target>
</configuration>
</execution>
@ -789,18 +781,17 @@ under the License.
<executions>
<execution>
<id>copy-maven-distro</id>
<phase>process-test-classes</phase>
<goals>
<goal>run</goal>
</goals>
<phase>process-test-classes</phase>
<configuration>
<target>
<delete dir="${preparedMavenHome}" />
<copy todir="${preparedMavenHome}" overwrite="true">
<copy overwrite="true" todir="${preparedMavenHome}">
<fileset dir="${mavenHome}" />
</copy>
<chmod dir="${preparedMavenHome}/bin" perm="ugo+rx"
includes="mvn,mvnDebug" />
<chmod dir="${preparedMavenHome}/bin" includes="mvn,mvnDebug" perm="ugo+rx" />
</target>
</configuration>
</execution>
@ -812,10 +803,10 @@ under the License.
<executions>
<execution>
<id>inject-emma-into-core-realm</id>
<phase>process-test-classes</phase>
<goals>
<goal>copy</goal>
</goals>
<phase>process-test-classes</phase>
<configuration>
<artifactItems>
<artifactItem>
@ -853,17 +844,17 @@ under the License.
<executions>
<execution>
<id>instrument</id>
<phase>process-test-classes</phase>
<goals>
<goal>instrument</goal>
</goals>
<phase>process-test-classes</phase>
</execution>
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
<phase>test</phase>
</execution>
</executions>
</plugin>

View File

@ -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();
}
}

View File

@ -1,5 +1,3 @@
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();
}
}

View File

@ -1,5 +1,3 @@
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();
}
}

View File

@ -1,5 +1,3 @@
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();
}
}

View File

@ -1,5 +1,3 @@
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<String> 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<String> 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"));
}
}

View File

@ -1,5 +1,3 @@
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<String> 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<String> 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"));
}
}

View File

@ -1,5 +1,3 @@
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();
}
}

View File

@ -1,5 +1,3 @@
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();
}
}

View File

@ -1,5 +1,3 @@
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();
}
}

View File

@ -1,5 +1,3 @@
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");
}
}

View File

@ -1,5 +1,3 @@
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");
}
}

View File

@ -1,5 +1,3 @@
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");
}
}

View File

@ -1,5 +1,3 @@
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");
}
}

View File

@ -1,5 +1,3 @@
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();
}
}

View File

@ -1,5 +1,3 @@
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();
}
}

View File

@ -1,5 +1,3 @@
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");
}
}

View File

@ -1,5 +1,3 @@
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");
}
}

View File

@ -1,5 +1,3 @@
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");
}
}

View File

@ -1,5 +1,3 @@
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");
}
}

View File

@ -1,5 +1,3 @@
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");
}
}

View File

@ -1,5 +1,3 @@
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");
}
}

View File

@ -1,5 +1,3 @@
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");
}
}

View File

@ -1,5 +1,3 @@
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<String> 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<String> 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());
}
}

View File

@ -1,5 +1,3 @@
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");
}
}

View File

@ -1,5 +1,3 @@
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");
}
}

View File

@ -1,5 +1,3 @@
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"));
}
}

View File

@ -1,5 +1,3 @@
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<String> lines = verifier.loadLines( "target/test.txt", "UTF-8" );
assertTrue( lines.toString(), lines.contains( "system.jar" ) );
Collection<String> lines = verifier.loadLines("target/test.txt", "UTF-8");
assertTrue(lines.toString(), lines.contains("system.jar"));
}
}

View File

@ -1,5 +1,3 @@
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);
}
}

View File

@ -1,5 +1,3 @@
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);
}
}

View File

@ -1,5 +1,3 @@
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"));
}
}

View File

@ -1,5 +1,3 @@
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 <a href="https://issues.apache.org/jira/browse/MNG-1908">MNG-1908</a>.
*/
@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 "<?xml version=\"1.0\" encoding=\"UTF-8\"?><metadata>\n" + "<groupId>org.apache.maven</groupId>\n" +
"<artifactId>maven-core-it-support</artifactId>\n" + "<version>1.0-SNAPSHOT</version>\n" +
"<versioning>\n" + "<snapshot>\n" + "<buildNumber>" + buildNumber + "</buildNumber>\n" + "</snapshot>\n" +
( writeLastUpdated ? "<lastUpdated>" + ts + "</lastUpdated>\n" : "" ) + "</versioning>\n" + "</metadata>";
return "<?xml version=\"1.0\" encoding=\"UTF-8\"?><metadata>\n" + "<groupId>org.apache.maven</groupId>\n"
+ "<artifactId>maven-core-it-support</artifactId>\n"
+ "<version>1.0-SNAPSHOT</version>\n" + "<versioning>\n"
+ "<snapshot>\n" + "<buildNumber>" + buildNumber + "</buildNumber>\n" + "</snapshot>\n"
+ (writeLastUpdated ? "<lastUpdated>" + ts + "</lastUpdated>\n" : "")
+ "</versioning>\n" + "</metadata>";
}
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 "<?xml version=\"1.0\" encoding=\"UTF-8\"?><metadata>\n" + " <groupId>" + groupId + "</groupId>\n" +
" <artifactId>" + artifactId + "</artifactId>\n" + " <version>1.0-SNAPSHOT</version>\n" +
" <versioning>\n" + " <snapshot>\n" + " <localCopy>true</localCopy>\n" + " </snapshot>\n" +
( writeLastUpdated ? " <lastUpdated>" + ts + "</lastUpdated>\n" : "" ) + " </versioning>\n" +
"</metadata>";
return "<?xml version=\"1.0\" encoding=\"UTF-8\"?><metadata>\n" + " <groupId>" + groupId + "</groupId>\n"
+ " <artifactId>"
+ artifactId + "</artifactId>\n" + " <version>1.0-SNAPSHOT</version>\n" + " <versioning>\n"
+ " <snapshot>\n" + " <localCopy>true</localCopy>\n" + " </snapshot>\n"
+ (writeLastUpdated ? " <lastUpdated>" + ts + "</lastUpdated>\n" : "")
+ " </versioning>\n" + "</metadata>";
}
}

View File

@ -1,5 +1,3 @@
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"));
}
}

View File

@ -1,5 +1,3 @@
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();
}
}

View File

@ -1,5 +1,3 @@
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();
}
}

View File

@ -1,5 +1,3 @@
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();
}
}

View File

@ -1,5 +1,3 @@
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();
}
}

View File

@ -1,5 +1,3 @@
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();
}
}

View File

@ -1,5 +1,3 @@
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();
}
}

View File

@ -1,5 +1,3 @@
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();
}
}

View File

@ -1,5 +1,3 @@
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();
}
}

View File

@ -1,5 +1,3 @@
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();
}
}

View File

@ -1,5 +1,3 @@
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"));
}
}

View File

@ -1,5 +1,3 @@
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"));
}
}

View File

@ -1,5 +1,3 @@
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<String> 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<String> 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<String> 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<String> 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<String> 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<String> 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<String> 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<String> 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<String> 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<String> 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<String> 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<String> 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());
}
}

View File

@ -1,5 +1,3 @@
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<String> 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<String> 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<String> 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<String> 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<String> 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<String> 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<String> 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<String> 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<String> 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<String> 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<String> 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<String> 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<String> 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<String> 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<String> 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<String> 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<String> runtimeArtifacts = verifier.loadLines( targetDir + "/runtime-artifacts.txt", "UTF-8" );
assertEquals( 0, runtimeArtifacts.size() );
List<String> runtimeArtifacts = verifier.loadLines(targetDir + "/runtime-artifacts.txt", "UTF-8");
assertEquals(0, runtimeArtifacts.size());
List<String> runtimeClassPath = verifier.loadLines( targetDir + "/runtime-cp.txt", "UTF-8" );
assertTrue( runtimeClassPath.toString(), runtimeClassPath.contains( "classes" ) );
assertEquals( 1, runtimeClassPath.size() );
List<String> runtimeClassPath = verifier.loadLines(targetDir + "/runtime-cp.txt", "UTF-8");
assertTrue(runtimeClassPath.toString(), runtimeClassPath.contains("classes"));
assertEquals(1, runtimeClassPath.size());
List<String> 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<String> 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<String> 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<String> 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<String> compileArtifacts = verifier.loadLines( targetDir + "/compile-artifacts.txt", "UTF-8" );
assertEquals( 0, compileArtifacts.size() );
List<String> compileArtifacts = verifier.loadLines(targetDir + "/compile-artifacts.txt", "UTF-8");
assertEquals(0, compileArtifacts.size());
List<String> compileClassPath = verifier.loadLines( targetDir + "/compile-cp.txt", "UTF-8" );
assertTrue( compileClassPath.toString(), compileClassPath.contains( "classes" ) );
assertEquals( 1, compileClassPath.size() );
List<String> compileClassPath = verifier.loadLines(targetDir + "/compile-cp.txt", "UTF-8");
assertTrue(compileClassPath.toString(), compileClassPath.contains("classes"));
assertEquals(1, compileClassPath.size());
List<String> 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<String> 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<String> 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<String> 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<String> 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<String> 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<String> 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<String> 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<String> compileArtifacts = verifier.loadLines( targetDir + "/compile-artifacts.txt", "UTF-8" );
assertEquals( 0, compileArtifacts.size() );
List<String> compileArtifacts = verifier.loadLines(targetDir + "/compile-artifacts.txt", "UTF-8");
assertEquals(0, compileArtifacts.size());
List<String> compileClassPath = verifier.loadLines( targetDir + "/compile-cp.txt", "UTF-8" );
assertTrue( compileClassPath.toString(), compileClassPath.contains( "classes" ) );
assertEquals( 1, compileClassPath.size() );
List<String> compileClassPath = verifier.loadLines(targetDir + "/compile-cp.txt", "UTF-8");
assertTrue(compileClassPath.toString(), compileClassPath.contains("classes"));
assertEquals(1, compileClassPath.size());
List<String> runtimeArtifacts = verifier.loadLines( targetDir + "/runtime-artifacts.txt", "UTF-8" );
assertEquals( 0, runtimeArtifacts.size() );
List<String> runtimeArtifacts = verifier.loadLines(targetDir + "/runtime-artifacts.txt", "UTF-8");
assertEquals(0, runtimeArtifacts.size());
List<String> runtimeClassPath = verifier.loadLines( targetDir + "/runtime-cp.txt", "UTF-8" );
assertTrue( runtimeClassPath.toString(), runtimeClassPath.contains( "classes" ) );
assertEquals( 1, runtimeClassPath.size() );
List<String> runtimeClassPath = verifier.loadLines(targetDir + "/runtime-cp.txt", "UTF-8");
assertTrue(runtimeClassPath.toString(), runtimeClassPath.contains("classes"));
assertEquals(1, runtimeClassPath.size());
List<String> 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<String> 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<String> 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<String> 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<String, String> 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;
}
}

View File

@ -1,5 +1,3 @@
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<String> 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<String> phases = verifier.loadLines( "target/phases.log", "UTF-8" );
assertEquals( expected, phases );
List<String> phases = verifier.loadLines("target/phases.log", "UTF-8");
assertEquals(expected, phases);
}
}

View File

@ -1,5 +1,3 @@
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<String, String> 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<String, String> 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");
}
}

View File

@ -1,5 +1,3 @@
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();
}
}

View File

@ -1,5 +1,3 @@
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();
}
}

View File

@ -1,5 +1,3 @@
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");
}
}

View File

@ -1,5 +1,3 @@
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<String> getProjects( Properties props )
{
private List<String> getProjects(Properties props) {
List<String> 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;
}
}

View File

@ -1,5 +1,3 @@
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<String> 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<String> 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<String> 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<String> 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<String> 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<String> 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"));
}
}

View File

@ -1,5 +1,3 @@
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();
}
}

View File

@ -1,5 +1,3 @@
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");
}
}

View File

@ -1,5 +1,3 @@
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");
}
}

View File

@ -1,5 +1,3 @@
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");
}
}
}

View File

@ -1,5 +1,3 @@
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<String> classpath = verifier.loadLines( "target/classpath.txt", "UTF-8" );
assertTrue( classpath.toString(), classpath.contains( "dep-0.1.jar" ) );
List<String> classpath = verifier.loadLines("target/classpath.txt", "UTF-8");
assertTrue(classpath.toString(), classpath.contains("dep-0.1.jar"));
}
}

View File

@ -1,5 +1,3 @@
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();
}
}

View File

@ -1,5 +1,3 @@
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");
}
}

View File

@ -1,5 +1,3 @@
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");
}
}

View File

@ -1,5 +1,3 @@
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();
}
}

View File

@ -1,5 +1,3 @@
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<String> 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<String> 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"));
}
}

View File

@ -1,5 +1,3 @@
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<String> artifacts = verifier.loadLines( "target/artifacts.txt", "UTF-8" );
assertTrue( artifacts.toString(), artifacts.contains( "org.apache.maven:maven-core-it-support:jar:1.1" ) );
List<String> artifacts = verifier.loadLines("target/artifacts.txt", "UTF-8");
assertTrue(artifacts.toString(), artifacts.contains("org.apache.maven:maven-core-it-support:jar:1.1"));
}
}

View File

@ -1,5 +1,3 @@
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");
}
}

View File

@ -1,5 +1,3 @@
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<String, String> 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<String, String> 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<String> log = verifier.loadLines( verifier.getLogFileName(), null );
assertNotNull( findPassword( log ) );
List<String> 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<String> log )
{
for ( String line : log )
{
if ( line.matches( ".*\\{[A-Za-z0-9+/=]+\\}.*" ) )
{
private String findPassword(List<String> 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 + "\"");
}
}
}

View File

@ -1,5 +1,3 @@
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");
}
}

View File

@ -1,5 +1,3 @@
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();
}

View File

@ -1,5 +1,3 @@
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<String> artifacts = verifier.loadLines( "target/artifacts.txt", "UTF-8" );
assertTrue( artifacts.toString(), artifacts.contains( "org.apache.maven.its.it0059:test:jar:3.8.1" ) );
List<String> artifacts = verifier.loadLines("target/artifacts.txt", "UTF-8");
assertTrue(artifacts.toString(), artifacts.contains("org.apache.maven.its.it0059:test:jar:3.8.1"));
}
}

View File

@ -1,5 +1,3 @@
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"));
}
}

View File

@ -1,5 +1,3 @@
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")));
}
}

View File

@ -1,5 +1,3 @@
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");
}
}

View File

@ -1,5 +1,3 @@
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<String> requestedUris = Collections.synchronizedList( new ArrayList<String>() );
final List<String> requestedUris = Collections.synchronizedList(new ArrayList<String>());
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( "<project>" );
writer.println( " <modelVersion>4.0.0</modelVersion>" );
writer.println( " <groupId>org.apache.maven.its.mng0768</groupId>" );
writer.println( " <artifactId>dep</artifactId>" );
writer.println( " <version>0.1</version>" );
writer.println( "</project>" );
}
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("<project>");
writer.println(" <modelVersion>4.0.0</modelVersion>");
writer.println(" <groupId>org.apache.maven.its.mng0768</groupId>");
writer.println(" <artifactId>dep</artifactId>");
writer.println(" <version>0.1</version>");
writer.println("</project>");
} 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();
}

View File

@ -1,5 +1,3 @@
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();
}
}

View File

@ -1,5 +1,3 @@
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");
}
}

View File

@ -1,5 +1,3 @@
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();
}
}

View File

@ -1,5 +1,3 @@
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"));
}
}

View File

@ -1,5 +1,3 @@
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<String> artifacts = verifier.loadLines( "target/artifacts.txt", "UTF-8" );
assertEquals( Collections.singletonList( "org.apache.maven.its.it0080:war:war:0.1" ), artifacts );
Collection<String> artifacts = verifier.loadLines("target/artifacts.txt", "UTF-8");
assertEquals(Collections.singletonList("org.apache.maven.its.it0080:war:war:0.1"), artifacts);
}
}

View File

@ -1,5 +1,3 @@
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<String> 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<String> 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"));
}
}

View File

@ -1,5 +1,3 @@
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();
}
}

View File

@ -1,5 +1,3 @@
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 = <domParam><echo>one</echo>" );
checkLog( log, "<echo>two</echo>" );
checkLog( log, "<echo>three</echo>" );
checkLog( log, "<echo>four</echo>" );
checkLog( log, "</domParam>" );
checkLog(log, "[DEBUG] (f) domParam = <domParam><echo>one</echo>");
checkLog(log, "<echo>two</echo>");
checkLog(log, "<echo>three</echo>");
checkLog(log, "<echo>four</echo>");
checkLog(log, "</domParam>");
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));
}
}

View File

@ -1,5 +1,3 @@
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
}
}
}
}

View File

@ -1,5 +1,3 @@
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"));
}
}

View File

@ -1,5 +1,3 @@
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"));
}
}

View File

@ -1,5 +1,3 @@
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");
}
}

View File

@ -1,5 +1,3 @@
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<String> 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<String> 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<String> 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<String> 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<String> 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<String> 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());
}
}

View File

@ -1,5 +1,3 @@
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"));
}
}

View File

@ -1,5 +1,3 @@
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();
}
}

View File

@ -1,5 +1,3 @@
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);
}
}

View File

@ -1,5 +1,3 @@
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();
}
}

View File

@ -1,5 +1,3 @@
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");
}
}

View File

@ -1,5 +1,3 @@
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");
}
}

View File

@ -1,5 +1,3 @@
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<String> classpath = verifier.loadLines( "target/classpath.txt", "UTF-8" );
List<String> 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"));
}
}

View File

@ -1,5 +1,3 @@
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");
}
}

View File

@ -1,5 +1,3 @@
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<String> 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<String> 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<String> 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<String> 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"));
}
}

View File

@ -1,5 +1,3 @@
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"));
}
}

View File

@ -1,5 +1,3 @@
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");
}
}

View File

@ -1,5 +1,3 @@
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 <a href="mailto:hboutemy@apache.org">Hervé Boutemy</a>
*
*/
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<String> compileArtifacts = verifier.loadLines( "target/compile-artifacts.txt", "UTF-8" );
assertArtifactOrder( compileArtifacts );
List<String> compileArtifacts = verifier.loadLines("target/compile-artifacts.txt", "UTF-8");
assertArtifactOrder(compileArtifacts);
List<String> compileClassPath = verifier.loadLines( "target/compile-classpath.txt", "UTF-8" );
assertClassPathOrder( compileClassPath.subList( 1, compileClassPath.size() ) );
List<String> compileClassPath = verifier.loadLines("target/compile-classpath.txt", "UTF-8");
assertClassPathOrder(compileClassPath.subList(1, compileClassPath.size()));
List<String> runtimeArtifacts = verifier.loadLines( "target/runtime-artifacts.txt", "UTF-8" );
assertArtifactOrder( runtimeArtifacts );
List<String> runtimeArtifacts = verifier.loadLines("target/runtime-artifacts.txt", "UTF-8");
assertArtifactOrder(runtimeArtifacts);
List<String> runtimeClassPath = verifier.loadLines( "target/runtime-classpath.txt", "UTF-8" );
assertClassPathOrder( runtimeClassPath.subList( 1, runtimeClassPath.size() ) );
List<String> runtimeClassPath = verifier.loadLines("target/runtime-classpath.txt", "UTF-8");
assertClassPathOrder(runtimeClassPath.subList(1, runtimeClassPath.size()));
List<String> testArtifacts = verifier.loadLines( "target/test-artifacts.txt", "UTF-8" );
assertArtifactOrder( testArtifacts );
List<String> testArtifacts = verifier.loadLines("target/test-artifacts.txt", "UTF-8");
assertArtifactOrder(testArtifacts);
List<String> testClassPath = verifier.loadLines( "target/test-classpath.txt", "UTF-8" );
assertClassPathOrder( testClassPath.subList( 2, testClassPath.size() ) );
List<String> testClassPath = verifier.loadLines("target/test-classpath.txt", "UTF-8");
assertClassPathOrder(testClassPath.subList(2, testClassPath.size()));
}
private void assertArtifactOrder( List<String> 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<String> 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<String> 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<String> 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));
}
}

View File

@ -1,5 +1,3 @@
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"));
}
}

View File

@ -1,5 +1,3 @@
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.
}
}
}

Some files were not shown because too many files have changed in this diff Show More