MNG-2617 Adding descriptions to the POMs for each IT

Submitted by: Dan Fabulich



git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@465747 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason van Zyl 2006-10-19 19:41:23 +00:00
parent e7babd5685
commit 9e3623865d
1 changed files with 24 additions and 2 deletions

View File

@ -3,7 +3,7 @@ use File::Path;
use strict; use strict;
my $dirname = "maven-core-it"; my $dirname = "maven-core-it";
my $newITs = "maven-core-it-new"; my $newITs = "maven-core-integrationtests";
my $newITsResources = "$newITs/src/test/resources"; my $newITsResources = "$newITs/src/test/resources";
@ -142,6 +142,28 @@ while (defined(my $filename = readdir(DIR))) {
system( "xcopy /e $winSrc $winDest" ); system( "xcopy /e $winSrc $winDest" );
} else { } else {
system( "cp -r $dirname/$filename $testProjectDirectory" ); system( "cp -r $dirname/$filename $testProjectDirectory" );
}
my $testPomFile = "$testProjectDirectory/pom.xml";
my $testDescription = $comment{$filename} or die "wtf? no test description for $filename\n";
(my $testDescriptionEscaped = $testDescription) =~ s/</\&lt;/gs;
$testDescriptionEscaped =~ s/>/\&gt;/gs;
if (-e $testPomFile) {
my $testPom;
{
local( $/, *TESTPOM );
open (TESTPOM, "<$testPomFile");
$testPom = <TESTPOM>;
close TESTPOM;
}
# drop the existing description, if there is one
$testPom =~ s!<description>.*?</description>!!s;
# insert the test description into the POM
$testPom =~ s^</artifactId>(?!.*</parent>)(\s+)<^</artifactId>\1<description>$testDescriptionEscaped</description>\1<^sx;
my $testDescriptionMatcher = quotemeta($testDescriptionEscaped);
die "failed to insert description in $testProjectDirectory/pom.xml " unless ($testPom =~ m/$testDescriptionMatcher/s);
open (TESTPOM, ">$testPomFile");
print TESTPOM $testPom;
close TESTPOM;
} }
unlink("$testProjectDirectory/cli-options.txt"); unlink("$testProjectDirectory/cli-options.txt");
unlink("$testProjectDirectory/system.properties"); unlink("$testProjectDirectory/system.properties");
@ -165,7 +187,7 @@ import org.apache.maven.it.util.*;
public class $itTestName extends TestCase /*extends AbstractMavenIntegrationTest*/ { public class $itTestName extends TestCase /*extends AbstractMavenIntegrationTest*/ {
/** $comment{$filename} */ /** $testDescriptionEscaped */
public void test$filename() throws Exception { public void test$filename() throws Exception {
String basedir = System.getProperty("maven.test.tmpdir", System.getProperty("java.io.tmpdir")); String basedir = System.getProperty("maven.test.tmpdir", System.getProperty("java.io.tmpdir"));
File testDir = new File(basedir, getName()); File testDir = new File(basedir, getName());