[MNG-5380] check that whitespace can be preserved in Maven plugin configuration when building MavenProject (still need to check if content is not trimmed when injected into plugin)

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@1412310 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Herve Boutemy 2012-11-21 21:36:19 +00:00
parent 784e8c3a90
commit b5eee08e3f
3 changed files with 7 additions and 5 deletions

View File

@ -1083,9 +1083,10 @@ public void testReportingPluginConfig()
{ {
PomTestWrapper pom = buildPom( "reporting-plugin-config/sub" ); PomTestWrapper pom = buildPom( "reporting-plugin-config/sub" );
assertEquals( 2, ( (List<?>) pom.getValue( "reporting/plugins[1]/configuration/stringParams" ) ).size() ); assertEquals( 3, ( (List<?>) pom.getValue( "reporting/plugins[1]/configuration/stringParams" ) ).size() );
assertEquals( "parentParam", pom.getValue( "reporting/plugins[1]/configuration/stringParams[1]/stringParam[1]" ) ); assertEquals( "parentParam", pom.getValue( "reporting/plugins[1]/configuration/stringParams[1]/stringParam[1]" ) );
assertEquals( "childParam", pom.getValue( "reporting/plugins[1]/configuration/stringParams[1]/stringParam[2]" ) ); assertEquals( "childParam", pom.getValue( "reporting/plugins[1]/configuration/stringParams[1]/stringParam[2]" ) );
assertEquals( " preserve space ", pom.getValue( "reporting/plugins[1]/configuration/stringParams[1]/stringParam[3]" ) );
assertEquals( "true", pom.getValue( "reporting/plugins[1]/configuration/booleanParam" ) ); assertEquals( "true", pom.getValue( "reporting/plugins[1]/configuration/booleanParam" ) );
} }

View File

@ -78,14 +78,14 @@ public int compareChildNodePointers( NodePointer pointer1, NodePointer pointer2
@Override @Override
public Object getValue() public Object getValue()
{ {
return getValue(node); return getValue( node );
} }
private static Object getValue( Xpp3Dom node ) private static Object getValue( Xpp3Dom node )
{ {
if ( node.getValue() != null ) if ( node.getValue() != null )
{ {
return node.getValue().trim(); return node.getValue();
} }
else else
{ {

View File

@ -36,8 +36,9 @@
<artifactId>maven-it-plugin-configuration</artifactId> <artifactId>maven-it-plugin-configuration</artifactId>
<version>2.1-SNAPSHOT</version> <version>2.1-SNAPSHOT</version>
<configuration> <configuration>
<stringParams combine.children="append"> <stringParams combine.children="append">
<stringParam>childParam</stringParam> <stringParam> childParam </stringParam>
<stringParam xml:space="preserve"> preserve space </stringParam>
</stringParams> </stringParams>
</configuration> </configuration>
</plugin> </plugin>