From 9da8285a7ef31b59a81b5ea37e3ca5165768804e Mon Sep 17 00:00:00 2001 From: Benjamin Bentmann Date: Fri, 30 Oct 2009 21:56:56 +0000 Subject: [PATCH] [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 --- .../apache/maven/it/IntegrationTestSuite.java | 1 + ...ITmng3607ClassLoadersUseValidUrlsTest.java | 67 ++++++++++++++++++ .../mng-3607/path with spaces/tools.jar | Bin 0 -> 502 bytes .../src/test/resources/mng-3607/pom.xml | 65 +++++++++++++++++ 4 files changed, 133 insertions(+) create mode 100644 its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3607ClassLoadersUseValidUrlsTest.java create mode 100644 its/core-it-suite/src/test/resources/mng-3607/path with spaces/tools.jar create mode 100644 its/core-it-suite/src/test/resources/mng-3607/pom.xml diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java b/its/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java index f10857d8d4..a932ea9357 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java @@ -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 ); diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3607ClassLoadersUseValidUrlsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3607ClassLoadersUseValidUrlsTest.java new file mode 100644 index 0000000000..7693cdfab3 --- /dev/null +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3607ClassLoadersUseValidUrlsTest.java @@ -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 MNG-3607. + * + * @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 ); + } + +} diff --git a/its/core-it-suite/src/test/resources/mng-3607/path with spaces/tools.jar b/its/core-it-suite/src/test/resources/mng-3607/path with spaces/tools.jar new file mode 100644 index 0000000000000000000000000000000000000000..c0f35731065361de684b1ef8c1fa936762891bad GIT binary patch literal 502 zcmWIWW@Zs#-~htuUGps&kN_tG3xls~h@-BjpPT-_Qw$8u3<2Kk93T};P-Ou)HH!dM zz%~0i`gyv!28ZbRx_$ONbK1vSSMMUPx31Q?Gv_x48C)@b@U%$J%U8$K_hRWP7S0(j zC67qY(9U3){!H^nnwt1i@o=%}OP+~oS3FaFo%yNgV-X|RA;MFlZ@2@k0bztgiqL!^ z0hG;6EKAMPP0lY$)y*u?D=5k@NG&SKOfA;-)YS{z5Xw=&!&g@N@F^46*of7BYJxyb z{9t1lnM4>+g9qk!Q1GAvxPL)`72u7k71_0*z(D|8AQP??DX5T50Qm~pVIW^2z%d{b VmmdSXS=m4;nSt;ykd|cx@c`Q*Xz&04 literal 0 HcmV?d00001 diff --git a/its/core-it-suite/src/test/resources/mng-3607/pom.xml b/its/core-it-suite/src/test/resources/mng-3607/pom.xml new file mode 100644 index 0000000000..3b4011477c --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-3607/pom.xml @@ -0,0 +1,65 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng3607 + test + 1.0 + + Maven Integration Test :: MNG-3607 + + Test that class loaders created by Maven employ valid URLs, e.g. properly encode characters like spaces. + + + + + + org.apache.maven.its.plugins + maven-it-plugin-class-loader + 2.1-SNAPSHOT + + + org.apache.maven.its.mng3607 + tools + 1.5.0 + system + ${test.home}/path with spaces/tools.jar + + + + + load + validate + + maven-core-it.properties + target/pcl.properties + + + load + + + + + + +