diff options
Diffstat (limited to 'framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance')
15 files changed, 0 insertions, 1354 deletions
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/AbstractProjectInheritanceTestCase.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/AbstractProjectInheritanceTestCase.java deleted file mode 100644 index 413d6fea..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/AbstractProjectInheritanceTestCase.java +++ /dev/null @@ -1,57 +0,0 @@ -package org.apache.maven.project.inheritance; - -/* - * 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 org.apache.maven.project.AbstractMavenProjectTestCase; - -/** - * @author Jason van Zyl - */ -public abstract class AbstractProjectInheritanceTestCase - extends AbstractMavenProjectTestCase -{ - protected String getTestSeries() - { - String className = getClass().getPackage().getName(); - - return className.substring( className.lastIndexOf( "." ) + 1 ); - } - - protected File projectFile( String name ) - { - return projectFile( "maven", name ); - } - - protected File projectFile( String groupId, String artifactId ) - { - return new File( getLocalRepositoryPath(), "/" + groupId + "/poms/" + artifactId + "-1.0.pom" ); - } - - // ---------------------------------------------------------------------- - // The local repository for this category of tests - // ---------------------------------------------------------------------- - - protected File getLocalRepositoryPath() - { - return getTestFile("src/test/resources/inheritance-repo/" + getTestSeries() ); - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t00/ProjectInheritanceTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t00/ProjectInheritanceTest.java deleted file mode 100644 index 0ee79807..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t00/ProjectInheritanceTest.java +++ /dev/null @@ -1,93 +0,0 @@ -package org.apache.maven.project.inheritance.t00; - -/* - * 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.model.MailingList; -import org.apache.maven.project.MavenProject; -import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase; - -/** - * A test which demonstrates maven's recursive inheritance where - * a distinct value is taken from each parent contributing to the - * the final model of the project being assembled. There is no - * overriding going on amongst the models being used in this test: - * each model in the lineage is providing a value that is not present - * anywhere else in the lineage. We are just making sure that values - * down in the lineage are bubbling up where they should. - * - * @author Jason van Zyl - */ -public class ProjectInheritanceTest - extends AbstractProjectInheritanceTestCase -{ - // ---------------------------------------------------------------------- - // - // p4 inherits from p3 - // p3 inherits from p2 - // p2 inherits from p1 - // p1 inherits from p0 - // p0 inhertis from super model - // - // or we can show it graphically as: - // - // p4 ---> p3 ---> p2 ---> p1 ---> p0 --> super model - // - // ---------------------------------------------------------------------- - - public void testProjectInheritance() - throws Exception - { - MavenProject p4 = getProject( projectFile( "p4" ) ); - - assertEquals( "p4", p4.getName() ); - - // ---------------------------------------------------------------------- - // Value inherited from p3 - // ---------------------------------------------------------------------- - - assertEquals( "2000", p4.getInceptionYear() ); - - // ---------------------------------------------------------------------- - // Value taken from p2 - // ---------------------------------------------------------------------- - - assertEquals( "mailing-list", p4.getMailingLists().get( 0 ).getName() ); - - // ---------------------------------------------------------------------- - // Value taken from p1 - // ---------------------------------------------------------------------- - - assertEquals( "scm-url/p2/p3/p4", p4.getScm().getUrl() ); - - // ---------------------------------------------------------------------- - // Value taken from p4 - // ---------------------------------------------------------------------- - - assertEquals( "Codehaus", p4.getOrganization().getName() ); - - // ---------------------------------------------------------------------- - // Value taken from super model - // ---------------------------------------------------------------------- - - assertEquals( "4.0.0", p4.getModelVersion() ); - - assertEquals( "4.0.0", p4.getModelVersion() ); - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t01/ProjectInheritanceTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t01/ProjectInheritanceTest.java deleted file mode 100644 index e6efcc4d..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t01/ProjectInheritanceTest.java +++ /dev/null @@ -1,92 +0,0 @@ -package org.apache.maven.project.inheritance.t01; - -/* - * 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.project.MavenProject; -import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase; - -/** - * A test which demonstrates maven's recursive inheritance where - * we are testing to make sure that elements stated in a model are - * not clobbered by the same elements elsewhere in the lineage. - * - * @author Jason van Zyl - */ -public class ProjectInheritanceTest - extends AbstractProjectInheritanceTestCase -{ - // ---------------------------------------------------------------------- - // - // p4 inherits from p3 - // p3 inherits from p2 - // p2 inherits from p1 - // p1 inherits from p0 - // p0 inhertis from super model - // - // or we can show it graphically as: - // - // p4 ---> p3 ---> p2 ---> p1 ---> p0 --> super model - // - // ---------------------------------------------------------------------- - - public void testProjectInheritance() - throws Exception - { - // ---------------------------------------------------------------------- - // Check p0 value for org name - // ---------------------------------------------------------------------- - - MavenProject p0 = getProject( projectFile( "maven.t01", "p0" ) ); - - assertEquals( "p0-org", p0.getOrganization().getName() ); - - // ---------------------------------------------------------------------- - // Check p1 value for org name - // ---------------------------------------------------------------------- - - MavenProject p1 = getProject( projectFile( "maven.t01", "p1" ) ); - - assertEquals( "p1-org", p1.getOrganization().getName() ); - - // ---------------------------------------------------------------------- - // Check p2 value for org name - // ---------------------------------------------------------------------- - - MavenProject p2 = getProject( projectFile( "maven.t01", "p2" ) ); - - assertEquals( "p2-org", p2.getOrganization().getName() ); - - // ---------------------------------------------------------------------- - // Check p2 value for org name - // ---------------------------------------------------------------------- - - MavenProject p3 = getProject( projectFile( "maven.t01", "p3" ) ); - - assertEquals( "p3-org", p3.getOrganization().getName() ); - - // ---------------------------------------------------------------------- - // Check p4 value for org name - // ---------------------------------------------------------------------- - - MavenProject p4 = getProject( projectFile( "maven.t01", "p4" ) ); - - assertEquals( "p4-org", p4.getOrganization().getName() ); - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t02/ProjectInheritanceTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t02/ProjectInheritanceTest.java deleted file mode 100644 index 339c81ff..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t02/ProjectInheritanceTest.java +++ /dev/null @@ -1,169 +0,0 @@ -package org.apache.maven.project.inheritance.t02; - -/* - * 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.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.apache.maven.model.Build; -import org.apache.maven.model.MailingList; -import org.apache.maven.model.Plugin; -import org.apache.maven.project.MavenProject; -import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase; - -/** - * A test which demonstrates maven's recursive inheritance where - * a distinct value is taken from each parent contributing to the - * the final model of the project being assembled. There is no - * overriding going on amongst the models being used in this test: - * each model in the lineage is providing a value that is not present - * anywhere else in the lineage. We are just making sure that values - * down in the lineage are bubbling up where they should. - * - * @author Jason van Zyl - */ -public class ProjectInheritanceTest - extends AbstractProjectInheritanceTestCase -{ - // ---------------------------------------------------------------------- - // - // p4 inherits from p3 - // p3 inherits from p2 - // p2 inherits from p1 - // p1 inherits from p0 - // p0 inhertis from super model - // - // or we can show it graphically as: - // - // p4 ---> p3 ---> p2 ---> p1 ---> p0 --> super model - // - // ---------------------------------------------------------------------- - - public void testProjectInheritance() - throws Exception - { - File localRepo = getLocalRepositoryPath(); - - System.out.println( "Local repository is at: " + localRepo.getAbsolutePath() ); - - File pom0 = new File( localRepo, "p0/pom.xml" ); - File pom1 = new File( pom0.getParentFile(), "p1/pom.xml" ); - File pom2 = new File( pom1.getParentFile(), "p2/pom.xml" ); - File pom3 = new File( pom2.getParentFile(), "p3/pom.xml" ); - File pom4 = new File( pom3.getParentFile(), "p4/pom.xml" ); - File pom5 = new File( pom4.getParentFile(), "p5/pom.xml" ); - - System.out.println( "Location of project-4's POM: " + pom4.getPath() ); - - // load everything... - MavenProject project0 = getProject( pom0 ); - MavenProject project1 = getProject( pom1 ); - MavenProject project2 = getProject( pom2 ); - MavenProject project3 = getProject( pom3 ); - MavenProject project4 = getProject( pom4 ); - MavenProject project5 = getProject( pom5 ); - - assertEquals( "p4", project4.getName() ); - - // ---------------------------------------------------------------------- - // Value inherited from p3 - // ---------------------------------------------------------------------- - - assertEquals( "2000", project4.getInceptionYear() ); - - // ---------------------------------------------------------------------- - // Value taken from p2 - // ---------------------------------------------------------------------- - - assertEquals( "mailing-list", project4.getMailingLists().get( 0 ).getName() ); - - // ---------------------------------------------------------------------- - // Value taken from p1 - // ---------------------------------------------------------------------- - - assertEquals( "scm-url/p2/p3/p4", project4.getScm().getUrl() ); - - // ---------------------------------------------------------------------- - // Value taken from p4 - // ---------------------------------------------------------------------- - - assertEquals( "Codehaus", project4.getOrganization().getName() ); - - // ---------------------------------------------------------------------- - // Value taken from super model - // ---------------------------------------------------------------------- - - assertEquals( "4.0.0", project4.getModelVersion() ); - - Build build = project4.getBuild(); - List<Plugin> plugins = build.getPlugins(); - - Map validPluginCounts = new HashMap(); - - String testPluginArtifactId = "maven-compiler-plugin"; - - // this is the plugin we're looking for. - validPluginCounts.put( testPluginArtifactId, 0 ); - - // these are injected if -DperformRelease=true - validPluginCounts.put( "maven-deploy-plugin", 0 ); - validPluginCounts.put( "maven-javadoc-plugin", 0 ); - validPluginCounts.put( "maven-source-plugin", 0 ); - - Plugin testPlugin = null; - - for ( Plugin plugin : plugins ) - { - String pluginArtifactId = plugin.getArtifactId(); - - if ( !validPluginCounts.containsKey( pluginArtifactId ) ) - { - fail( "Illegal plugin found: " + pluginArtifactId ); - } - else - { - if ( pluginArtifactId.equals( testPluginArtifactId ) ) - { - testPlugin = plugin; - } - - Integer count = (Integer) validPluginCounts.get( pluginArtifactId ); - - if ( count > 0 ) - { - fail( "Multiple copies of plugin: " + pluginArtifactId + " found in POM." ); - } - else - { - count = count + 1; - - validPluginCounts.put( pluginArtifactId, count ); - } - } - } - - List executions = testPlugin.getExecutions(); - - assertEquals( 1, executions.size() ); - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t03/ProjectInheritanceTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t03/ProjectInheritanceTest.java deleted file mode 100644 index 73f518e4..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t03/ProjectInheritanceTest.java +++ /dev/null @@ -1,68 +0,0 @@ -package org.apache.maven.project.inheritance.t03; - -/* - * 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 org.apache.maven.project.MavenProject; -import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase; - -/** - * A test which demonstrates maven's recursive inheritance where - * a distinct value is taken from each parent contributing to the - * the final model of the project being assembled. There is no - * overriding going on amongst the models being used in this test: - * each model in the lineage is providing a value that is not present - * anywhere else in the lineage. We are just making sure that values - * down in the lineage are bubbling up where they should. - * - * @author Jason van Zyl - */ -public class ProjectInheritanceTest - extends AbstractProjectInheritanceTestCase -{ - // ---------------------------------------------------------------------- - // - // p1 inherits from p0 - // p0 inhertis from super model - // - // or we can show it graphically as: - // - // p1 ---> p0 --> super model - // - // ---------------------------------------------------------------------- - - public void testProjectInheritance() - throws Exception - { - File localRepo = getLocalRepositoryPath(); - File pom0 = new File( localRepo, "p0/pom.xml" ); - - File pom0Basedir = pom0.getParentFile(); - - File pom1 = new File( pom0Basedir, "p1/pom.xml" ); - - // load everything... - MavenProject project0 = getProject( pom0 ); - MavenProject project1 = getProject( pom1 ); - - assertEquals( pom0Basedir, project1.getParent().getBasedir() ); - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t04/ProjectInheritanceTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t04/ProjectInheritanceTest.java deleted file mode 100644 index e24262f1..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t04/ProjectInheritanceTest.java +++ /dev/null @@ -1,86 +0,0 @@ -package org.apache.maven.project.inheritance.t04; - -/* - * 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.Iterator; -import java.util.Set; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.project.MavenProject; -import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase; - -/** - * Verifies the version of a dependency listed in a parent's - * dependencyManagement section is chosen over another version of the same - * dependency, listed transitively. - * - * @author <a href="mailto:pschneider@gmail.com">Patrick Schneider</a> - */ -public class ProjectInheritanceTest - extends AbstractProjectInheritanceTestCase -{ - // ---------------------------------------------------------------------- - // - // p1 inherits from p0 - // p0 inhertis from super model - // - // or we can show it graphically as: - // - // p1 ---> p0 --> super model - // - // p1 has a depMgmt section that specifies versions 1.0 of jars "a" & "b" - // jar "a" has a transitive dependency on 2.0 of jar "b", but maven should - // prefer to use version 1.0. - // - // ---------------------------------------------------------------------- - - public void testDependencyManagementOverridesTransitiveDependencyVersion() - throws Exception - { - File localRepo = getLocalRepositoryPath(); - File pom0 = new File( localRepo, "p0/pom.xml" ); - File pom0Basedir = pom0.getParentFile(); - File pom1 = new File( pom0Basedir, "p1/pom.xml" ); - - // load the child project, which inherits from p0... - MavenProject project0 = getProjectWithDependencies( pom0 ); - MavenProject project1 = getProjectWithDependencies( pom1 ); - - assertEquals( pom0Basedir, project1.getParent().getBasedir() ); - Set set = project1.getArtifacts(); - assertNotNull( "No artifacts", set ); - assertTrue( "No Artifacts", set.size() > 0 ); - assertTrue( "Set size should be 3, is " + set.size(), set.size() == 3 ); - - for ( Object aSet : set ) - { - Artifact artifact = (Artifact) aSet; - System.out.println( - "Artifact: " + artifact.getDependencyConflictId() + " " + artifact.getVersion() + " Optional=" + ( - artifact.isOptional() - ? "true" - : "false" ) ); - assertTrue( "Incorrect version for " + artifact.getDependencyConflictId(), - artifact.getVersion().equals( "1.0" ) ); - } - - } -}
\ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t05/ProjectInheritanceTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t05/ProjectInheritanceTest.java deleted file mode 100644 index 1d2bd182..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t05/ProjectInheritanceTest.java +++ /dev/null @@ -1,79 +0,0 @@ -package org.apache.maven.project.inheritance.t05; - -/* - * 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.Iterator; -import java.util.Set; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.project.MavenProject; -import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase; - -/** - * A test which demonstrates maven's dependency management - * - * @author <a href="rgoers@apache.org">Ralph Goers</a> - */ -public class ProjectInheritanceTest - extends AbstractProjectInheritanceTestCase -{ - // ---------------------------------------------------------------------- - // - // p1 inherits from p0 - // p0 inhertis from super model - // - // or we can show it graphically as: - // - // p1 ---> p0 --> super model - // - // ---------------------------------------------------------------------- - - public void testDependencyManagement() - throws Exception - { - File localRepo = getLocalRepositoryPath(); - File pom0 = new File( localRepo, "p0/pom.xml" ); - - File pom0Basedir = pom0.getParentFile(); - - File pom1 = new File( pom0Basedir, "p1/pom.xml" ); - - // load everything... - MavenProject project0 = getProjectWithDependencies( pom0 ); - MavenProject project1 = getProjectWithDependencies( pom1 ); - - assertEquals( pom0Basedir, project1.getParent().getBasedir() ); - Set set = project1.getArtifacts(); - assertNotNull( "No artifacts", set ); - assertTrue( "No Artifacts", set.size() > 0 ); - - for ( Object aSet : set ) - { - Artifact artifact = (Artifact) aSet; - System.out.println( - "Artifact: " + artifact.getDependencyConflictId() + " " + artifact.getVersion() + " Scope: " - + artifact.getScope() ); - assertTrue( "Incorrect version for " + artifact.getDependencyConflictId(), - artifact.getVersion().equals( "1.0" ) ); - } - - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t06/ProjectInheritanceTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t06/ProjectInheritanceTest.java deleted file mode 100644 index 1b80dfeb..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t06/ProjectInheritanceTest.java +++ /dev/null @@ -1,80 +0,0 @@ -package org.apache.maven.project.inheritance.t06; - -/* - * 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.Iterator; -import java.util.Set; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.project.MavenProject; -import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase; - -/** - * A test which demonstrates maven's dependency management - * - * @author <a href="rgoers@apache.org">Ralph Goers</a> - */ -public class ProjectInheritanceTest - extends AbstractProjectInheritanceTestCase -{ - // ---------------------------------------------------------------------- - // - // p1 inherits from p0 - // p0 inhertis from super model - // - // or we can show it graphically as: - // - // p1 ---> p0 --> super model - // - // ---------------------------------------------------------------------- - - public void testDependencyManagement() - throws Exception - { - File localRepo = getLocalRepositoryPath(); - File pom0 = new File( localRepo, "p0/pom.xml" ); - - File pom0Basedir = pom0.getParentFile(); - - File pom1 = new File( pom0Basedir, "p1/pom.xml" ); - - // load everything... - MavenProject project0 = getProjectWithDependencies( pom0 ); - MavenProject project1 = getProjectWithDependencies( pom1 ); - - assertEquals( pom0Basedir, project1.getParent().getBasedir() ); - Set set = project1.getArtifacts(); - assertNotNull( "No artifacts", set ); - assertTrue( "No Artifacts", set.size() > 0 ); - Iterator iter = set.iterator(); - assertTrue( "Set size should be 4, is " + set.size(), set.size() == 4 ); - - while ( iter.hasNext() ) - { - Artifact artifact = (Artifact) iter.next(); - System.out.println( "Artifact: " + artifact.getDependencyConflictId() + " " + artifact.getVersion() - + " Optional=" + ( artifact.isOptional() ? "true" : "false" ) ); - assertTrue( "Incorrect version for " + artifact.getDependencyConflictId(), - artifact.getVersion().equals( "1.0" ) ); - } - - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t07/ProjectInheritanceTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t07/ProjectInheritanceTest.java deleted file mode 100644 index 68586aaf..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t07/ProjectInheritanceTest.java +++ /dev/null @@ -1,82 +0,0 @@ -package org.apache.maven.project.inheritance.t07; - -/* - * 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.Iterator; -import java.util.Set; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.project.MavenProject; -import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase; - -/** - * A test which demonstrates maven's dependency management - * - * @author Jason van Zyl - */ -public class ProjectInheritanceTest - extends AbstractProjectInheritanceTestCase -{ - // ---------------------------------------------------------------------- - // - // p1 inherits from p0 - // p0 inhertis from super model - // - // or we can show it graphically as: - // - // p1 ---> p0 --> super model - // - // ---------------------------------------------------------------------- - - public void testDependencyManagement() - throws Exception - { - File localRepo = getLocalRepositoryPath(); - File pom0 = new File( localRepo, "p0/pom.xml" ); - - File pom0Basedir = pom0.getParentFile(); - - File pom1 = new File( pom0Basedir, "p1/pom.xml" ); - - // load everything... - MavenProject project1 = getProjectWithDependencies( pom1 ); - - assertEquals( pom0Basedir, project1.getParent().getBasedir() ); - System.out.println("Project " + project1.getId() + " " + project1); - Set set = project1.getArtifacts(); - assertNotNull("No artifacts", set); - assertTrue("No Artifacts", set.size() > 0); - assertTrue("Set size should be 3, is " + set.size(), set.size() == 3 ); - - for ( Object aSet : set ) - { - Artifact artifact = (Artifact) aSet; - assertFalse( "", artifact.getArtifactId().equals( "t07-d" ) ); - System.out.println( - "Artifact: " + artifact.getDependencyConflictId() + " " + artifact.getVersion() + " Optional=" + ( - artifact.isOptional() - ? "true" - : "false" ) ); - assertTrue( "Incorrect version for " + artifact.getDependencyConflictId(), - artifact.getVersion().equals( "1.0" ) ); - } - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t08/ProjectInheritanceTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t08/ProjectInheritanceTest.java deleted file mode 100644 index 1afb8e8e..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t08/ProjectInheritanceTest.java +++ /dev/null @@ -1,81 +0,0 @@ -package org.apache.maven.project.inheritance.t08; - -/* - * 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.Iterator; -import java.util.Set; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.project.MavenProject; -import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase; - -/** - * A test which demonstrates maven's dependency management - * - * @author <a href="rgoers@apache.org">Ralph Goers</a> - */ -public class ProjectInheritanceTest - extends AbstractProjectInheritanceTestCase -{ - // ---------------------------------------------------------------------- - // - // p1 inherits from p0 - // p0 inhertis from super model - // - // or we can show it graphically as: - // - // p1 ---> p0 --> super model - // - // ---------------------------------------------------------------------- - - public void testDependencyManagement() - throws Exception - { - File localRepo = getLocalRepositoryPath(); - File pom0 = new File( localRepo, "p0/pom.xml" ); - - File pom0Basedir = pom0.getParentFile(); - - File pom1 = new File( pom0Basedir, "p1/pom.xml" ); - - // load everything... - MavenProject project0 = getProjectWithDependencies( pom0 ); - MavenProject project1 = getProjectWithDependencies( pom1 ); - - assertEquals( pom0Basedir, project1.getParent().getBasedir() ); - System.out.println( "Project " + project1.getId() + " " + project1 ); - Set set = project1.getArtifacts(); - assertNotNull( "No artifacts", set ); - assertTrue( "No Artifacts", set.size() > 0 ); - Iterator iter = set.iterator(); - assertTrue( "Set size should be 4, is " + set.size(), set.size() == 4 ); - - while ( iter.hasNext() ) - { - Artifact artifact = (Artifact) iter.next(); - System.out.println( "Artifact: " + artifact.getDependencyConflictId() + " " + artifact.getVersion() - + " Optional=" + ( artifact.isOptional() ? "true" : "false" ) ); - assertTrue( "Incorrect version for " + artifact.getDependencyConflictId(), - artifact.getVersion().equals( "1.0" ) ); - } - - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t09/ProjectInheritanceTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t09/ProjectInheritanceTest.java deleted file mode 100644 index 6a29b732..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t09/ProjectInheritanceTest.java +++ /dev/null @@ -1,119 +0,0 @@ -package org.apache.maven.project.inheritance.t09; - -/* - * 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.Map; - -import org.apache.maven.project.MavenProject; -import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase; - -/** - * Verifies exclusions listed in dependencyManagement are valid for - * transitive dependencies. - * - * @author <a href="mailto:pschneider@gmail.com">Patrick Schneider</a> - */ -public class ProjectInheritanceTest - extends AbstractProjectInheritanceTestCase -{ - // ---------------------------------------------------------------------- - // - // p1 inherits from p0 - // p0 inhertis from super model - // - // or we can show it graphically as: - // - // p1 ---> p0 --> super model - // - // ---------------------------------------------------------------------- - - /** - * How the test project is set up: - * - * 1. dependencyManagement lists dependencies on a & b, - * with an exclusion on c in b. - * 2. the child project lists a dependency on project a only - * 3. a depends on b (which is transitive to the child project), - * and b depends on c. - * - * We should see that the resulting size of collected artifacts is two: - * a & b only. - */ - public void testDependencyManagementExclusionsExcludeTransitively() - throws Exception - { - File localRepo = getLocalRepositoryPath(); - - File pom0 = new File( localRepo, "p0/pom.xml" ); - File pom0Basedir = pom0.getParentFile(); - File pom1 = new File( pom0Basedir, "p1/pom.xml" ); - - // load the child project, which inherits from p0... - MavenProject project0 = getProjectWithDependencies( pom0 ); - MavenProject project1 = getProjectWithDependencies( pom1 ); - - assertNotNull("Parent is null", project1.getParent()); - assertEquals( pom0Basedir, project1.getParent().getBasedir() ); - Map map = project1.getArtifactMap(); - - assertNotNull("No artifacts", map); - assertTrue("No Artifacts", map.size() > 0); - assertTrue("Set size should be 2, is " + map.size(), map.size() == 2); - - assertTrue("maven-test:t09-a is not in the project", map.containsKey( "maven-test:t09-a" )); - assertTrue("maven-test:t09-b is not in the project", map.containsKey( "maven-test:t09-b" )); - assertFalse("maven-test:t09-c is in the project", map.containsKey( "maven-test:t09-c" )); - } - - /** - * Setup exactly the same as the above test, except that the child project - * now depends upon d, which has a transitive dependency on c. Even though - * we did list an exclusion on c, it was only from within the context of - * project b. We will pick up project c in this case because no - * restrictions were placed on d. This demonstrates that a, b, c, & d will - * all be collected. - * - * @throws Exception - */ - public void testDependencyManagementExclusionDoesNotOverrideGloballyForTransitives() - throws Exception - { - File localRepo = getLocalRepositoryPath(); - - File pom0 = new File( localRepo, "p0/pom.xml" ); - File pom0Basedir = pom0.getParentFile(); - File pom2 = new File( pom0Basedir, "p2/pom.xml" ); - - // load the child project, which inherits from p0... - MavenProject project0 = getProjectWithDependencies( pom0 ); - MavenProject project2 = getProjectWithDependencies( pom2 ); - - assertEquals( pom0Basedir, project2.getParent().getBasedir() ); - Map map = project2.getArtifactMap(); - assertNotNull( "No artifacts", map ); - assertTrue( "No Artifacts", map.size() > 0 ); - assertTrue( "Set size should be 4, is " + map.size(), map.size() == 4 ); - - assertTrue( "maven-test:t09-a is not in the project", map.containsKey( "maven-test:t09-a" ) ); - assertTrue( "maven-test:t09-b is not in the project", map.containsKey( "maven-test:t09-b" ) ); - assertTrue( "maven-test:t09-c is not in the project", map.containsKey( "maven-test:t09-c" ) ); - assertTrue( "maven-test:t09-d is not in the project", map.containsKey( "maven-test:t09-d" ) ); - } -}
\ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t10/ProjectInheritanceTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t10/ProjectInheritanceTest.java deleted file mode 100644 index 9e5137f2..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t10/ProjectInheritanceTest.java +++ /dev/null @@ -1,94 +0,0 @@ -package org.apache.maven.project.inheritance.t10; - -/* - * 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.Map; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.project.MavenProject; -import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase; - -/** - * Verifies scope inheritence of direct and transitive dependencies. - * - * Should show three behaviors: - * - * 1. dependencyManagement should override the scope of transitive dependencies. - * 2. Direct dependencies should override the scope of dependencyManagement. - * 3. Direct dependencies should inherit scope from dependencyManagement when - * they do not explicitly state a scope. - * - * @author <a href="mailto:pschneider@gmail.com">Patrick Schneider</a> - */ -public class ProjectInheritanceTest - extends AbstractProjectInheritanceTestCase -{ - // ---------------------------------------------------------------------- - // - // p1 inherits from p0 - // p0 inhertis from super model - // - // or we can show it graphically as: - // - // p1 ---> p0 --> super model - // - // ---------------------------------------------------------------------- - - public void testDependencyManagementOverridesTransitiveDependencyVersion() - throws Exception - { - File localRepo = getLocalRepositoryPath(); - - File pom0 = new File( localRepo, "p0/pom.xml" ); - File pom0Basedir = pom0.getParentFile(); - File pom1 = new File( pom0Basedir, "p1/pom.xml" ); - - // load the child project, which inherits from p0... - MavenProject project0 = getProjectWithDependencies( pom0 ); - MavenProject project1 = getProjectWithDependencies( pom1 ); - - assertEquals( pom0Basedir, project1.getParent().getBasedir() ); - System.out.println("Project " + project1.getId() + " " + project1); - Map map = project1.getArtifactMap(); - assertNotNull("No artifacts", map); - assertTrue("No Artifacts", map.size() > 0); - assertTrue("Set size should be 3, is " + map.size(), map.size() == 3); - - Artifact a = (Artifact) map.get("maven-test:t10-a"); - Artifact b = (Artifact) map.get("maven-test:t10-b"); - Artifact c = (Artifact) map.get("maven-test:t10-c"); - - assertNotNull( a ); - assertNotNull( b ); - assertNotNull( c ); - - // inherited from depMgmt - System.out.println(a.getScope()); - assertTrue("Incorrect scope for " + a.getDependencyConflictId(), a.getScope().equals("test")); - - // transitive dep, overridden b depMgmt - assertTrue("Incorrect scope for " + b.getDependencyConflictId(), b.getScope().equals("runtime")); - - // direct dep, overrides depMgmt - assertTrue("Incorrect scope for " + c.getDependencyConflictId(), c.getScope().equals("runtime")); - - } -}
\ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t11/ProjectInheritanceTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t11/ProjectInheritanceTest.java deleted file mode 100644 index bbdecd7a..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t11/ProjectInheritanceTest.java +++ /dev/null @@ -1,64 +0,0 @@ -package org.apache.maven.project.inheritance.t11; - -/* - * 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 org.apache.maven.project.MavenProject; -import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase; - -/** - * Verifies scope of root project is preserved regardless of parent depenedency management. - * - * @author <a href="mailto:pschneider@gmail.com">Patrick Schneider</a> - * @see <a href="http://jira.codehaus.org/browse/MNG-2919">MNG-2919</a> - */ -public class ProjectInheritanceTest - extends AbstractProjectInheritanceTestCase -{ - // ---------------------------------------------------------------------- - // - // p1 inherits from p0 - // p0 inhertis from super model - // - // or we can show it graphically as: - // - // p1 ---> p0 --> super model - // - // ---------------------------------------------------------------------- - - public void testDependencyManagementDoesNotOverrideScopeOfCurrentArtifact() - throws Exception - { - File localRepo = getLocalRepositoryPath(); - - File pom0 = new File( localRepo, "p0/pom.xml" ); - File pom0Basedir = pom0.getParentFile(); - File pom1 = new File( pom0Basedir, "p1/pom.xml" ); - - // load the child project, which inherits from p0... - MavenProject project0 = getProjectWithDependencies( pom0 ); - MavenProject project1 = getProjectWithDependencies( pom1 ); - - assertEquals( pom0Basedir, project1.getParent().getBasedir() ); - assertNull( "dependencyManagement has overwritten the scope of the currently building child project", - project1.getArtifact().getScope() ); - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t12/ProjectInheritanceTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t12/ProjectInheritanceTest.java deleted file mode 100644 index 814e4871..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t12/ProjectInheritanceTest.java +++ /dev/null @@ -1,65 +0,0 @@ -package org.apache.maven.project.inheritance.t12; - -/* - * 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.Map; - -import org.apache.maven.model.Plugin; -import org.apache.maven.project.MavenProject; -import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase; - -/** - * Verifies that plugin execution sections in the parent POM that have - * inherit == false are not inherited to the child POM. - */ -public class ProjectInheritanceTest extends AbstractProjectInheritanceTestCase -{ - // ---------------------------------------------------------------------- - // - // p1 inherits from p0 - // p0 inherits from super model - // - // or we can show it graphically as: - // - // p1 ---> p0 --> super model - // - // ---------------------------------------------------------------------- - - public void testFalsePluginExecutionInheritValue() throws Exception - { - File localRepo = getLocalRepositoryPath(); - - File pom0 = new File( localRepo, "p0/pom.xml" ); - File pom0Basedir = pom0.getParentFile(); - File pom1 = new File( pom0Basedir, "p1/pom.xml" ); - - getProjectWithDependencies( pom0 ); - MavenProject project1 = getProjectWithDependencies( pom1 ); - - Map pluginMap = project1.getBuild().getPluginsAsMap(); - Plugin compilerPlugin = (Plugin) pluginMap.get( "org.apache.maven.plugins:maven-compiler-plugin" ); - - assertNotNull( compilerPlugin ); - - Map executionMap = compilerPlugin.getExecutionsAsMap(); - assertNull( "Plugin execution: \'test\' should NOT exist in the compiler plugin specification for the child project!", executionMap.get( "test" ) ); - } -}
\ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t12scm/ProjectInheritanceTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t12scm/ProjectInheritanceTest.java deleted file mode 100644 index 3b086624..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t12scm/ProjectInheritanceTest.java +++ /dev/null @@ -1,125 +0,0 @@ -package org.apache.maven.project.inheritance.t12scm; - -/* - * 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 org.apache.maven.project.MavenProject; -import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase; - -/** - * Verifies SCM inheritance uses modules statement from parent. - * - * @author jdcasey - */ -public class ProjectInheritanceTest - extends AbstractProjectInheritanceTestCase -{ - // ---------------------------------------------------------------------- - // - // p1 inherits from p0 - // p0 inhertis from super model - // - // or we can show it graphically as: - // - // p1 ---> p0 --> super model - // - // ---------------------------------------------------------------------- - - public void testScmInfoCalculatedCorrectlyOnParentAndChildRead() - throws Exception - { - File localRepo = getLocalRepositoryPath(); - - File pom0 = new File( localRepo, "p0/pom.xml" ); - File pom0Basedir = pom0.getParentFile(); - File pom1 = new File( pom0Basedir, "modules/p1/pom.xml" ); - - // load the child project, which inherits from p0... - MavenProject project0 = getProject( pom0 ); - MavenProject project1 = getProject( pom1 ); - - System.out.println( "\n\n" ); - System.out.println( "Parent SCM URL is: " + project0.getScm().getUrl() ); - System.out.println( "Child SCM URL is: " + project1.getScm().getUrl() ); - System.out.println(); - System.out.println( "Parent SCM connection is: " + project0.getScm().getConnection() ); - System.out.println( "Child SCM connection is: " + project1.getScm().getConnection() ); - System.out.println(); - System.out.println( "Parent SCM developer connection is: " - + project0.getScm().getDeveloperConnection() ); - System.out.println( "Child SCM developer connection is: " - + project1.getScm().getDeveloperConnection() ); - - assertEquals( project1.getScm().getUrl(), project0.getScm().getUrl() + "/modules/p1" ); - assertEquals( project1.getScm().getConnection(), project0.getScm().getConnection() - + "/modules/p1" ); - assertEquals( project1.getScm().getDeveloperConnection(), project0.getScm() - .getDeveloperConnection() - + "/modules/p1" ); - } - - public void testScmInfoCalculatedCorrectlyOnChildOnlyRead() - throws Exception - { - File localRepo = getLocalRepositoryPath(); - - File pom1 = new File( localRepo, "p0/modules/p1/pom.xml" ); - - // load the child project, which inherits from p0... - MavenProject project1 = getProject( pom1 ); - - System.out.println( "\n\n" ); - System.out.println( "Child SCM URL is: " + project1.getScm().getUrl() ); - System.out.println( "Child SCM connection is: " + project1.getScm().getConnection() ); - System.out.println( "Child SCM developer connection is: " - + project1.getScm().getDeveloperConnection() ); - - assertEquals( "http://host/viewer?path=/p0/modules/p1", project1.getScm().getUrl() ); - assertEquals( "scm:svn:http://host/p0/modules/p1", project1.getScm().getConnection() ); - assertEquals( "scm:svn:https://host/p0/modules/p1", project1.getScm().getDeveloperConnection() ); - } - -// public void testScmInfoCalculatedCorrectlyOnChildReadFromLocalRepository() -// throws Exception -// { -// File localRepo = getLocalRepositoryPath(); -// -// ArtifactFactory factory = (ArtifactFactory) lookup( ArtifactFactory.class ); -// Artifact artifact = factory.createProjectArtifact( "maven", "p1", "1.0" ); -// -// ArtifactRepositoryFactory repoFactory = (ArtifactRepositoryFactory) lookup( ArtifactRepositoryFactory.class ); -// ArtifactRepository localArtifactRepo = repoFactory.createLocalRepository( localRepo ); -// -// MavenProject project1 = getProjectBuilder().buildFromRepository( artifact, Collections.EMPTY_LIST, localArtifactRepo ); -// -// System.out.println( "\n\n" ); -// System.out.println( "Child SCM URL is: " + project1.getScm().getUrl() ); -// System.out.println( "Child SCM connection is: " + project1.getScm().getConnection() ); -// System.out.println( "Child SCM developer connection is: " -// + project1.getScm().getDeveloperConnection() ); -// -// assertEquals( project1.getScm().getUrl(), "http://host/viewer?path=/p0/modules/p1" ); -// assertEquals( project1.getScm().getConnection(), "scm:svn:http://host/p0/modules/p1" ); -// assertEquals( project1.getScm().getDeveloperConnection(), -// "scm:svn:https://host/p0/modules/p1" ); -// } - -} |