maven-invoker-plugin-1.5/ 0000755 0001750 0001750 00000000000 11623526251 014203 5 ustar tony tony maven-invoker-plugin-1.5/pom.xml 0000644 0001750 0001750 00000021613 11270401746 015522 0 ustar tony tony
4.0.0
maven-plugins
org.apache.maven.plugins
14
maven-invoker-plugin
1.5
maven-plugin
Maven Invoker Plugin
The Maven Invoker Plugin is used to run a set of Maven projects. The plugin can determine whether each project
execution is successful, and optionally can verify the output generated from a given project execution.
2.0.6
scm:svn:http://svn.apache.org/repos/asf/maven/plugins/tags/maven-invoker-plugin-1.5
scm:svn:https://svn.apache.org/repos/asf/maven/plugins/tags/maven-invoker-plugin-1.5
http://svn.apache.org/viewvc/maven/plugins/tags/maven-invoker-plugin-1.5
jira
http://jira.codehaus.org/browse/MINVOKER
2.0.6
1.0-alpha-11
1.0-alpha-11
org.apache.maven.shared
maven-invoker
2.0.11
org.apache.maven
maven-project
${mavenVersion}
org.apache.maven
maven-model
${mavenVersion}
org.apache.maven
maven-plugin-api
${mavenVersion}
org.apache.maven
maven-artifact
${mavenVersion}
org.apache.maven
maven-settings
${mavenVersion}
org.apache.maven.reporting
maven-reporting-api
${mavenVersion}
org.apache.maven.reporting
maven-reporting-impl
2.0.4.1
org.apache.maven.doxia
doxia-sink-api
${doxiaVersion}
org.apache.maven.doxia
doxia-site-renderer
${doxia-sitetoolsVersion}
org.codehaus.plexus
plexus-container-default
org.codehaus.plexus
plexus-component-api
org.beanshell
bsh
2.0b4
org.codehaus.groovy
groovy
1.5.6
junit
junit
org.apache.ant
ant
1.7.1
org.apache.ant
ant-launcher
org.codehaus.plexus
plexus-utils
1.5.6
org.codehaus.plexus
plexus-interpolation
1.2
org.codehaus.plexus
plexus-i18n
1.0-beta-7
org.codehaus.plexus
plexus-container-default
org.codehaus.plexus
plexus-component-api
junit
junit
3.8.2
test
org.apache.maven.plugin-testing
maven-plugin-testing-harness
1.2
test
org.codehaus.modello
modello-maven-plugin
xpp3-reader
xpp3-writer
java
src/main/mdo/invocation.mdo
1.0.0
run-its
2.0.1
maven-invoker-plugin
1.4
true
src/it
${project.build.directory}/it
*/pom.xml
setup
verify
${project.build.directory}/local-repo
src/it/settings.xml
clean
initialize
${project.version}
integration-test
install
run
maven-3
${basedir}
3.0-beta-1-SNAPSHOT
maven-invoker-plugin-1.5/src/ 0000755 0001750 0001750 00000000000 11623526250 014771 5 ustar tony tony maven-invoker-plugin-1.5/src/test/ 0000755 0001750 0001750 00000000000 11623526250 015750 5 ustar tony tony maven-invoker-plugin-1.5/src/test/java/ 0000755 0001750 0001750 00000000000 11623526250 016671 5 ustar tony tony maven-invoker-plugin-1.5/src/test/java/org/ 0000755 0001750 0001750 00000000000 11623526250 017460 5 ustar tony tony maven-invoker-plugin-1.5/src/test/java/org/apache/ 0000755 0001750 0001750 00000000000 11623526250 020701 5 ustar tony tony maven-invoker-plugin-1.5/src/test/java/org/apache/maven/ 0000755 0001750 0001750 00000000000 11623526250 022007 5 ustar tony tony maven-invoker-plugin-1.5/src/test/java/org/apache/maven/plugin/ 0000755 0001750 0001750 00000000000 11623526250 023305 5 ustar tony tony maven-invoker-plugin-1.5/src/test/java/org/apache/maven/plugin/invoker/ 0000755 0001750 0001750 00000000000 11623526250 024762 5 ustar tony tony maven-invoker-plugin-1.5/src/test/java/org/apache/maven/plugin/invoker/SelectorUtilsTest.java 0000644 0001750 0001750 00000007435 11255230257 031277 0 ustar tony tony package org.apache.maven.plugin.invoker;
/*
* 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 java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import junit.framework.TestCase;
/**
* Tests {@link SelectorUtils}.
*
* @author Benjamin Bentmann
*/
public class SelectorUtilsTest
extends TestCase
{
private List list( int[] numbers )
{
List result = new ArrayList();
for ( int i = 0; i < numbers.length; i++ )
{
result.add( new Integer( numbers[i] ) );
}
return result;
}
public void testParseList()
{
List includes = new ArrayList();
List excludes = new ArrayList();
SelectorUtils.parseList( null, includes, excludes );
SelectorUtils.parseList( " 1.5, !1.4, 1.6+ ", includes, excludes );
assertEquals( Arrays.asList( new String[] { "1.5", "1.6+" } ), includes );
assertEquals( Arrays.asList( new String[] { "1.4" } ), excludes );
}
public void testParseVersion()
{
assertEquals( list( new int[] { 1, 6, 0, 12 } ), SelectorUtils.parseVersion( "1.6.0_12" ) );
assertEquals( list( new int[] { 1, 6, 0, 12 } ), SelectorUtils.parseVersion( "1.6.0_12+" ) );
assertEquals( list( new int[] { 1, 6, 0, 12 } ), SelectorUtils.parseVersion( "1.6.0_12-" ) );
}
public void testCompareVersions()
{
assertTrue( SelectorUtils.compareVersions( list( new int[] { 1, 6 } ), list( new int[] { 1, 6 } ) ) == 0 );
assertTrue( SelectorUtils.compareVersions( list( new int[] { 1, 5 } ), list( new int[] { 1, 6 } ) ) < 0 );
assertTrue( SelectorUtils.compareVersions( list( new int[] { 1, 6 } ), list( new int[] { 1, 5 } ) ) > 0 );
assertTrue( SelectorUtils.compareVersions( list( new int[] { 1 } ), list( new int[] { 1, 6 } ) ) < 0 );
assertTrue( SelectorUtils.compareVersions( list( new int[] { 1, 6 } ), list( new int[] { 1 } ) ) > 0 );
}
public void testIsMatchingJre()
{
assertFalse( SelectorUtils.isJreVersion( list( new int[] { 1, 4, 2, 8 } ), "1.5" ) );
assertTrue( SelectorUtils.isJreVersion( list( new int[] { 1, 5 } ), "1.5" ) );
assertTrue( SelectorUtils.isJreVersion( list( new int[] { 1, 5, 9 } ), "1.5" ) );
assertFalse( SelectorUtils.isJreVersion( list( new int[] { 1, 6 } ), "1.5" ) );
assertFalse( SelectorUtils.isJreVersion( list( new int[] { 1, 4, 2, 8 } ), "1.5+" ) );
assertTrue( SelectorUtils.isJreVersion( list( new int[] { 1, 5 } ), "1.5+" ) );
assertTrue( SelectorUtils.isJreVersion( list( new int[] { 1, 5, 9 } ), "1.5+" ) );
assertTrue( SelectorUtils.isJreVersion( list( new int[] { 1, 6 } ), "1.5+" ) );
assertTrue( SelectorUtils.isJreVersion( list( new int[] { 1, 4, 2, 8 } ), "1.5-" ) );
assertFalse( SelectorUtils.isJreVersion( list( new int[] { 1, 5 } ), "1.5-" ) );
assertFalse( SelectorUtils.isJreVersion( list( new int[] { 1, 5, 9 } ), "1.5-" ) );
assertFalse( SelectorUtils.isJreVersion( list( new int[] { 1, 6 } ), "1.5-" ) );
}
}
maven-invoker-plugin-1.5/src/test/java/org/apache/maven/plugin/invoker/InvokerMojoTest.java 0000644 0001750 0001750 00000011213 11242031713 030715 0 ustar tony tony package org.apache.maven.plugin.invoker;
/*
* 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 java.io.File;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.apache.maven.plugin.testing.AbstractMojoTestCase;
import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
import org.apache.maven.plugin.invoker.model.BuildJob;
import org.apache.maven.settings.Settings;
/**
* @author olamy
* @since 18 nov. 07
* @version $Id: InvokerMojoTest.java 804712 2009-08-16 16:28:59Z bentmann $
*/
public class InvokerMojoTest
extends AbstractMojoTestCase
{
/**
* test reading goals from a file
*/
public void testReadGoalsFromFile()
throws Exception
{
MavenProjectStub project = new MavenProjectStub();
project.setTestClasspathElements( Collections.EMPTY_LIST );
InvokerMojo invokerMojo = new InvokerMojo();
setVariableValueToObject( invokerMojo, "goalsFile", "goals.txt" );
setVariableValueToObject( invokerMojo, "project", project );
setVariableValueToObject( invokerMojo, "settings", new Settings() );
String dirPath = getBasedir() + "/src/test/resources/unit/goals-from-file/";
List goals = invokerMojo.getGoals( new File( dirPath ) );
assertEquals( 3, goals.size() );
}
public void testSingleInvokerTest()
throws Exception
{
InvokerMojo invokerMojo = new InvokerMojo();
setVariableValueToObject( invokerMojo, "goalsFile", "validate-goal.txt" );
String dirPath = getBasedir() + "/src/test/resources/unit";
List goals = invokerMojo.getGoals( new File( dirPath ) );
assertEquals( 1, goals.size() );
setVariableValueToObject( invokerMojo, "projectsDirectory", new File( dirPath ) );
setVariableValueToObject( invokerMojo, "invokerTest", "*dummy*" );
BuildJob[] poms = invokerMojo.getBuildJobs();
System.out.println( Arrays.asList( poms ) );
assertEquals( 1, poms.length );
}
public void testMultiInvokerTest()
throws Exception
{
InvokerMojo invokerMojo = new InvokerMojo();
setVariableValueToObject( invokerMojo, "goalsFile", "validate-goal.txt" );
String dirPath = getBasedir() + "/src/test/resources/unit";
List goals = invokerMojo.getGoals( new File( dirPath ) );
assertEquals( 1, goals.size() );
setVariableValueToObject( invokerMojo, "projectsDirectory", new File( dirPath ) );
setVariableValueToObject( invokerMojo, "invokerTest", "*dummy*,*terpolatio*" );
BuildJob[] poms = invokerMojo.getBuildJobs();
System.out.println( Arrays.asList( poms ) );
assertEquals( 2, poms.length );
}
public void testFullPatternInvokerTest()
throws Exception
{
InvokerMojo invokerMojo = new InvokerMojo();
setVariableValueToObject( invokerMojo, "goalsFile", "validate-goal.txt" );
String dirPath = getBasedir() + "/src/test/resources/unit";
List goals = invokerMojo.getGoals( new File( dirPath ) );
assertEquals( 1, goals.size() );
setVariableValueToObject( invokerMojo, "projectsDirectory", new File( dirPath ) );
setVariableValueToObject( invokerMojo, "invokerTest", "*" );
BuildJob[] poms = invokerMojo.getBuildJobs();
System.out.println( Arrays.asList( poms ) );
assertEquals( 4, poms.length );
}
public void testAlreadyCloned()
throws Exception
{
assertFalse( AbstractInvokerMojo.alreadyCloned( "dir", Collections.EMPTY_LIST ) );
assertTrue( AbstractInvokerMojo.alreadyCloned( "dir", Collections.singletonList( "dir" ) ) );
assertTrue( AbstractInvokerMojo.alreadyCloned( "dir" + File.separator + "sub", Collections.singletonList( "dir" ) ) );
assertFalse( AbstractInvokerMojo.alreadyCloned( "dirs", Collections.singletonList( "dir" ) ) );
}
}
././@LongLink 0000000 0000000 0000000 00000000145 00000000000 011565 L ustar root root maven-invoker-plugin-1.5/src/test/java/org/apache/maven/plugin/invoker/ExtendedMavenProjectStub.java maven-invoker-plugin-1.5/src/test/java/org/apache/maven/plugin/invoker/ExtendedMavenProjectStub.java0000644 0001750 0001750 00000003063 11011272362 032534 0 ustar tony tony /*
* 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.plugin.invoker;
import org.apache.maven.model.Scm;
import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
import java.util.Properties;
/**
* @author olamy
* @since 22 nov. 07
* @version $Id: ExtendedMavenProjectStub.java 655038 2008-05-10 10:12:02Z bentmann $
*/
public class ExtendedMavenProjectStub
extends MavenProjectStub
{
private Scm scm;
private Properties properties;
public Scm getScm()
{
return scm;
}
public void setScm( Scm scm )
{
this.scm = scm;
}
public Properties getProperties()
{
return properties;
}
public void setProperties( Properties properties )
{
this.properties= properties;
}
}
maven-invoker-plugin-1.5/src/test/java/org/apache/maven/plugin/invoker/InterpolationTest.java 0000644 0001750 0001750 00000017643 11050276167 031332 0 ustar tony tony /*
* 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.plugin.invoker;
import java.io.File;
import java.io.Reader;
import java.util.Arrays;
import java.util.List;
import java.util.Properties;
import org.apache.maven.model.Scm;
import org.apache.maven.plugin.testing.AbstractMojoTestCase;
import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
import org.apache.maven.settings.Settings;
import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.ReaderFactory;
/**
* @author olamy
* @since 22 nov. 07
* @version $Id: InterpolationTest.java 685126 2008-08-12 12:05:11Z bentmann $
*/
public class InterpolationTest
extends AbstractMojoTestCase
{
protected MavenProjectStub buildMavenProjectStub()
{
ExtendedMavenProjectStub project = new ExtendedMavenProjectStub();
project.setVersion( "1.0-SNAPSHOT" );
project.setArtifactId( "foo" );
project.setGroupId( "bar" );
Properties properties = new Properties();
properties.put( "fooOnProject", "barOnProject" );
project.setProperties( properties );
Scm scm = new Scm();
scm.setConnection( "http://blabla" );
project.setScm( scm );
return project;
}
public void testCompositeMap()
throws Exception
{
Properties properties = new Properties();
properties.put( "foo", "bar" );
properties.put( "version", "2.0-SNAPSHOT" );
CompositeMap compositeMap = new CompositeMap( buildMavenProjectStub(), properties );
assertEquals( "1.0-SNAPSHOT", compositeMap.get( "pom.version" ) );
assertEquals( "bar", compositeMap.get( "foo" ) );
assertEquals( "bar", compositeMap.get( "pom.groupId" ) );
assertEquals( "http://blabla", compositeMap.get( "pom.scm.connection" ) );
assertEquals( "barOnProject", compositeMap.get( "fooOnProject" ) );
}
public void testInterpolationGoalsFile()
throws Exception
{
InvokerMojo invokerMojo = new InvokerMojo();
setVariableValueToObject( invokerMojo, "goalsFile", "goals.txt" );
setVariableValueToObject( invokerMojo, "project", buildMavenProjectStub() );
setVariableValueToObject( invokerMojo, "settings", new Settings() );
Properties properties = new Properties();
properties.put( "cleanProps", "clean" );
properties.put( "version", "2.0-SNAPSHOT" );
setVariableValueToObject( invokerMojo, "interpolationsProperties", properties );
String dirPath = getBasedir() + File.separatorChar + "src" + File.separatorChar + "test"
+ File.separatorChar + "resources" + File.separatorChar + "unit" + File.separatorChar + "interpolation";
List goals = invokerMojo.getGoals( new File( dirPath ) );
assertEquals( goals.toString(), 2, goals.size() );
assertEquals( "clean", goals.get( 0 ) );
assertEquals( "bar:foo:1.0-SNAPSHOT:mygoal", goals.get( 1 ) );
}
public void testPomInterpolation()
throws Exception
{
Reader reader = null;
File interpolatedPomFile = null;
try
{
InvokerMojo invokerMojo = new InvokerMojo();
setVariableValueToObject( invokerMojo, "goalsFile", "goals.txt" );
setVariableValueToObject( invokerMojo, "project", buildMavenProjectStub() );
setVariableValueToObject( invokerMojo, "settings", new Settings() );
Properties properties = new Properties();
properties.put( "foo", "bar" );
properties.put( "version", "2.0-SNAPSHOT" );
setVariableValueToObject( invokerMojo, "interpolationsProperties", properties );
String dirPath = getBasedir() + File.separatorChar + "src" + File.separatorChar + "test"
+ File.separatorChar + "resources" + File.separatorChar + "unit" + File.separatorChar + "interpolation";
interpolatedPomFile = new File( getBasedir(), "target/interpolated-pom.xml" );
invokerMojo.buildInterpolatedFile( new File( dirPath, "pom.xml" ), interpolatedPomFile );
reader = ReaderFactory.newXmlReader( interpolatedPomFile );
String content = IOUtil.toString( reader );
assertTrue( content.indexOf( "bar" ) > 0 );
reader.close();
// recreate it to test delete if exists before creation
invokerMojo.buildInterpolatedFile( new File( dirPath, "pom.xml" ), interpolatedPomFile );
reader = ReaderFactory.newXmlReader( interpolatedPomFile );
content = IOUtil.toString( reader );
assertTrue( content.indexOf( "bar" ) > 0 );
reader.close();
}
finally
{
IOUtil.close( reader );
}
}
public void testProfilesFromFile()
throws Exception
{
InvokerMojo invokerMojo = new InvokerMojo();
setVariableValueToObject( invokerMojo, "project", buildMavenProjectStub() );
setVariableValueToObject( invokerMojo, "profilesFile", "profiles.txt" );
setVariableValueToObject( invokerMojo, "settings", new Settings() );
String dirPath = getBasedir() + File.separatorChar + "src" + File.separatorChar + "test" + File.separatorChar
+ "resources" + File.separatorChar + "unit" + File.separatorChar + "profiles-from-file";
List profiles = invokerMojo.getProfiles( new File( dirPath ) );
assertEquals( 2, profiles.size() );
assertTrue( profiles.contains( "foo" ) );
}
public void testEmptyProfilesFromFile()
throws Exception
{
InvokerMojo invokerMojo = new InvokerMojo();
setVariableValueToObject( invokerMojo, "project", buildMavenProjectStub() );
setVariableValueToObject( invokerMojo, "profiles", Arrays.asList( new String[] { "zloug" } ) );
setVariableValueToObject( invokerMojo, "profilesFile", "emptyProfiles.txt" );
setVariableValueToObject( invokerMojo, "settings", new Settings() );
String dirPath = getBasedir() + File.separatorChar + "src" + File.separatorChar + "test" + File.separatorChar
+ "resources" + File.separatorChar + "unit" + File.separatorChar + "profiles-from-file";
List profiles = invokerMojo.getProfiles( new File( dirPath ) );
assertFalse( profiles.contains( "zloug" ) );
assertEquals( 0, profiles.size() );
}
public void testProfilesWithNoFile()
throws Exception
{
InvokerMojo invokerMojo = new InvokerMojo();
setVariableValueToObject( invokerMojo, "profiles", Arrays.asList( new String[] { "zloug" } ) );
setVariableValueToObject( invokerMojo, "profilesFile", "zorglubProfiles.txt" );
setVariableValueToObject( invokerMojo, "settings", new Settings() );
String dirPath = getBasedir() + File.separatorChar + "src" + File.separatorChar + "test" + File.separatorChar
+ "resources" + File.separatorChar + "unit" + File.separatorChar + "profiles-from-file";
List profiles = invokerMojo.getProfiles( new File( dirPath ) );
assertTrue( profiles.contains( "zloug" ) );
assertEquals( 1, profiles.size() );
}
}
././@LongLink 0000000 0000000 0000000 00000000150 00000000000 011561 L ustar root root maven-invoker-plugin-1.5/src/test/java/org/apache/maven/plugin/invoker/GroovyScriptInterpreterTest.java maven-invoker-plugin-1.5/src/test/java/org/apache/maven/plugin/invoker/GroovyScriptInterpreterTest.j0000644 0001750 0001750 00000004264 11046715361 032703 0 ustar tony tony package org.apache.maven.plugin.invoker;
/*
* 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 java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.util.HashMap;
import java.util.Map;
import junit.framework.TestCase;
/**
* Tests the Groovy interpreter facade.
*
* @author Benjamin Bentmann
* @version $Id: GroovyScriptInterpreterTest.java 683781 2008-08-08 01:01:37Z bentmann $
*/
public class GroovyScriptInterpreterTest
extends TestCase
{
public void testEvaluateScript()
throws Exception
{
ByteArrayOutputStream out = new ByteArrayOutputStream();
ScriptInterpreter interpreter = new GroovyScriptInterpreter();
assertEquals( Boolean.TRUE, interpreter.evaluateScript( "print \"Test\"\nreturn true", null, null,
new PrintStream( out ) ) );
assertEquals( "Test", out.toString() );
}
public void testEvaluateScriptVars()
throws Exception
{
Map vars = new HashMap();
vars.put( "testVar", "data" );
ByteArrayOutputStream out = new ByteArrayOutputStream();
ScriptInterpreter interpreter = new GroovyScriptInterpreter();
assertEquals( Boolean.TRUE, interpreter.evaluateScript( "print testVar\nreturn true", null, vars,
new PrintStream( out ) ) );
assertEquals( "data", out.toString() );
}
}
././@LongLink 0000000 0000000 0000000 00000000153 00000000000 011564 L ustar root root maven-invoker-plugin-1.5/src/test/java/org/apache/maven/plugin/invoker/BeanShellScriptInterpreterTest.java maven-invoker-plugin-1.5/src/test/java/org/apache/maven/plugin/invoker/BeanShellScriptInterpreterTes0000644 0001750 0001750 00000004335 11046715361 032636 0 ustar tony tony package org.apache.maven.plugin.invoker;
/*
* 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 java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.util.HashMap;
import java.util.Map;
import junit.framework.TestCase;
/**
* Tests the BeanShell interpreter facade.
*
* @author Benjamin Bentmann
* @version $Id: BeanShellScriptInterpreterTest.java 683781 2008-08-08 01:01:37Z bentmann $
*/
public class BeanShellScriptInterpreterTest
extends TestCase
{
public void testEvaluateScript()
throws Exception
{
ByteArrayOutputStream out = new ByteArrayOutputStream();
ScriptInterpreter interpreter = new BeanShellScriptInterpreter();
assertEquals( Boolean.TRUE, interpreter.evaluateScript( "System.out.print(\"Test\"); return true;", null,
null, new PrintStream( out ) ) );
assertEquals( "Test", out.toString() );
}
public void testEvaluateScriptVars()
throws Exception
{
Map vars = new HashMap();
vars.put( "testVar", "data" );
ByteArrayOutputStream out = new ByteArrayOutputStream();
ScriptInterpreter interpreter = new BeanShellScriptInterpreter();
assertEquals( Boolean.TRUE, interpreter.evaluateScript( "System.out.print(testVar); return true;", null,
vars, new PrintStream( out ) ) );
assertEquals( "data", out.toString() );
}
}
maven-invoker-plugin-1.5/src/test/java/org/apache/maven/plugin/invoker/InvokerPropertiesTest.java 0000644 0001750 0001750 00000022131 11134630474 032157 0 ustar tony tony package org.apache.maven.plugin.invoker;
/*
* 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 java.io.File;
import java.util.Arrays;
import java.util.Collections;
import java.util.Properties;
import org.apache.maven.shared.invoker.DefaultInvocationRequest;
import org.apache.maven.shared.invoker.InvocationRequest;
import junit.framework.TestCase;
/**
* Tests the invoker properties facade.
*
* @author Benjamin Bentmann
* @version $Id: InvokerPropertiesTest.java 735456 2009-01-18 13:40:12Z bentmann $
*/
public class InvokerPropertiesTest
extends TestCase
{
public void testConstructorNullSafe()
throws Exception
{
InvokerProperties facade = new InvokerProperties( null );
assertNotNull( facade.getProperties() );
}
public void testGetInvokerProperty()
throws Exception
{
Properties props = new Properties();
InvokerProperties facade = new InvokerProperties( props );
assertNull( facade.get( "undefined-key", 0 ) );
props.setProperty( "key", "value" );
assertEquals( "value", facade.get( "key", 1 ) );
props.setProperty( "key.1", "another-value" );
assertEquals( "another-value", facade.get( "key", 1 ) );
assertEquals( "value", facade.get( "key", 2 ) );
}
public void testIsExpectedResult()
throws Exception
{
Properties props = new Properties();
InvokerProperties facade = new InvokerProperties( props );
assertTrue( facade.isExpectedResult( 0, 0 ) );
assertFalse( facade.isExpectedResult( 1, 0 ) );
props.setProperty( "invoker.buildResult", "success" );
assertTrue( facade.isExpectedResult( 0, 0 ) );
assertFalse( facade.isExpectedResult( 1, 0 ) );
props.setProperty( "invoker.buildResult", "failure" );
assertFalse( facade.isExpectedResult( 0, 0 ) );
assertTrue( facade.isExpectedResult( 1, 0 ) );
}
public void testConfigureRequestGoals()
throws Exception
{
Properties props = new Properties();
InvokerProperties facade = new InvokerProperties( props );
InvocationRequest request = new DefaultInvocationRequest();
request.setGoals( Collections.singletonList( "test" ) );
facade.configureInvocation( request, 0 );
assertEquals( Collections.singletonList( "test" ), request.getGoals() );
props.setProperty( "invoker.goals", "verify" );
facade.configureInvocation( request, 0 );
assertEquals( Collections.singletonList( "verify" ), request.getGoals() );
props.setProperty( "invoker.goals", " " );
facade.configureInvocation( request, 0 );
assertEquals( Arrays.asList( new String[0] ), request.getGoals() );
props.setProperty( "invoker.goals", " clean , test verify " );
facade.configureInvocation( request, 0 );
assertEquals( Arrays.asList( new String[] { "clean", "test", "verify" } ), request.getGoals() );
props.setProperty( "invoker.goals", "" );
facade.configureInvocation( request, 0 );
assertEquals( Arrays.asList( new String[0] ), request.getGoals() );
}
public void testConfigureRequestProfiles()
throws Exception
{
Properties props = new Properties();
InvokerProperties facade = new InvokerProperties( props );
InvocationRequest request = new DefaultInvocationRequest();
request.setProfiles( Collections.singletonList( "test" ) );
facade.configureInvocation( request, 0 );
assertEquals( Collections.singletonList( "test" ), request.getProfiles() );
props.setProperty( "invoker.profiles", "verify" );
facade.configureInvocation( request, 0 );
assertEquals( Collections.singletonList( "verify" ), request.getProfiles() );
props.setProperty( "invoker.profiles", " " );
facade.configureInvocation( request, 0 );
assertEquals( Arrays.asList( new String[0] ), request.getProfiles() );
props.setProperty( "invoker.profiles", " clean , test verify ," );
facade.configureInvocation( request, 0 );
assertEquals( Arrays.asList( new String[] { "clean", "test", "verify" } ), request.getProfiles() );
props.setProperty( "invoker.profiles", "" );
facade.configureInvocation( request, 0 );
assertEquals( Arrays.asList( new String[0] ), request.getProfiles() );
}
public void testConfigureRequestProject()
throws Exception
{
Properties props = new Properties();
InvokerProperties facade = new InvokerProperties( props );
InvocationRequest request = new DefaultInvocationRequest();
File tempPom = File.createTempFile( "maven-invoker-plugin-test", ".pom" );
File tempDir = tempPom.getParentFile();
request.setBaseDirectory( tempDir );
facade.configureInvocation( request, 0 );
assertEquals( tempDir, request.getBaseDirectory() );
assertEquals( null, request.getPomFile() );
props.setProperty( "invoker.project", tempPom.getName() );
request.setBaseDirectory( tempDir );
facade.configureInvocation( request, 0 );
assertEquals( tempDir, request.getBaseDirectory() );
assertEquals( tempPom, request.getPomFile() );
props.setProperty( "invoker.project", "" );
request.setBaseDirectory( tempDir );
facade.configureInvocation( request, 0 );
assertEquals( tempDir, request.getBaseDirectory() );
assertEquals( null, request.getPomFile() );
tempPom.delete();
}
public void testConfigureRequestMavenOpts()
throws Exception
{
Properties props = new Properties();
InvokerProperties facade = new InvokerProperties( props );
InvocationRequest request = new DefaultInvocationRequest();
request.setMavenOpts( "default" );
facade.configureInvocation( request, 0 );
assertEquals( "default", request.getMavenOpts() );
props.setProperty( "invoker.mavenOpts", "-Xmx512m" );
facade.configureInvocation( request, 0 );
assertEquals( "-Xmx512m", request.getMavenOpts() );
}
public void testConfigureRequestFailureBehavior()
throws Exception
{
Properties props = new Properties();
InvokerProperties facade = new InvokerProperties( props );
InvocationRequest request = new DefaultInvocationRequest();
request.setFailureBehavior( "fail-at-end" );
facade.configureInvocation( request, 0 );
assertEquals( "fail-at-end", request.getFailureBehavior() );
props.setProperty( "invoker.failureBehavior", "fail-never" );
facade.configureInvocation( request, 0 );
assertEquals( "fail-never", request.getFailureBehavior() );
}
public void testConfigureRequestRecursion()
throws Exception
{
Properties props = new Properties();
InvokerProperties facade = new InvokerProperties( props );
InvocationRequest request = new DefaultInvocationRequest();
request.setRecursive( true );
facade.configureInvocation( request, 0 );
assertTrue( request.isRecursive() );
request.setRecursive( false );
facade.configureInvocation( request, 0 );
assertFalse( request.isRecursive() );
props.setProperty( "invoker.nonRecursive", "true" );
facade.configureInvocation( request, 0 );
assertFalse( request.isRecursive() );
props.setProperty( "invoker.nonRecursive", "false" );
facade.configureInvocation( request, 0 );
assertTrue( request.isRecursive() );
}
public void testConfigureRequestOffline()
throws Exception
{
Properties props = new Properties();
InvokerProperties facade = new InvokerProperties( props );
InvocationRequest request = new DefaultInvocationRequest();
request.setOffline( true );
facade.configureInvocation( request, 0 );
assertTrue( request.isOffline() );
request.setOffline( false );
facade.configureInvocation( request, 0 );
assertFalse( request.isOffline() );
props.setProperty( "invoker.offline", "true" );
facade.configureInvocation( request, 0 );
assertTrue( request.isOffline() );
props.setProperty( "invoker.offline", "false" );
facade.configureInvocation( request, 0 );
assertFalse( request.isOffline() );
}
}
maven-invoker-plugin-1.5/src/test/resources/ 0000755 0001750 0001750 00000000000 11623526250 017762 5 ustar tony tony maven-invoker-plugin-1.5/src/test/resources/unit/ 0000755 0001750 0001750 00000000000 11623526250 020741 5 ustar tony tony maven-invoker-plugin-1.5/src/test/resources/unit/dummy/ 0000755 0001750 0001750 00000000000 11623526250 022074 5 ustar tony tony maven-invoker-plugin-1.5/src/test/resources/unit/dummy/pom.xml 0000644 0001750 0001750 00000002364 11011272362 023407 0 ustar tony tony
4.0.0
org.apache.maven.test
unit
pom
0.1-SNAPSHOT
@foo@