[MNG-6919] test maven-wrapper with spaced paths

This commit is contained in:
rfscholte 2020-05-27 22:55:50 +02:00
parent e6c2c2e644
commit 59d1b4854e
5 changed files with 68 additions and 11 deletions

View File

@ -1,5 +1,7 @@
package org.apache.maven.it;
import java.io.BufferedWriter;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -21,8 +23,11 @@ package org.apache.maven.it;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.util.HashMap;
import java.util.Map;
@ -40,7 +45,7 @@ public class MavenITmng5937MavenWrapper
private final Map<String,String> envVars;
private final Path baseDir = Paths.get( "target/test-classes/mng-5937-wrapper" );
private final Path baseDir = Paths.get( "target/test-classes/mng-5937 wrapper" );
private ZipUnArchiver zipUnArchiver = new ZipUnArchiver();
@ -135,6 +140,36 @@ public class MavenITmng5937MavenWrapper
verifier.resetStreams();
}
public void testitMNG5937WrapperProperties()
throws Exception
{
final File testDir = baseDir.resolve( "properties" ).toFile();
unpack( testDir.toPath(), "bin" );
Path p = baseDir.resolve( "properties/.mvn/wrapper/maven-wrapper.properties" );
try ( BufferedWriter out = Files.newBufferedWriter( p, StandardOpenOption.TRUNCATE_EXISTING ) )
{
String localRepo = System.getProperty("maven.repo.local");
out.append( "distributionUrl = " + Paths.get( localRepo ).toUri().toURL().toString() )
.append( "org/apache/maven/apache-maven/")
.append( getMavenVersion().toString() )
.append( "/apache-maven-")
.append( getMavenVersion().toString() )
.append( "-bin.zip" );
}
envVars.remove( "MVNW_REPOURL" );
envVars.put( "MAVEN_BASEDIR", testDir.getAbsolutePath() );
Verifier verifier = newVerifier( testDir.getAbsolutePath() );
verifier.setAutoclean( false );
verifier.setDebug( true );
verifier.executeGoal( "validate", envVars );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
}
private void unpack( Path target, String classifier ) throws IOException
{
Path distro = wrapperDistro.resolve( "apache-maven-wrapper-" + getMavenVersion() + '-' + classifier + ".zip" );

View File

@ -22,10 +22,7 @@ under the License.
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.its.mng5936</groupId>
<groupId>org.apache.maven.its.mng5937</groupId>
<artifactId>test</artifactId>
<version>1</version>
<name>Maven Integration Test :: MNG-5979</name>
</project>

View File

@ -22,10 +22,10 @@ under the License.
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.its.mng5936</groupId>
<groupId>org.apache.maven.its.mng5937</groupId>
<artifactId>test</artifactId>
<version>1</version>
<name>Maven Integration Test :: MNG-5979</name>
<name>Maven Integration Test :: MNG-5937</name>
</project>

View File

@ -22,10 +22,7 @@ under the License.
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.its.mng5936</groupId>
<groupId>org.apache.maven.its.mng5937</groupId>
<artifactId>test</artifactId>
<version>1</version>
<name>Maven Integration Test :: MNG-5979</name>
</project>

View File

@ -0,0 +1,28 @@
<?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
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.
-->
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.its.mng5937</groupId>
<artifactId>test</artifactId>
<version>1</version>
</project>