From ae7807628f2b3eb632fa4fc46da1c146f3a22bb7 Mon Sep 17 00:00:00 2001 From: Benjamin Bentmann Date: Sat, 21 Mar 2009 16:51:54 +0000 Subject: [PATCH] o Extended test git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@756971 13f79535-47bb-0310-9956-ffa450edef68 --- .../maven/project/PomConstructionTest.java | 73 +++++++++++++++++++ .../complete-model/pom.xml | 8 +- 2 files changed, 77 insertions(+), 4 deletions(-) diff --git a/maven-project/src/test/java/org/apache/maven/project/PomConstructionTest.java b/maven-project/src/test/java/org/apache/maven/project/PomConstructionTest.java index 64371637c8..da0de94f98 100644 --- a/maven-project/src/test/java/org/apache/maven/project/PomConstructionTest.java +++ b/maven-project/src/test/java/org/apache/maven/project/PomConstructionTest.java @@ -1076,9 +1076,82 @@ public void testCompleteModel() assertEquals( 1, ( (List) pom.getValue( "dependencies[1]/exclusions" ) ).size() ); assertEquals( "org.apache.maven.its", pom.getValue( "dependencies[1]/exclusions[1]/groupId" ) ); assertEquals( "excluded-dep", pom.getValue( "dependencies[1]/exclusions[1]/artifactId" ) ); + + assertEquals( "test", pom.getValue( "build/defaultGoal" ) ); + assertEquals( "coreit", pom.getValue( "build/finalName" ) ); + + assertPathSuffixEquals( "build", pom.getValue( "build/directory" ) ); + assertPathSuffixEquals( "build/main", pom.getValue( "build/outputDirectory" ) ); + assertPathSuffixEquals( "build/test", pom.getValue( "build/testOutputDirectory" ) ); + assertPathSuffixEquals( "sources/main", pom.getValue( "build/sourceDirectory" ) ); + assertPathSuffixEquals( "sources/test", pom.getValue( "build/testSourceDirectory" ) ); + assertPathSuffixEquals( "sources/scripts", pom.getValue( "build/scriptSourceDirectory" ) ); + + assertEquals( 1, ( (List) pom.getValue( "build/filters" ) ).size() ); + assertPathSuffixEquals( "src/main/filter/it.properties", pom.getValue( "build/filters[1]" ) ); + + assertEquals( 1, ( (List) pom.getValue( "build/resources" ) ).size() ); + assertPathSuffixEquals( "res/main", pom.getValue( "build/resources[1]/directory" ) ); + assertPathSuffixEquals( "main", pom.getValue( "build/resources[1]/targetPath" ) ); + assertEquals( Boolean.TRUE, pom.getValue( "build/resources[1]/filtering" ) ); + assertEquals( 1, ( (List) pom.getValue( "build/resources[1]/includes" ) ).size() ); + assertPathSuffixEquals( "main.included", pom.getValue( "build/resources[1]/includes[1]" ) ); + assertEquals( 1, ( (List) pom.getValue( "build/resources[1]/excludes" ) ).size() ); + assertPathSuffixEquals( "main.excluded", pom.getValue( "build/resources[1]/excludes[1]" ) ); + + assertEquals( 1, ( (List) pom.getValue( "build/testResources" ) ).size() ); + assertPathSuffixEquals( "res/test", pom.getValue( "build/testResources[1]/directory" ) ); + assertPathSuffixEquals( "test", pom.getValue( "build/testResources[1]/targetPath" ) ); + assertEquals( Boolean.TRUE, pom.getValue( "build/testResources[1]/filtering" ) ); + assertEquals( 1, ( (List) pom.getValue( "build/testResources[1]/includes" ) ).size() ); + assertPathSuffixEquals( "test.included", pom.getValue( "build/testResources[1]/includes[1]" ) ); + assertEquals( 1, ( (List) pom.getValue( "build/testResources[1]/excludes" ) ).size() ); + assertPathSuffixEquals( "test.excluded", pom.getValue( "build/testResources[1]/excludes[1]" ) ); + + assertEquals( 1, ( (List) pom.getValue( "build/plugins" ) ).size() ); + assertEquals( "org.apache.maven.its.plugins", pom.getValue( "build/plugins[1]/groupId" ) ); + assertEquals( "maven-it-plugin-build", pom.getValue( "build/plugins[1]/artifactId" ) ); + assertEquals( "2.1-SNAPSHOT", pom.getValue( "build/plugins[1]/version" ) ); + assertEquals( "test.properties", pom.getValue( "build/plugins[1]/configuration/outputFile" ) ); + assertEquals( 1, ( (List) pom.getValue( "build/plugins[1]/executions" ) ).size() ); + assertEquals( "test", pom.getValue( "build/plugins[1]/executions[1]/id" ) ); + assertEquals( "validate", pom.getValue( "build/plugins[1]/executions[1]/phase" ) ); + assertEquals( "pom.properties", pom.getValue( "build/plugins[1]/executions[1]/configuration/outputFile" ) ); + assertEquals( 1, ( (List) pom.getValue( "build/plugins[1]/executions[1]/goals" ) ).size() ); + assertEquals( "eval", pom.getValue( "build/plugins[1]/executions[1]/goals[1]" ) ); + assertEquals( 1, ( (List) pom.getValue( "build/plugins[1]/dependencies" ) ).size() ); + assertEquals( "org.apache.maven.its", pom.getValue( "build/plugins[1]/dependencies[1]/groupId" ) ); + assertEquals( "build-plugin-dep", pom.getValue( "build/plugins[1]/dependencies[1]/artifactId" ) ); + assertEquals( "0.3", pom.getValue( "build/plugins[1]/dependencies[1]/version" ) ); + assertEquals( "zip", pom.getValue( "build/plugins[1]/dependencies[1]/type" ) ); + assertEquals( 1, ( (List) pom.getValue( "build/plugins[1]/dependencies[1]/exclusions" ) ).size() ); + assertEquals( "org.apache.maven.its", pom.getValue( "build/plugins[1]/dependencies[1]/exclusions[1]/groupId" ) ); + assertEquals( "excluded-build-plugin-dep", + pom.getValue( "build/plugins[1]/dependencies[1]/exclusions[1]/artifactId" ) ); + + assertEquals( Boolean.FALSE, pom.getValue( "reporting/excludeDefaults" ) ); + assertPathSuffixEquals( "docs", pom.getValue( "reporting/outputDirectory" ) ); + + assertEquals( 1, ( (List) pom.getValue( "reporting/plugins" ) ).size() ); + assertEquals( "org.apache.maven.its.plugins", pom.getValue( "reporting/plugins[1]/groupId" ) ); + assertEquals( "maven-it-plugin-reporting", pom.getValue( "reporting/plugins[1]/artifactId" ) ); + assertEquals( "2.0-SNAPSHOT", pom.getValue( "reporting/plugins[1]/version" ) ); + assertEquals( "test.html", pom.getValue( "reporting/plugins[1]/configuration/outputFile" ) ); + assertEquals( 1, ( (List) pom.getValue( "reporting/plugins[1]/reportSets" ) ).size() ); + assertEquals( "it", pom.getValue( "reporting/plugins[1]/reportSets[1]/id" ) ); + assertEquals( "index.html", pom.getValue( "reporting/plugins[1]/reportSets[1]/configuration/outputFile" ) ); + assertEquals( 1, ( (List) pom.getValue( "reporting/plugins[1]/reportSets[1]/reports" ) ).size() ); + assertEquals( "run", pom.getValue( "reporting/plugins[1]/reportSets[1]/reports[1]" ) ); } + private void assertPathSuffixEquals( String expected, Object actual ) + { + String a = actual.toString(); + a = a.substring( a.length() - expected.length() ).replace( '\\', '/' ); + assertEquals( expected, a ); + } + private void assertPathWithNormalizedFileSeparators( Object value ) { assertEquals( new File( value.toString() ).getPath(), value.toString() ); diff --git a/maven-project/src/test/resources-project-builder/complete-model/pom.xml b/maven-project/src/test/resources-project-builder/complete-model/pom.xml index 9985716aee..4e92de8f8d 100644 --- a/maven-project/src/test/resources-project-builder/complete-model/pom.xml +++ b/maven-project/src/test/resources-project-builder/complete-model/pom.xml @@ -244,7 +244,7 @@ under the License. maven-it-plugin-build 2.1-SNAPSHOT - target/test.properties + test.properties @@ -254,7 +254,7 @@ under the License. eval - target/pom.properties + pom.properties @@ -286,7 +286,7 @@ under the License. maven-it-plugin-reporting 2.0-SNAPSHOT - target/test.html + test.html @@ -295,7 +295,7 @@ under the License. run - target/index.html + index.html