[MNG-3607] Class loaders employed by Maven return invalid URLs to resources

o Added IT

git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@831465 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2009-10-30 21:56:56 +00:00
parent 87ee1e0d2d
commit 9da8285a7e
4 changed files with 133 additions and 0 deletions

View File

@ -284,6 +284,7 @@ public class IntegrationTestSuite
suite.addTestSuite( MavenITmng3642DynamicResourcesTest.class );
suite.addTestSuite( MavenITmng3641ProfileActivationWarningTest.class );
suite.addTestSuite( MavenITmng3621UNCInheritedPathsTest.class );
suite.addTestSuite( MavenITmng3607ClassLoadersUseValidUrlsTest.class );
suite.addTestSuite( MavenITmng3600DeploymentModeDefaultsTest.class );
suite.addTestSuite( MavenITmng3599useHttpProxyForWebDAVTest.class );
suite.addTestSuite( MavenITmng3586SystemScopePluginDependencyTest.class );

View File

@ -0,0 +1,67 @@
package org.apache.maven.it;
/*
* 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.
*/
import org.apache.maven.it.Verifier;
import org.apache.maven.it.util.ResourceExtractor;
import java.io.File;
import java.net.URI;
import java.util.Properties;
/**
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-3607">MNG-3607</a>.
*
* @author Benjamin Bentmann
* @version $Id$
*/
public class MavenITmng3607ClassLoadersUseValidUrlsTest
extends AbstractMavenIntegrationTestCase
{
public MavenITmng3607ClassLoadersUseValidUrlsTest()
{
super( "[3.0-alpha-2,)" );
}
/**
* Test that class loaders created by Maven employ valid URLs, e.g. properly encode characters like spaces.
*/
public void testit()
throws Exception
{
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3607" );
Verifier verifier = new Verifier( testDir.getAbsolutePath() );
verifier.setAutoclean( false );
verifier.deleteDirectory( "target" );
verifier.getSystemProperties().setProperty( "test.home", testDir.getAbsolutePath() );
verifier.executeGoal( "validate" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
Properties props = verifier.loadProperties( "target/pcl.properties" );
String url = props.getProperty( "maven-core-it.properties" );
assertNotNull( url );
assertNotNull( new URI( url ) );
assertTrue( url.indexOf( ' ' ) < 0 );
}
}

View File

@ -0,0 +1,65 @@
<?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.mng3607</groupId>
<artifactId>test</artifactId>
<version>1.0</version>
<name>Maven Integration Test :: MNG-3607</name>
<description>
Test that class loaders created by Maven employ valid URLs, e.g. properly encode characters like spaces.
</description>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-class-loader</artifactId>
<version>2.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.its.mng3607</groupId>
<artifactId>tools</artifactId>
<version>1.5.0</version>
<scope>system</scope>
<systemPath>${test.home}/path with spaces/tools.jar</systemPath>
</dependency>
</dependencies>
<executions>
<execution>
<id>load</id>
<phase>validate</phase>
<configuration>
<resourcePaths>maven-core-it.properties</resourcePaths>
<pluginClassLoaderOutput>target/pcl.properties</pluginClassLoaderOutput>
</configuration>
<goals>
<goal>load</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>