aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project
diff options
context:
space:
mode:
Diffstat (limited to 'framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project')
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/AbstractMavenProjectTestCase.java189
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/DefaultMavenProjectBuilderTest.java193
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/EmptyLifecycleExecutor.java109
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/EmptyProjectBuildingHelper.java62
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/ExtensionDescriptorBuilderTest.java101
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/LegacyLocalRepositoryManager.java192
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/MavenProjectTest.java197
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/PomConstructionTest.java1878
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/ProjectBuilderTest.java87
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/ProjectSorterTest.java363
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/TestMetadataSource.java51
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/artifact/DefaultMavenMetadataCacheTest.java81
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/artifact/MavenMetadataSourceTest.java183
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/canonical/CanonicalProjectBuilderTest.java101
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/harness/PomTestWrapper.java121
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/harness/Xpp3DomAttributeIterator.java89
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/harness/Xpp3DomAttributePointer.java105
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/harness/Xpp3DomNodeIterator.java161
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/harness/Xpp3DomNodePointer.java155
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/harness/Xpp3DomPointerFactory.java61
20 files changed, 0 insertions, 4479 deletions
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/AbstractMavenProjectTestCase.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/AbstractMavenProjectTestCase.java
deleted file mode 100644
index 73bdbcae..00000000
--- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/AbstractMavenProjectTestCase.java
+++ /dev/null
@@ -1,189 +0,0 @@
-package org.apache.maven.project;
-
-/*
- * 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.io.FileNotFoundException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.Arrays;
-
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
-import org.apache.maven.model.building.ModelBuildingException;
-import org.apache.maven.model.building.ModelProblem;
-import org.apache.maven.repository.RepositorySystem;
-import org.apache.maven.repository.internal.MavenRepositorySystemUtils;
-import org.codehaus.plexus.ContainerConfiguration;
-import org.codehaus.plexus.PlexusConstants;
-import org.codehaus.plexus.PlexusTestCase;
-import org.eclipse.aether.DefaultRepositorySystemSession;
-
-/**
- * @author Jason van Zyl
- */
-public abstract class AbstractMavenProjectTestCase
- extends PlexusTestCase
-{
- protected ProjectBuilder projectBuilder;
-
- protected RepositorySystem repositorySystem;
-
- @Override
- protected void customizeContainerConfiguration( ContainerConfiguration containerConfiguration )
- {
- super.customizeContainerConfiguration( containerConfiguration );
- containerConfiguration.setAutoWiring( true );
- containerConfiguration.setClassPathScanning( PlexusConstants.SCANNING_INDEX );
- }
-
- protected void setUp()
- throws Exception
- {
- super.setUp();
-
- if ( getContainer().hasComponent( ProjectBuilder.class, "test" ) )
- {
- projectBuilder = lookup( ProjectBuilder.class, "test" );
- }
- else
- {
- // default over to the main project builder...
- projectBuilder = lookup( ProjectBuilder.class );
- }
-
- repositorySystem = lookup( RepositorySystem.class );
- }
-
- @Override
- protected void tearDown()
- throws Exception
- {
- projectBuilder = null;
-
- super.tearDown();
- }
-
- protected ProjectBuilder getProjectBuilder()
- {
- return projectBuilder;
- }
-
- @Override
- protected String getCustomConfigurationName()
- {
- String name = AbstractMavenProjectTestCase.class.getName().replace( '.', '/' ) + ".xml";
- System.out.println( name );
- return name;
- }
-
- // ----------------------------------------------------------------------
- // Local repository
- // ----------------------------------------------------------------------
-
- protected File getLocalRepositoryPath()
- throws FileNotFoundException, URISyntaxException
- {
- File markerFile = getFileForClasspathResource( "local-repo/marker.txt" );
-
- return markerFile.getAbsoluteFile().getParentFile();
- }
-
- protected static File getFileForClasspathResource( String resource )
- throws FileNotFoundException
- {
- ClassLoader cloader = Thread.currentThread().getContextClassLoader();
-
- URL resourceUrl = cloader.getResource( resource );
-
- if ( resourceUrl == null )
- {
- throw new FileNotFoundException( "Unable to find: " + resource );
- }
-
- return new File( URI.create( resourceUrl.toString().replaceAll( " ", "%20" ) ) );
- }
-
- protected ArtifactRepository getLocalRepository()
- throws Exception
- {
- ArtifactRepositoryLayout repoLayout = lookup( ArtifactRepositoryLayout.class, "legacy" );
-
- ArtifactRepository r = repositorySystem.createArtifactRepository( "local", "file://" + getLocalRepositoryPath().getAbsolutePath(), repoLayout, null, null );
-
- return r;
- }
-
- // ----------------------------------------------------------------------
- // Project building
- // ----------------------------------------------------------------------
-
- protected MavenProject getProjectWithDependencies( File pom )
- throws Exception
- {
- ProjectBuildingRequest configuration = newBuildingRequest();
- configuration.setRemoteRepositories( Arrays.asList( new ArtifactRepository[] {} ) );
- configuration.setProcessPlugins( false );
- configuration.setResolveDependencies( true );
-
- try
- {
- return projectBuilder.build( pom, configuration ).getProject();
- }
- catch ( Exception e )
- {
- Throwable cause = e.getCause();
- if ( cause instanceof ModelBuildingException )
- {
- String message = "In: " + pom + "\n\n";
- for ( ModelProblem problem : ( (ModelBuildingException) cause ).getProblems() )
- {
- message += problem + "\n";
- }
- System.out.println( message );
- }
-
- throw e;
- }
- }
-
- protected MavenProject getProject( File pom )
- throws Exception
- {
- ProjectBuildingRequest configuration = newBuildingRequest();
-
- return projectBuilder.build( pom, configuration ).getProject();
- }
-
- protected ProjectBuildingRequest newBuildingRequest()
- throws Exception
- {
- ProjectBuildingRequest configuration = new DefaultProjectBuildingRequest();
- configuration.setLocalRepository( getLocalRepository() );
- initRepoSession( configuration );
- return configuration;
- }
-
- protected void initRepoSession( ProjectBuildingRequest request )
- {
- File localRepo = new File( request.getLocalRepository().getBasedir() );
- DefaultRepositorySystemSession repoSession = MavenRepositorySystemUtils.newSession();
- repoSession.setLocalRepositoryManager( new LegacyLocalRepositoryManager( localRepo ) );
- request.setRepositorySession( repoSession );
- }
-
-}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/DefaultMavenProjectBuilderTest.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/DefaultMavenProjectBuilderTest.java
deleted file mode 100644
index 13c32abb..00000000
--- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/DefaultMavenProjectBuilderTest.java
+++ /dev/null
@@ -1,193 +0,0 @@
-package org.apache.maven.project;
-
-/*
- * 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.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
-import org.codehaus.plexus.util.FileUtils;
-
-public class DefaultMavenProjectBuilderTest
- extends AbstractMavenProjectTestCase
-{
-
- private List<File> filesToDelete = new ArrayList<File>();
-
- private File localRepoDir;
-
- @Override
- public void setUp()
- throws Exception
- {
- super.setUp();
-
- projectBuilder = lookup( ProjectBuilder.class );
-
- localRepoDir = new File( System.getProperty( "java.io.tmpdir" ), "local-repo." + System.currentTimeMillis() );
- localRepoDir.mkdirs();
-
- filesToDelete.add( localRepoDir );
- }
-
- @Override
- public void tearDown()
- throws Exception
- {
- super.tearDown();
-
- if ( !filesToDelete.isEmpty() )
- {
- for ( File file : filesToDelete )
- {
- if ( file.exists() )
- {
- if ( file.isDirectory() )
- {
- FileUtils.deleteDirectory( file );
- }
- else
- {
- file.delete();
- }
- }
- }
- }
- }
-
- protected MavenProject getProject( Artifact pom, boolean allowStub )
- throws Exception
- {
- ProjectBuildingRequest configuration = new DefaultProjectBuildingRequest();
- configuration.setLocalRepository( getLocalRepository() );
- initRepoSession( configuration );
-
- return projectBuilder.build( pom, allowStub, configuration ).getProject();
- }
-
- /**
- * Check that we can build ok from the middle pom of a (parent,child,grandchild) heirarchy
- * @throws Exception
- */
- public void testBuildFromMiddlePom() throws Exception
- {
- File f1 = getTestFile( "src/test/resources/projects/grandchild-check/child/pom.xml");
- File f2 = getTestFile( "src/test/resources/projects/grandchild-check/child/grandchild/pom.xml");
-
- getProject( f1 );
-
- // it's the building of the grandchild project, having already cached the child project
- // (but not the parent project), which causes the problem.
- getProject( f2 );
- }
-
- public void testDuplicatePluginDefinitionsMerged()
- throws Exception
- {
- File f1 = getTestFile( "src/test/resources/projects/duplicate-plugins-merged-pom.xml" );
-
- MavenProject project = getProject( f1 );
- assertEquals( 2, project.getBuildPlugins().get( 0 ).getDependencies().size() );
- assertEquals( 2, project.getBuildPlugins().get( 0 ).getExecutions().size() );
- assertEquals( "first", project.getBuildPlugins().get( 0 ).getExecutions().get( 0 ).getId() );
- }
-
- public void testBuildStubModelForMissingRemotePom()
- throws Exception
- {
- Artifact pom = repositorySystem.createProjectArtifact( "org.apache.maven.its", "missing", "0.1" );
- MavenProject project = getProject( pom, true );
-
- assertNotNull( project.getArtifactId() );
-
- assertNotNull( project.getRemoteArtifactRepositories() );
- assertFalse( project.getRemoteArtifactRepositories().isEmpty() );
-
- assertNotNull( project.getPluginArtifactRepositories() );
- assertFalse( project.getPluginArtifactRepositories().isEmpty() );
-
- assertNull( project.getParent() );
- assertNull( project.getParentArtifact() );
-
- assertFalse( project.isExecutionRoot() );
- }
-
- @Override
- protected ArtifactRepository getLocalRepository()
- throws Exception
- {
- ArtifactRepositoryLayout repoLayout = lookup( ArtifactRepositoryLayout.class, "default" );
- ArtifactRepository r =
- repositorySystem.createArtifactRepository( "local", "file://" + localRepoDir.getAbsolutePath(), repoLayout,
- null, null );
- return r;
- }
-
- public void xtestLoop()
- throws Exception
- {
- while ( true )
- {
- File f1 = getTestFile( "src/test/resources/projects/duplicate-plugins-merged-pom.xml" );
- getProject( f1 );
- }
- }
-
- public void testPartialResultUponBadDependencyDeclaration()
- throws Exception
- {
- File pomFile = getTestFile( "src/test/resources/projects/bad-dependency.xml" );
-
- try
- {
- ProjectBuildingRequest request = newBuildingRequest();
- request.setProcessPlugins( false );
- request.setResolveDependencies( true );
- projectBuilder.build( pomFile, request );
- fail( "Project building did not fail despite invalid POM" );
- }
- catch ( ProjectBuildingException e )
- {
- List<ProjectBuildingResult> results = e.getResults();
- assertNotNull( results );
- assertEquals( 1, results.size() );
- ProjectBuildingResult result = results.get( 0 );
- assertNotNull( result );
- assertNotNull( result.getProject() );
- assertEquals( 1, result.getProblems().size() );
- assertEquals( 1, result.getProject().getArtifacts().size() );
- assertNotNull( result.getDependencyResolutionResult() );
- }
- }
-
- public void testImportScopePomResolvesFromPropertyBasedRepository()
- throws Exception
- {
- File pomFile = getTestFile( "src/test/resources/projects/import-scope-pom-resolves-from-property-based-repository.xml" );
- ProjectBuildingRequest request = newBuildingRequest();
- request.setProcessPlugins( false );
- request.setResolveDependencies( true );
- projectBuilder.build( pomFile, request );
- }
-}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/EmptyLifecycleExecutor.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/EmptyLifecycleExecutor.java
deleted file mode 100644
index 8ff912fb..00000000
--- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/EmptyLifecycleExecutor.java
+++ /dev/null
@@ -1,109 +0,0 @@
-package org.apache.maven.project;
-
-/*
- * 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.Collections;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.maven.execution.MavenSession;
-import org.apache.maven.lifecycle.LifecycleExecutor;
-import org.apache.maven.lifecycle.MavenExecutionPlan;
-import org.apache.maven.model.Plugin;
-import org.apache.maven.model.PluginExecution;
-import org.apache.maven.plugin.MojoExecution;
-
-/**
- * A stub implementation that assumes an empty lifecycle to bypass interaction with the plugin manager and to avoid
- * plugin artifact resolution from repositories.
- *
- * @author Benjamin Bentmann
- */
-public class EmptyLifecycleExecutor
- implements LifecycleExecutor
-{
-
- public MavenExecutionPlan calculateExecutionPlan( MavenSession session, String... tasks )
- {
- return new MavenExecutionPlan( null, null );
- }
-
- public MavenExecutionPlan calculateExecutionPlan( MavenSession session, boolean setup, String... tasks )
- {
- return new MavenExecutionPlan( null, null );
- }
-
- public void execute( MavenSession session )
- {
- }
-
- public Set<Plugin> getPluginsBoundByDefaultToAllLifecycles( String packaging )
- {
- Set<Plugin> plugins;
-
- // NOTE: The upper-case packaging name is intentional, that's a special hinting mode used for certain tests
- if ( "JAR".equals( packaging ) )
- {
- plugins = new LinkedHashSet<Plugin>();
-
- plugins.add( newPlugin( "maven-compiler-plugin", "compile", "testCompile" ) );
- plugins.add( newPlugin( "maven-resources-plugin", "resources", "testResources" ) );
- plugins.add( newPlugin( "maven-surefire-plugin", "test" ) );
- plugins.add( newPlugin( "maven-jar-plugin", "jar" ) );
- plugins.add( newPlugin( "maven-install-plugin", "install" ) );
- plugins.add( newPlugin( "maven-deploy-plugin", "deploy" ) );
- }
- else
- {
- plugins = Collections.emptySet();
- }
-
- return plugins;
- }
-
- private Plugin newPlugin( String artifactId, String... goals )
- {
- Plugin plugin = new Plugin();
-
- plugin.setGroupId( "org.apache.maven.plugins" );
- plugin.setArtifactId( artifactId );
-
- for ( String goal : goals )
- {
- PluginExecution pluginExecution = new PluginExecution();
- pluginExecution.setId( "default-" + goal );
- pluginExecution.addGoal( goal );
- plugin.addExecution( pluginExecution );
- }
-
- return plugin;
- }
-
- public void calculateForkedExecutions( MojoExecution mojoExecution, MavenSession session )
- {
- }
-
- public List<MavenProject> executeForkedExecutions( MojoExecution mojoExecution, MavenSession session )
- {
- return Collections.emptyList();
- }
-
-}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/EmptyProjectBuildingHelper.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/EmptyProjectBuildingHelper.java
deleted file mode 100644
index 21e37f1f..00000000
--- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/EmptyProjectBuildingHelper.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package org.apache.maven.project;
-
-/*
- * 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.List;
-
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.model.Model;
-import org.apache.maven.model.Repository;
-
-/**
- * A stub implementation to bypass artifact resolution from repositories.
- *
- * @author Benjamin Bentmann
- */
-public class EmptyProjectBuildingHelper
- implements ProjectBuildingHelper
-{
-
- public List<ArtifactRepository> createArtifactRepositories( List<Repository> pomRepositories,
- List<ArtifactRepository> externalRepositories,
- ProjectBuildingRequest request )
- {
- if ( externalRepositories != null )
- {
- return externalRepositories;
- }
- else
- {
- return new ArrayList<ArtifactRepository>();
- }
- }
-
- public ProjectRealmCache.CacheRecord createProjectRealm( MavenProject proejct,
- Model model, ProjectBuildingRequest request )
- {
- return new ProjectRealmCache.CacheRecord( null, null );
- }
-
- public void selectProjectRealm( MavenProject project )
- {
- }
-
-}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/ExtensionDescriptorBuilderTest.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/ExtensionDescriptorBuilderTest.java
deleted file mode 100644
index 68727013..00000000
--- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/ExtensionDescriptorBuilderTest.java
+++ /dev/null
@@ -1,101 +0,0 @@
-package org.apache.maven.project;
-
-/*
- * 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.ByteArrayInputStream;
-import java.io.InputStream;
-import java.io.UnsupportedEncodingException;
-import java.util.Arrays;
-
-import junit.framework.TestCase;
-
-/**
- * Tests {@link ExtensionDescriptorBuilder}.
- *
- * @author Benjamin Bentmann
- */
-public class ExtensionDescriptorBuilderTest
- extends TestCase
-{
-
- private ExtensionDescriptorBuilder builder;
-
- @Override
- protected void setUp()
- throws Exception
- {
- super.setUp();
-
- builder = new ExtensionDescriptorBuilder();
- }
-
- @Override
- protected void tearDown()
- throws Exception
- {
- builder = null;
-
- super.tearDown();
- }
-
- private InputStream toStream( String xml )
- {
- try
- {
- return new ByteArrayInputStream( xml.getBytes( "UTF-8" ) );
- }
- catch ( UnsupportedEncodingException e )
- {
- throw new IllegalStateException( e );
- }
- }
-
- public void testEmptyDescriptor()
- throws Exception
- {
- String xml = "<extension></extension>";
-
- ExtensionDescriptor ed = builder.build( toStream( xml ) );
-
- assertNotNull( ed );
- assertNotNull( ed.getExportedPackages() );
- assertTrue( ed.getExportedPackages().isEmpty() );
- assertNotNull( ed.getExportedArtifacts() );
- assertTrue( ed.getExportedArtifacts().isEmpty() );
- }
-
- public void testCompleteDescriptor()
- throws Exception
- {
- String xml =
- "<?xml version='1.0' encoding='UTF-8'?>" + "<extension>" + "<exportedPackages>"
- + "<exportedPackage>a</exportedPackage>" + "<exportedPackage>b</exportedPackage>"
- + "<exportedPackage>c</exportedPackage>" + "</exportedPackages>" + "<exportedArtifacts>"
- + "<exportedArtifact>x</exportedArtifact>" + "<exportedArtifact>y</exportedArtifact>"
- + "<exportedArtifact> z </exportedArtifact>" + "</exportedArtifacts>" + "</extension>";
-
- ExtensionDescriptor ed = builder.build( toStream( xml ) );
-
- assertNotNull( ed );
- assertEquals( Arrays.asList( "a", "b", "c" ), ed.getExportedPackages() );
- assertEquals( Arrays.asList( "x", "y", "z" ), ed.getExportedArtifacts() );
- }
-
-}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/LegacyLocalRepositoryManager.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/LegacyLocalRepositoryManager.java
deleted file mode 100644
index 52fdd804..00000000
--- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/LegacyLocalRepositoryManager.java
+++ /dev/null
@@ -1,192 +0,0 @@
-package org.apache.maven.project;
-
-/*
- * 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.eclipse.aether.RepositorySystemSession;
-import org.eclipse.aether.artifact.Artifact;
-import org.eclipse.aether.metadata.Metadata;
-import org.eclipse.aether.repository.LocalArtifactRegistration;
-import org.eclipse.aether.repository.LocalArtifactRequest;
-import org.eclipse.aether.repository.LocalArtifactResult;
-import org.eclipse.aether.repository.LocalMetadataRegistration;
-import org.eclipse.aether.repository.LocalMetadataRequest;
-import org.eclipse.aether.repository.LocalMetadataResult;
-import org.eclipse.aether.repository.LocalRepository;
-import org.eclipse.aether.repository.LocalRepositoryManager;
-import org.eclipse.aether.repository.RemoteRepository;
-
-/**
- * @author Benjamin Bentmann
- */
-public class LegacyLocalRepositoryManager
- implements LocalRepositoryManager
-{
-
- private final LocalRepository repository;
-
- public LegacyLocalRepositoryManager( File basedir )
- {
- this.repository = new LocalRepository( basedir.getAbsoluteFile(), "legacy" );
- }
-
- public LocalRepository getRepository()
- {
- return repository;
- }
-
- public String getPathForLocalArtifact( Artifact artifact )
- {
- StringBuilder path = new StringBuilder( 128 );
-
- path.append( artifact.getGroupId() ).append( '/' );
-
- path.append( artifact.getExtension() ).append( 's' ).append( '/' );
-
- path.append( artifact.getArtifactId() ).append( '-' ).append( artifact.getVersion() );
-
- if ( artifact.getClassifier().length() > 0 )
- {
- path.append( '-' ).append( artifact.getClassifier() );
- }
-
- path.append( '.' ).append( artifact.getExtension() );
-
- return path.toString();
- }
-
- public String getPathForRemoteArtifact( Artifact artifact, RemoteRepository repository, String context )
- {
- return getPathForLocalArtifact( artifact );
- }
-
- public String getPathForLocalMetadata( Metadata metadata )
- {
- return getPath( metadata, "local" );
- }
-
- public String getPathForRemoteMetadata( Metadata metadata, RemoteRepository repository, String context )
- {
- return getPath( metadata, getRepositoryKey( repository, context ) );
- }
-
- String getRepositoryKey( RemoteRepository repository, String context )
- {
- return repository.getId();
- }
-
- private String getPath( Metadata metadata, String repositoryKey )
- {
- StringBuilder path = new StringBuilder( 128 );
-
- if ( metadata.getGroupId().length() > 0 )
- {
- path.append( metadata.getGroupId().replace( '.', '/' ) ).append( '/' );
-
- if ( metadata.getArtifactId().length() > 0 )
- {
- path.append( metadata.getArtifactId() ).append( '/' );
-
- if ( metadata.getVersion().length() > 0 )
- {
- path.append( metadata.getVersion() ).append( '/' );
- }
- }
- }
-
- path.append( insertRepositoryKey( metadata.getType(), repositoryKey ) );
-
- return path.toString();
- }
-
- private String insertRepositoryKey( String filename, String repositoryKey )
- {
- String result;
- int idx = filename.indexOf( '.' );
- if ( idx < 0 )
- {
- result = filename + '-' + repositoryKey;
- }
- else
- {
- result = filename.substring( 0, idx ) + '-' + repositoryKey + filename.substring( idx );
- }
- return result;
- }
-
- public LocalArtifactResult find( RepositorySystemSession session, LocalArtifactRequest request )
- {
- String path = getPathForLocalArtifact( request.getArtifact() );
- File file = new File( getRepository().getBasedir(), path );
-
- LocalArtifactResult result = new LocalArtifactResult( request );
- if ( file.isFile() )
- {
- result.setFile( file );
- result.setAvailable( true );
- }
-
- return result;
- }
-
- public void add( RepositorySystemSession session, LocalArtifactRegistration request )
- {
- // noop
- }
-
- public LocalMetadataResult find( RepositorySystemSession session, LocalMetadataRequest request )
- {
- LocalMetadataResult result = new LocalMetadataResult( request );
-
- String path;
-
- Metadata metadata = request.getMetadata();
- String context = request.getContext();
- RemoteRepository remote = request.getRepository();
-
- if ( remote != null )
- {
- path = getPathForRemoteMetadata( metadata, remote, context );
- }
- else
- {
- path = getPathForLocalMetadata( metadata );
- }
-
- File file = new File( getRepository().getBasedir(), path );
- if ( file.isFile() )
- {
- result.setFile( file );
- }
-
- return result;
- }
-
- public void add( RepositorySystemSession session, LocalMetadataRegistration request )
- {
- // noop
- }
-
- public String toString()
- {
- return String.valueOf( getRepository() );
- }
-}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/MavenProjectTest.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/MavenProjectTest.java
deleted file mode 100644
index 0c5cd07d..00000000
--- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/MavenProjectTest.java
+++ /dev/null
@@ -1,197 +0,0 @@
-package org.apache.maven.project;
-
-/*
- * 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.io.IOException;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import org.apache.maven.lifecycle.internal.stub.LoggerStub;
-import org.apache.maven.model.DependencyManagement;
-import org.apache.maven.model.Model;
-import org.apache.maven.model.Parent;
-import org.apache.maven.model.Profile;
-
-public class MavenProjectTest
- extends AbstractMavenProjectTestCase
-{
-
- public void testShouldInterpretChildPathAdjustmentBasedOnModulePaths()
- throws IOException
- {
- Model parentModel = new Model();
- parentModel.addModule( "../child" );
-
- MavenProject parentProject = new MavenProject( parentModel );
-
- Model childModel = new Model();
- childModel.setArtifactId( "artifact" );
-
- MavenProject childProject = new MavenProject( childModel );
-
- File childFile =
- new File( System.getProperty( "java.io.tmpdir" ), "maven-project-tests" + System.currentTimeMillis()
- + "/child/pom.xml" );
-
- childProject.setFile( childFile );
-
- String adjustment = parentProject.getModulePathAdjustment( childProject );
-
- assertNotNull( adjustment );
-
- assertEquals( "..", adjustment );
- }
-
- public void testIdentityProtoInheritance()
- {
- Parent parent = new Parent();
-
- parent.setGroupId( "test-group" );
- parent.setVersion( "1000" );
- parent.setArtifactId( "test-artifact" );
-
- Model model = new Model();
-
- model.setParent( parent );
- model.setArtifactId( "real-artifact" );
-
- MavenProject project = new MavenProject( model );
-
- assertEquals( "groupId proto-inheritance failed.", "test-group", project.getGroupId() );
- assertEquals( "artifactId is masked.", "real-artifact", project.getArtifactId() );
- assertEquals( "version proto-inheritance failed.", "1000", project.getVersion() );
-
- // draw the NPE.
- project.getId();
- }
-
- public void testEmptyConstructor()
- {
- MavenProject project = new MavenProject();
-
- assertEquals( MavenProject.EMPTY_PROJECT_GROUP_ID + ":" + MavenProject.EMPTY_PROJECT_ARTIFACT_ID + ":jar:"
- + MavenProject.EMPTY_PROJECT_VERSION, project.getId() );
- }
-
- public void testClone()
- throws Exception
- {
- File f = getFileForClasspathResource( "canonical-pom.xml" );
- MavenProject projectToClone = getProject( f );
-
- MavenProject clonedProject = projectToClone.clone();
- assertEquals( "maven-core", clonedProject.getArtifactId() );
- Map<?, ?> clonedMap = clonedProject.getManagedVersionMap();
- assertNotNull( "ManagedVersionMap not copied", clonedMap );
- assertTrue( "ManagedVersionMap is not empty", clonedMap.isEmpty() );
- }
-
- public void testCloneWithDependencyManagement()
- throws Exception
- {
- File f = getFileForClasspathResource( "dependencyManagement-pom.xml" );
- MavenProject projectToClone = getProjectWithDependencies( f );
- DependencyManagement dep = projectToClone.getDependencyManagement();
- assertNotNull( "No dependencyManagement", dep );
- List<?> list = dep.getDependencies();
- assertNotNull( "No dependencies", list );
- assertTrue( "Empty dependency list", !list.isEmpty() );
-
- Map<?, ?> map = projectToClone.getManagedVersionMap();
- assertNotNull( "No ManagedVersionMap", map );
- assertTrue( "ManagedVersionMap is empty", !map.isEmpty() );
-
- MavenProject clonedProject = projectToClone.clone();
- assertEquals( "maven-core", clonedProject.getArtifactId() );
- Map<?, ?> clonedMap = clonedProject.getManagedVersionMap();
- assertNotNull( "ManagedVersionMap not copied", clonedMap );
- assertTrue( "ManagedVersionMap is empty", !clonedMap.isEmpty() );
- assertTrue( "ManagedVersionMap does not contain test key",
- clonedMap.containsKey( "maven-test:maven-test-b:jar" ) );
- }
-
- public void testGetModulePathAdjustment()
- throws IOException
- {
- Model moduleModel = new Model();
-
- MavenProject module = new MavenProject( moduleModel );
- module.setFile( new File( "module-dir/pom.xml" ) );
-
- Model parentModel = new Model();
- parentModel.addModule( "../module-dir" );
-
- MavenProject parent = new MavenProject( parentModel );
- parent.setFile( new File( "parent-dir/pom.xml" ) );
-
- String pathAdjustment = parent.getModulePathAdjustment( module );
-
- assertEquals( "..", pathAdjustment );
- }
-
- public void testCloneWithDistributionManagement()
- throws Exception
- {
-
- File f = getFileForClasspathResource( "distributionManagement-pom.xml" );
- MavenProject projectToClone = getProject( f );
-
- MavenProject clonedProject = projectToClone.clone();
- assertNotNull( "clonedProject - distributionManagement", clonedProject.getDistributionManagementArtifactRepository() );
- }
-
- public void testCloneWithActiveProfile()
- throws Exception
- {
-
- File f = getFileForClasspathResource( "withActiveByDefaultProfile-pom.xml" );
- MavenProject projectToClone = getProject( f );
- List<Profile> activeProfilesOrig = projectToClone.getActiveProfiles();
-
- assertEquals( "Expecting 1 active profile", 1, activeProfilesOrig.size() );
-
- MavenProject clonedProject = projectToClone.clone();
-
- List<Profile> activeProfilesClone = clonedProject.getActiveProfiles();
-
- assertEquals( "Expecting 1 active profile", 1, activeProfilesClone.size() );
-
- assertNotSame( "The list of active profiles should have been cloned too but is same", activeProfilesOrig,
- activeProfilesClone );
- }
-
- public void testUndefinedOutputDirectory()
- throws Exception
- {
- MavenProject p = new MavenProject();
- assertNoNulls( p.getCompileClasspathElements() );
- assertNoNulls( p.getSystemClasspathElements() );
- assertNoNulls( p.getRuntimeClasspathElements() );
- assertNoNulls( p.getTestClasspathElements() );
- }
-
- private void assertNoNulls( List<String> elements )
- {
- assertFalse( elements.contains( null ) );
- }
-
-}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/PomConstructionTest.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/PomConstructionTest.java
deleted file mode 100644
index f17539b1..00000000
--- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/PomConstructionTest.java
+++ /dev/null
@@ -1,1878 +0,0 @@
-package org.apache.maven.project;
-
-/*
- * 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.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
-import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
-import org.apache.maven.model.Plugin;
-import org.apache.maven.model.PluginExecution;
-import org.apache.maven.model.building.ModelBuildingRequest;
-import org.apache.maven.project.harness.PomTestWrapper;
-import org.apache.maven.repository.RepositorySystem;
-import org.apache.maven.repository.internal.MavenRepositorySystemUtils;
-import org.codehaus.plexus.ContainerConfiguration;
-import org.codehaus.plexus.PlexusConstants;
-import org.codehaus.plexus.PlexusTestCase;
-import org.eclipse.aether.DefaultRepositorySystemSession;
-import org.eclipse.aether.internal.impl.SimpleLocalRepositoryManagerFactory;
-import org.eclipse.aether.repository.LocalRepository;
-
-public class PomConstructionTest
- extends PlexusTestCase
-{
- private static String BASE_DIR = "src/test";
-
- private static String BASE_POM_DIR = BASE_DIR + "/resources-project-builder";
-
- private static String BASE_MIXIN_DIR = BASE_DIR + "/resources-mixins";
-
- private DefaultProjectBuilder projectBuilder;
-
- private RepositorySystem repositorySystem;
-
- private File testDirectory;
-
- @Override
- protected void customizeContainerConfiguration( ContainerConfiguration containerConfiguration )
- {
- super.customizeContainerConfiguration( containerConfiguration );
- containerConfiguration.setAutoWiring( true );
- containerConfiguration.setClassPathScanning( PlexusConstants.SCANNING_INDEX );
- }
-
- protected void setUp()
- throws Exception
- {
- testDirectory = new File( getBasedir(), BASE_POM_DIR );
- new File( getBasedir(), BASE_MIXIN_DIR );
- projectBuilder = (DefaultProjectBuilder) lookup( ProjectBuilder.class );
- repositorySystem = lookup( RepositorySystem.class );
- }
-
- @Override
- protected void tearDown()
- throws Exception
- {
- projectBuilder = null;
-
- super.tearDown();
- }
-
- /**
- * Will throw exception if url is empty. MNG-4050
- *
- * @throws Exception
- */
-
- public void testEmptyUrl()
- throws Exception
- {
- buildPom( "empty-distMng-repo-url" );
- }
-
- /**
- * Tests that modules is not overriden by profile
- *
- * @throws Exception
- */
- /* MNG-786*/
- public void testProfileModules()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "profile-module", "a" );
- assertEquals( "test-prop", pom.getValue( "properties[1]/b" ) );// verifies profile applied
- assertEquals( 4, ( (List<?>) pom.getValue( "modules" ) ).size() );
- assertEquals( "module-2", pom.getValue( "modules[1]" ) );
- assertEquals( "module-1", pom.getValue( "modules[2]" ) );
- assertEquals( "module-3", pom.getValue( "modules[3]" ) );
- assertEquals( "module-4", pom.getValue( "modules[4]" ) );
- }
-
- /**
- * Will throw exception if doesn't find parent(s) in build
- *
- * @throws Exception
- */
- public void testParentInheritance()
- throws Exception
- {
- buildPom( "parent-inheritance/sub" );
- }
-
- /*MNG-3995*/
- public void testExecutionConfigurationJoin()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "execution-configuration-join" );
- assertEquals( 2, ( (List<?>) pom.getValue( "build/plugins[1]/executions[1]/configuration[1]/fileset[1]" ) ).size() );
- }
-
- /*MNG-3803*/
- public void testPluginConfigProperties()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "plugin-config-properties" );
- assertEquals( "my.property", pom.getValue( "build/plugins[1]/configuration[1]/systemProperties[1]/property[1]/name" ) );
- }
-
- /*MNG-3900*/
- public void testProfilePropertiesInterpolation()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "profile-properties-interpolation", "interpolation-profile" );
- assertEquals( "PASSED", pom.getValue( "properties[1]/test" ) );
- assertEquals( "PASSED", pom.getValue( "properties[1]/property" ) );
- }
-
-
- // Some better conventions for the test poms needs to be created and each of these tests
- // that represent a verification of a specification item needs to be a couple lines at most.
- // The expressions help a lot, but we need a clean to pick up a directory of POMs, automatically load
- // them into a resolver, create the expression to extract the data to validate the Model, and the URI
- // to validate the properties. We also need a way to navigate from the Tex specification documents to
- // the test in question and vice versa. A little Eclipse plugin would do the trick.
- public void testThatExecutionsWithoutIdsAreMergedAndTheChildWins()
- throws Exception
- {
- PomTestWrapper tester = buildPom( "micromailer" );
- assertModelEquals( tester, "child-descriptor", "build/plugins[1]/executions[1]/goals[1]" );
- }
-
- /*MNG-
- public void testDependencyScope()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "dependency-scope/sub" );
-
- }
-
- /*MNG- 4010*/
- public void testDuplicateExclusionsDependency()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "duplicate-exclusions-dependency/sub" );
- assertEquals( 1, ( (List<?>) pom.getValue( "dependencies[1]/exclusions" ) ).size() );
-
- }
-
- /*MNG- 4008*/
- public void testMultipleFilters()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "multiple-filters" );
- assertEquals( 4, ( (List<?>) pom.getValue( "build/filters" ) ).size() );
-
- }
-
- /** MNG-4005: postponed to 3.1
- public void testValidationErrorUponNonUniqueDependencyKey()
- throws Exception
- {
- try
- {
- buildPom( "unique-dependency-key/deps" );
- fail( "Non-unique dependency keys did not cause validation error" );
- }
- catch ( ProjectBuildingException e )
- {
- // expected
- }
- }
-
- public void testValidationErrorUponNonUniqueDependencyManagementKey()
- throws Exception
- {
- try
- {
- buildPom( "unique-dependency-key/dep-mngt" );
- fail( "Non-unique dependency keys did not cause validation error" );
- }
- catch ( ProjectBuildingException e )
- {
- // expected
- }
- }
-
- public void testValidationErrorUponNonUniqueDependencyKeyInProfile()
- throws Exception
- {
- try
- {
- buildPom( "unique-dependency-key/deps-in-profile" );
- fail( "Non-unique dependency keys did not cause validation error" );
- }
- catch ( ProjectBuildingException e )
- {
- // expected
- }
- }
-
- public void testValidationErrorUponNonUniqueDependencyManagementKeyInProfile()
- throws Exception
- {
- try
- {
- buildPom( "unique-dependency-key/dep-mngt-in-profile" );
- fail( "Non-unique dependency keys did not cause validation error" );
- }
- catch ( ProjectBuildingException e )
- {
- // expected
- }
- }
- */
-
- public void testDuplicateDependenciesCauseLastDeclarationToBePickedInLenientMode()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "unique-dependency-key/deps", true, null );
- assertEquals( 1, ( (List<?>) pom.getValue( "dependencies" ) ).size() );
- assertEquals( "0.2", pom.getValue( "dependencies[1]/version" ) );
- }
-
- /* MNG-3567*/
- public void testParentInterpolation()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "parent-interpolation/sub" );
- pom = new PomTestWrapper( pom.getMavenProject().getParent() );
- assertEquals( "1.3.0-SNAPSHOT", pom.getValue( "build/plugins[1]/version" ) );
- }
-
-/*
- public void testMaven()
- throws Exception
- {
- PomTestWrapper pom = buildPomFromMavenProject( "maven-build/sub/pom.xml", null );
-
- for( String s: pom.getMavenProject().getTestClasspathElements() )
- {
- System.out.println( s );
- }
-
- }
- */
-
- /* MNG-3567*/
- public void testPluginManagementInherited()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "pluginmanagement-inherited/sub" );
- assertEquals( "1.0-alpha-21", pom.getValue( "build/plugins[1]/version" ) );
- }
-
- /* MNG-2174*/
- public void testPluginManagementDependencies()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "plugin-management-dependencies/sub", "test" );
- assertEquals( "1.0-alpha-21", pom.getValue( "build/plugins[1]/version" ) );
- assertEquals( "1.0", pom.getValue( "build/plugins[1]/dependencies[1]/version" ) );
- }
-
-
- /* MNG-3877*/
- public void testReportingInterpolation()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "reporting-interpolation" );
- assertEquals( createPath( Arrays.asList( System.getProperty( "user.dir" ), "src", "test",
- "resources-project-builder", "reporting-interpolation", "target",
- "site" ) ), pom.getValue( "reporting/outputDirectory" ) );
- }
-
-
- public void testPluginOrder()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "plugin-order" );
- assertEquals( "plexus-component-metadata", pom.getValue( "build/plugins[1]/artifactId" ) );
- assertEquals( "maven-surefire-plugin", pom.getValue( "build/plugins[2]/artifactId" ) );
- }
-
- public void testErroneousJoiningOfDifferentPluginsWithEqualDependencies()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "equal-plugin-deps" );
- assertEquals( "maven-it-plugin-a", pom.getValue( "build/plugins[1]/artifactId" ) );
- assertEquals( 1, ( (List<?>) pom.getValue( "build/plugins[1]/dependencies" ) ).size() );
- assertEquals( "maven-it-plugin-b", pom.getValue( "build/plugins[2]/artifactId" ) );
- assertEquals( 1, ( (List<?>) pom.getValue( "build/plugins[1]/dependencies" ) ).size() );
- }
-
- /** MNG-3821 */
- public void testErroneousJoiningOfDifferentPluginsWithEqualExecutionIds()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "equal-plugin-exec-ids" );
- assertEquals( "maven-it-plugin-a", pom.getValue( "build/plugins[1]/artifactId" ) );
- assertEquals( 1, ( (List<?>) pom.getValue( "build/plugins[1]/executions" ) ).size() );
- assertEquals( "maven-it-plugin-b", pom.getValue( "build/plugins[2]/artifactId" ) );
- assertEquals( 1, ( (List<?>) pom.getValue( "build/plugins[1]/executions" ) ).size() );
- assertEquals( "maven-it-plugin-a", pom.getValue( "reporting/plugins[1]/artifactId" ) );
- assertEquals( 1, ( (List<?>) pom.getValue( "reporting/plugins[1]/reportSets" ) ).size() );
- assertEquals( "maven-it-plugin-b", pom.getValue( "reporting/plugins[2]/artifactId" ) );
- assertEquals( 1, ( (List<?>) pom.getValue( "reporting/plugins[1]/reportSets" ) ).size() );
- }
-
- /** MNG-3998 */
- public void testExecutionConfiguration()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "execution-configuration" );
- assertEquals( 2, ( (List<?>) pom.getValue( "build/plugins[1]/executions" ) ).size() );
- assertEquals( "src/main/mdo/nexus.xml",
- ( pom.getValue( "build/plugins[1]/executions[1]/configuration[1]/model" ) ) );
- assertEquals( "src/main/mdo/security.xml",
- ( pom.getValue( "build/plugins[1]/executions[2]/configuration[1]/model" ) ) );
- }
-
- /*
- public void testPluginConfigDuplicate()
- throws Exception
-{
- PomTestWrapper pom = buildPom( "plugin-config-duplicate/dup" );
-}
-*/
-
-
- public void testSingleConfigurationInheritance()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "single-configuration-inheritance" );
-
- assertEquals( 2, ( (List<?>) pom.getValue( "build/plugins[1]/executions[1]/configuration[1]/rules" ) ).size() );
- assertEquals( "2.0.6",
- pom.getValue( "build/plugins[1]/executions[1]/configuration[1]/rules[1]/requireMavenVersion[1]/version" ) );
- assertEquals( "[1.4,)",
- pom.getValue( "build/plugins[1]/executions[1]/configuration[1]/rules[1]/requireJavaVersion[1]/version" ) );
- }
-
- public void testConfigWithPluginManagement()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "config-with-plugin-mng" );
- assertEquals( 2, ( (List<?>) pom.getValue( "build/plugins[1]/executions" ) ).size() );
- assertEquals( "src/main/mdo/security.xml", pom.getValue( "build/plugins[1]/executions[2]/configuration[1]/model" ) );
- assertEquals( "1.0.8", pom.getValue( "build/plugins[1]/executions[1]/configuration[1]/version" ) );
- }
-
- /** MNG-3965 */
- public void testExecutionConfigurationSubcollections()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "execution-configuration-subcollections" );
- assertEquals( 2, ( (List<?>) pom.getValue( "build/plugins[1]/executions[1]/configuration[1]/rules[1]/bannedDependencies" ) ).size() );
- }
-
- /** MNG-3985 */
- public void testMultipleRepositories()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "multiple-repos/sub" );
- assertEquals( 3, ( (List<?>) pom.getValue( "repositories" ) ).size() );
- }
-
- /** MNG-3965 */
- public void testMultipleExecutionIds()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "dual-execution-ids/sub" );
- assertEquals( 1, ( (List<?>) pom.getValue( "build/plugins[1]/executions" ) ).size() );
- }
-
- /** MNG-3997 */
- public void testConsecutiveEmptyElements()
- throws Exception
- {
- buildPom( "consecutive_empty_elements" );
- }
-
- public void testOrderOfGoalsFromPluginExecutionWithoutPluginManagement()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "plugin-exec-goals-order/wo-plugin-mngt" );
- assertEquals( 5, ( (List<?>) pom.getValue( "build/plugins[1]/executions[1]/goals" ) ).size() );
- assertEquals( "b", pom.getValue( "build/plugins[1]/executions[1]/goals[1]" ) );
- assertEquals( "a", pom.getValue( "build/plugins[1]/executions[1]/goals[2]" ) );
- assertEquals( "d", pom.getValue( "build/plugins[1]/executions[1]/goals[3]" ) );
- assertEquals( "c", pom.getValue( "build/plugins[1]/executions[1]/goals[4]" ) );
- assertEquals( "e", pom.getValue( "build/plugins[1]/executions[1]/goals[5]" ) );
- }
-
- /* MNG-3886*/
- public void testOrderOfGoalsFromPluginExecutionWithPluginManagement()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "plugin-exec-goals-order/w-plugin-mngt" );
- assertEquals( 5, ( (List<?>) pom.getValue( "build/plugins[1]/executions[1]/goals" ) ).size() );
- assertEquals( "b", pom.getValue( "build/plugins[1]/executions[1]/goals[1]" ) );
- assertEquals( "a", pom.getValue( "build/plugins[1]/executions[1]/goals[2]" ) );
- assertEquals( "d", pom.getValue( "build/plugins[1]/executions[1]/goals[3]" ) );
- assertEquals( "c", pom.getValue( "build/plugins[1]/executions[1]/goals[4]" ) );
- assertEquals( "e", pom.getValue( "build/plugins[1]/executions[1]/goals[5]" ) );
- }
-
- public void testOrderOfPluginExecutionsWithoutPluginManagement()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "plugin-exec-order/wo-plugin-mngt" );
- assertEquals( 5, ( (List<?>) pom.getValue( "build/plugins[1]/executions" ) ).size() );
- assertEquals( "b", pom.getValue( "build/plugins[1]/executions[1]/id" ) );
- assertEquals( "a", pom.getValue( "build/plugins[1]/executions[2]/id" ) );
- assertEquals( "d", pom.getValue( "build/plugins[1]/executions[3]/id" ) );
- assertEquals( "c", pom.getValue( "build/plugins[1]/executions[4]/id" ) );
- assertEquals( "e", pom.getValue( "build/plugins[1]/executions[5]/id" ) );
- }
-
- /* MNG-3887 */
- public void testOrderOfPluginExecutionsWithPluginManagement()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "plugin-exec-order/w-plugin-mngt" );
- assertEquals( 5, ( (List<?>) pom.getValue( "build/plugins[1]/executions" ) ).size() );
- assertEquals( "b", pom.getValue( "build/plugins[1]/executions[1]/id" ) );
- assertEquals( "a", pom.getValue( "build/plugins[1]/executions[2]/id" ) );
- assertEquals( "d", pom.getValue( "build/plugins[1]/executions[3]/id" ) );
- assertEquals( "c", pom.getValue( "build/plugins[1]/executions[4]/id" ) );
- assertEquals( "e", pom.getValue( "build/plugins[1]/executions[5]/id" ) );
- }
-
- public void testMergeOfPluginExecutionsWhenChildInheritsPluginVersion()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "plugin-exec-merging-wo-version/sub" );
- assertEquals( 4, ( (List<?>) pom.getValue( "build/plugins[1]/executions" ) ).size() );
- }
-
- /* MNG-3943*/
- public void testMergeOfPluginExecutionsWhenChildAndParentUseDifferentPluginVersions()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "plugin-exec-merging-version-insensitive/sub" );
- assertEquals( 4, ( (List<?>) pom.getValue( "build/plugins[1]/executions" ) ).size() );
- }
-
-
- public void testInterpolationWithXmlMarkup()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "xml-markup-interpolation" );
- assertEquals( "<?xml version='1.0'?>Tom&Jerry", pom.getValue( "properties/xmlTest" ) );
- }
-
- /* MNG-3925 */
- public void testOrderOfMergedPluginExecutionsWithoutPluginManagement()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "merged-plugin-exec-order/wo-plugin-mngt/sub" );
- assertEquals( 5, ( (List<?>) pom.getValue( "build/plugins[1]/executions" ) ).size() );
- assertEquals( "parent-1", pom.getValue( "build/plugins[1]/executions[1]/goals[1]" ) );
- assertEquals( "parent-2", pom.getValue( "build/plugins[1]/executions[2]/goals[1]" ) );
- assertEquals( "child-default", pom.getValue( "build/plugins[1]/executions[3]/goals[1]" ) );
- assertEquals( "child-1", pom.getValue( "build/plugins[1]/executions[4]/goals[1]" ) );
- assertEquals( "child-2", pom.getValue( "build/plugins[1]/executions[5]/goals[1]" ) );
- }
-
- public void testOrderOfMergedPluginExecutionsWithPluginManagement()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "merged-plugin-exec-order/w-plugin-mngt/sub" );
- assertEquals( 5, ( (List<?>) pom.getValue( "build/plugins[1]/executions" ) ).size() );
- assertEquals( "parent-1", pom.getValue( "build/plugins[1]/executions[1]/goals[1]" ) );
- assertEquals( "parent-2", pom.getValue( "build/plugins[1]/executions[2]/goals[1]" ) );
- assertEquals( "child-default", pom.getValue( "build/plugins[1]/executions[3]/goals[1]" ) );
- assertEquals( "child-1", pom.getValue( "build/plugins[1]/executions[4]/goals[1]" ) );
- assertEquals( "child-2", pom.getValue( "build/plugins[1]/executions[5]/goals[1]" ) );
- }
-
- /* MNG-3984*/
- public void testDifferentContainersWithSameId()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "join-different-containers-same-id" );
- assertEquals( 1, ( (List<?>) pom.getValue( "build/plugins[1]/executions[1]/goals" ) ).size() );
- assertEquals( 1, ( (List<?>) pom.getValue( "build/pluginManagement/plugins[@artifactId='maven-it-plugin-b']/executions[1]/goals" ) ).size() );
- }
-
- /* MNG-3937*/
- public void testOrderOfMergedPluginExecutionGoalsWithoutPluginManagement()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "merged-plugin-exec-goals-order/wo-plugin-mngt/sub" );
-
- assertEquals( 5, ( (List<?>) pom.getValue( "build/plugins[1]/executions[1]/goals" ) ).size() );
- assertEquals( "child-a", pom.getValue( "build/plugins[1]/executions[1]/goals[1]" ) );
- assertEquals( "merged", pom.getValue( "build/plugins[1]/executions[1]/goals[2]" ) );
- assertEquals( "child-b", pom.getValue( "build/plugins[1]/executions[1]/goals[3]" ) );
- assertEquals( "parent-b", pom.getValue( "build/plugins[1]/executions[1]/goals[4]" ) );
- assertEquals( "parent-a", pom.getValue( "build/plugins[1]/executions[1]/goals[5]" ) );
- }
-
- public void testOrderOfMergedPluginExecutionGoalsWithPluginManagement()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "merged-plugin-exec-goals-order/w-plugin-mngt/sub" );
- assertEquals( 5, ( (List<?>) pom.getValue( "build/plugins[1]/executions[1]/goals" ) ).size() );
- assertEquals( "child-a", pom.getValue( "build/plugins[1]/executions[1]/goals[1]" ) );
- assertEquals( "merged", pom.getValue( "build/plugins[1]/executions[1]/goals[2]" ) );
- assertEquals( "child-b", pom.getValue( "build/plugins[1]/executions[1]/goals[3]" ) );
- assertEquals( "parent-b", pom.getValue( "build/plugins[1]/executions[1]/goals[4]" ) );
- assertEquals( "parent-a", pom.getValue( "build/plugins[1]/executions[1]/goals[5]" ) );
- }
-
- /*MNG-3938*/
- public void testOverridingOfInheritedPluginExecutionsWithoutPluginManagement()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "plugin-exec-merging/wo-plugin-mngt/sub" );
- assertEquals( 2, ( (List<?>) pom.getValue( "build/plugins[1]/executions" ) ).size() );
- assertEquals( "child-default", pom.getValue( "build/plugins[1]/executions[@id='default']/phase" ) );
- assertEquals( "child-non-default", pom.getValue( "build/plugins[1]/executions[@id='non-default']/phase" ) );
- }
-
- /* MNG-3938 */
- public void testOverridingOfInheritedPluginExecutionsWithPluginManagement()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "plugin-exec-merging/w-plugin-mngt/sub" );
- assertEquals( 2, ( (List<?>) pom.getValue( "build/plugins[1]/executions" ) ).size() );
- assertEquals( "child-default", pom.getValue( "build/plugins[1]/executions[@id='default']/phase" ) );
- assertEquals( "child-non-default", pom.getValue( "build/plugins[1]/executions[@id='non-default']/phase" ) );
- }
-
-
- /* MNG-3906*/
- public void testOrderOfMergedPluginDependenciesWithoutPluginManagement()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "merged-plugin-class-path-order/wo-plugin-mngt/sub" );
-
- assertEquals( 5, ( (List<?>) pom.getValue( "build/plugins[1]/dependencies" ) ).size() );
- assertNotNull( pom.getValue( "build/plugins[1]/dependencies[1]" ) );
- assertEquals( "c", pom.getValue( "build/plugins[1]/dependencies[1]/artifactId" ) );
- assertEquals( "1", pom.getValue( "build/plugins[1]/dependencies[1]/version" ) );
- assertEquals( "a", pom.getValue( "build/plugins[1]/dependencies[2]/artifactId" ) );
- assertEquals( "2", pom.getValue( "build/plugins[1]/dependencies[2]/version" ) );
- assertEquals( "b", pom.getValue( "build/plugins[1]/dependencies[3]/artifactId" ) );
- assertEquals( "1", pom.getValue( "build/plugins[1]/dependencies[3]/version" ) );
- assertEquals( "e", pom.getValue( "build/plugins[1]/dependencies[4]/artifactId" ) );
- assertEquals( "1", pom.getValue( "build/plugins[1]/dependencies[4]/version" ) );
- assertEquals( "d", pom.getValue( "build/plugins[1]/dependencies[5]/artifactId" ) );
- assertEquals( "1", pom.getValue( "build/plugins[1]/dependencies[5]/version" ) );
- }
-
- public void testOrderOfMergedPluginDependenciesWithPluginManagement()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "merged-plugin-class-path-order/w-plugin-mngt/sub" );
- assertEquals( 5, ( (List<?>) pom.getValue( "build/plugins[1]/dependencies" ) ).size() );
- assertEquals( "c", pom.getValue( "build/plugins[1]/dependencies[1]/artifactId" ) );
- assertEquals( "1", pom.getValue( "build/plugins[1]/dependencies[1]/version" ) );
- assertEquals( "a", pom.getValue( "build/plugins[1]/dependencies[2]/artifactId" ) );
- assertEquals( "2", pom.getValue( "build/plugins[1]/dependencies[2]/version" ) );
- assertEquals( "b", pom.getValue( "build/plugins[1]/dependencies[3]/artifactId" ) );
- assertEquals( "1", pom.getValue( "build/plugins[1]/dependencies[3]/version" ) );
- assertEquals( "e", pom.getValue( "build/plugins[1]/dependencies[4]/artifactId" ) );
- assertEquals( "1", pom.getValue( "build/plugins[1]/dependencies[4]/version" ) );
- assertEquals( "d", pom.getValue( "build/plugins[1]/dependencies[5]/artifactId" ) );
- assertEquals( "1", pom.getValue( "build/plugins[1]/dependencies[5]/version" ) );
- }
-
- public void testInterpolationOfNestedBuildDirectories()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "nested-build-dir-interpolation" );
- assertEquals( new File( pom.getBasedir(), "target/classes/dir0" ),
- new File( (String) pom.getValue( "properties/dir0" ) ) );
- assertEquals( new File( pom.getBasedir(), "src/test/dir1" ),
- new File( (String) pom.getValue( "properties/dir1" ) ) );
- assertEquals( new File( pom.getBasedir(), "target/site/dir2" ),
- new File( (String) pom.getValue( "properties/dir2" ) ) );
- }
-
- public void testAppendArtifactIdOfChildToInheritedUrls()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "url-inheritance/sub" );
- assertEquals( "http://parent.url/child", pom.getValue( "url" ) );
- assertEquals( "http://parent.url/org", pom.getValue( "organization/url" ) );
- assertEquals( "http://parent.url/license.txt", pom.getValue( "licenses[1]/url" ) );
- assertEquals( "http://parent.url/viewvc/child", pom.getValue( "scm/url" ) );
- assertEquals( "http://parent.url/scm/child", pom.getValue( "scm/connection" ) );
- assertEquals( "https://parent.url/scm/child", pom.getValue( "scm/developerConnection" ) );
- assertEquals( "http://parent.url/issues", pom.getValue( "issueManagement/url" ) );
- assertEquals( "http://parent.url/ci", pom.getValue( "ciManagement/url" ) );
- assertEquals( "http://parent.url/dist", pom.getValue( "distributionManagement/repository/url" ) );
- assertEquals( "http://parent.url/snaps", pom.getValue( "distributionManagement/snapshotRepository/url" ) );
- assertEquals( "http://parent.url/site/child", pom.getValue( "distributionManagement/site/url" ) );
- assertEquals( "http://parent.url/download", pom.getValue( "distributionManagement/downloadUrl" ) );
- }
-
- /* MNG-3846*/
- public void testAppendArtifactIdOfParentAndChildToInheritedUrls()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "url-inheritance/another-parent/sub" );
- assertEquals( "http://parent.url/ap/child", pom.getValue( "url" ) );
- assertEquals( "http://parent.url/org", pom.getValue( "organization/url" ) );
- assertEquals( "http://parent.url/license.txt", pom.getValue( "licenses[1]/url" ) );
- assertEquals( "http://parent.url/viewvc/ap/child", pom.getValue( "scm/url" ) );
- assertEquals( "http://parent.url/scm/ap/child", pom.getValue( "scm/connection" ) );
- assertEquals( "https://parent.url/scm/ap/child", pom.getValue( "scm/developerConnection" ) );
- assertEquals( "http://parent.url/issues", pom.getValue( "issueManagement/url" ) );
- assertEquals( "http://parent.url/ci", pom.getValue( "ciManagement/url" ) );
- assertEquals( "http://parent.url/dist", pom.getValue( "distributionManagement/repository/url" ) );
- assertEquals( "http://parent.url/snaps", pom.getValue( "distributionManagement/snapshotRepository/url" ) );
- assertEquals( "http://parent.url/site/ap/child", pom.getValue( "distributionManagement/site/url" ) );
- assertEquals( "http://parent.url/download", pom.getValue( "distributionManagement/downloadUrl" ) );
- }
- //*/
-
- public void testNonInheritedElementsInSubtreesOverriddenByChild()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "limited-inheritance/child" );
- assertEquals( null, pom.getValue( "organization/url" ) );
- assertEquals( null, pom.getValue( "issueManagement/system" ) );
- assertEquals( 0, ( (List<?>) pom.getValue( "ciManagement/notifiers" ) ).size() );
- assertEquals( "child-distros", pom.getValue( "distributionManagement/repository/id" ) );
- assertEquals( "ssh://child.url/distros", pom.getValue( "distributionManagement/repository/url" ) );
- assertEquals( null, pom.getValue( "distributionManagement/repository/name" ) );
- assertEquals( true, pom.getValue( "distributionManagement/repository/uniqueVersion" ) );
- assertEquals( "default", pom.getValue( "distributionManagement/repository/layout" ) );
- assertEquals( "child-snaps", pom.getValue( "distributionManagement/snapshotRepository/id" ) );
- assertEquals( "ssh://child.url/snaps", pom.getValue( "distributionManagement/snapshotRepository/url" ) );
- assertEquals( null, pom.getValue( "distributionManagement/snapshotRepository/name" ) );
- assertEquals( true, pom.getValue( "distributionManagement/snapshotRepository/uniqueVersion" ) );
- assertEquals( "default", pom.getValue( "distributionManagement/snapshotRepository/layout" ) );
- assertEquals( "child-site", pom.getValue( "distributionManagement/site/id" ) );
- assertEquals( "scp://child.url/site", pom.getValue( "distributionManagement/site/url" ) );
- assertEquals( null, pom.getValue( "distributionManagement/site/name" ) );
- }
-
- public void testXmlTextCoalescing()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "xml-coalesce-text" );
- assertEquals( "A Test Project Property", pom.getValue( "properties/prop0" ) );
- assertEquals( "That's a test!", pom.getValue( "properties/prop1" ) );
- assertEquals( 32 * 1024,
- pom.getValue( "properties/prop2" ).toString().trim().replaceAll( "[\n\r]", "" ).length() );
- }
-
- public void testFullInterpolationOfNestedExpressions()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "full-interpolation" );
- for ( int i = 0; i < 24; i++ )
- {
- String index = ( ( i < 10 ) ? "0" : "" ) + i;
- assertEquals( "PASSED", pom.getValue( "properties/property" + index ) );
- }
- }
-
- public void testInterpolationOfLegacyExpressionsThatDontIncludeTheProjectPrefix()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "unprefixed-expression-interpolation/child" );
-
- assertEquals( pom.getBasedir(), new File( pom.getValue( "properties/projectDir" ).toString() ) );
-
- assertEquals( "org.apache.maven.its.mng3831.child", pom.getValue( "properties/projectGroupId" ) );
- assertEquals( "child", pom.getValue( "properties/projectArtifactId" ) );
- assertEquals( "2.0-alpha-1", pom.getValue( "properties/projectVersion" ) );
- assertEquals( "jar", pom.getValue( "properties/projectPackaging" ) );
-
- assertEquals( "child-name", pom.getValue( "properties/projectName" ) );
- assertEquals( "child-desc", pom.getValue( "properties/projectDesc" ) );
- assertEquals( "http://child.org/", pom.getValue( "properties/projectUrl" ) );
- assertEquals( "2008", pom.getValue( "properties/projectYear" ) );
- assertEquals( "child-org-name", pom.getValue( "properties/projectOrgName" ) );
-
- assertEquals( "2.0.0", pom.getValue( "properties/projectPrereqMvn" ) );
- assertEquals( "http://scm.org/", pom.getValue( "properties/projectScmUrl" ) );
- assertEquals( "http://issue.org/", pom.getValue( "properties/projectIssueUrl" ) );
- assertEquals( "http://ci.org/", pom.getValue( "properties/projectCiUrl" ) );
- assertEquals( "child-dist-repo", pom.getValue( "properties/projectDistRepoName" ) );
- assertEquals( "http://dist.org/", pom.getValue( "properties/projectDistRepoUrl" ) );
- assertEquals( "http://site.org/", pom.getValue( "properties/projectDistSiteUrl" ) );
-
- assertEquals( "org.apache.maven.its.mng3831", pom.getValue( "properties/parentGroupId" ) );
- assertEquals( "parent", pom.getValue( "properties/parentArtifactId" ) );
- assertEquals( "1.0", pom.getValue( "properties/parentVersion" ) );
-
- assertTrue( pom.getValue( "properties/projectBuildOut" ).toString().endsWith( "bin" ) );
- assertTrue( pom.getValue( "properties/projectSiteOut" ).toString().endsWith( "doc" ) );
- }
-
- public void testInterpolationWithBasedirAlignedDirectories()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "basedir-aligned-interpolation" );
- assertEquals( new File( pom.getBasedir(), "src/main/java" ),
- new File( pom.getValue( "properties/buildMainSrc" ).toString() ) );
- assertEquals( new File( pom.getBasedir(), "src/test/java" ),
- new File( pom.getValue( "properties/buildTestSrc" ).toString() ) );
- assertEquals( new File( pom.getBasedir(), "src/main/scripts" ),
- new File( pom.getValue( "properties/buildScriptSrc" ).toString() ) );
- assertEquals( new File( pom.getBasedir(), "target" ),
- new File( pom.getValue( "properties/buildOut" ).toString() ) );
- assertEquals( new File( pom.getBasedir(), "target/classes" ),
- new File( pom.getValue( "properties/buildMainOut" ).toString() ) );
- assertEquals( new File( pom.getBasedir(), "target/test-classes" ),
- new File( pom.getValue( "properties/buildTestOut" ).toString() ) );
- assertEquals( new File( pom.getBasedir(), "target/site" ),
- new File( pom.getValue( "properties/siteOut" ).toString() ) );
- }
-
- /* MNG-3944*/
- public void testInterpolationOfBasedirInPomWithUnusualName()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "basedir-interpolation/pom-with-unusual-name.xml" );
- assertEquals( pom.getBasedir(), new File( pom.getValue( "properties/prop0" ).toString() ) );
- assertEquals( pom.getBasedir(), new File( pom.getValue( "properties/prop1" ).toString() ) );
- }
-
- /* MNG-3979 */
- public void testJoiningOfContainersWhenChildHasEmptyElements()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "id-container-joining-with-empty-elements/sub" );
- assertNotNull( pom );
- }
-
- public void testOrderOfPluginConfigurationElementsWithoutPluginManagement()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "plugin-config-order/wo-plugin-mngt" );
- assertEquals( "one", pom.getValue( "build/plugins[1]/configuration/stringParams/stringParam[1]" ) );
- assertEquals( "two", pom.getValue( "build/plugins[1]/configuration/stringParams/stringParam[2]" ) );
- assertEquals( "three", pom.getValue( "build/plugins[1]/configuration/stringParams/stringParam[3]" ) );
- assertEquals( "four", pom.getValue( "build/plugins[1]/configuration/stringParams/stringParam[4]" ) );
- }
-
- /* MNG-3827*/
- public void testOrderOfPluginConfigurationElementsWithPluginManagement()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "plugin-config-order/w-plugin-mngt" );
- assertEquals( "one", pom.getValue( "build/plugins[1]/configuration/stringParams/stringParam[1]" ) );
- assertEquals( "two", pom.getValue( "build/plugins[1]/configuration/stringParams/stringParam[2]" ) );
- assertEquals( "three", pom.getValue( "build/plugins[1]/configuration/stringParams/stringParam[3]" ) );
- assertEquals( "four", pom.getValue( "build/plugins[1]/configuration/stringParams/stringParam[4]" ) );
- }
-
- public void testOrderOfPluginExecutionConfigurationElementsWithoutPluginManagement()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "plugin-exec-config-order/wo-plugin-mngt" );
- String prefix = "build/plugins[1]/executions[1]/configuration/";
- assertEquals( "one", pom.getValue( prefix + "stringParams/stringParam[1]" ) );
- assertEquals( "two", pom.getValue( prefix + "stringParams/stringParam[2]" ) );
- assertEquals( "three", pom.getValue( prefix + "stringParams/stringParam[3]" ) );
- assertEquals( "four", pom.getValue( prefix + "stringParams/stringParam[4]" ) );
- assertEquals( "key1", pom.getValue( prefix + "propertiesParam/property[1]/name" ) );
- assertEquals( "key2", pom.getValue( prefix + "propertiesParam/property[2]/name" ) );
- }
-
- /* MNG-3864*/
- public void testOrderOfPluginExecutionConfigurationElementsWithPluginManagement()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "plugin-exec-config-order/w-plugin-mngt" );
- String prefix = "build/plugins[1]/executions[1]/configuration/";
- assertEquals( "one", pom.getValue( prefix + "stringParams/stringParam[1]" ) );
- assertEquals( "two", pom.getValue( prefix + "stringParams/stringParam[2]" ) );
- assertEquals( "three", pom.getValue( prefix + "stringParams/stringParam[3]" ) );
- assertEquals( "four", pom.getValue( prefix + "stringParams/stringParam[4]" ) );
- assertEquals( "key1", pom.getValue( prefix + "propertiesParam/property[1]/name" ) );
- assertEquals( "key2", pom.getValue( prefix + "propertiesParam/property[2]/name" ) );
- }
-
- /* MNG-3836*/
- public void testMergeOfInheritedPluginConfiguration()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "plugin-config-merging/child" );
-
- String prefix = "build/plugins[1]/configuration/";
- assertEquals( "PASSED", pom.getValue( prefix + "propertiesFile" ) );
- assertEquals( "PASSED", pom.getValue( prefix + "parent" ) );
- assertEquals( "PASSED-1", pom.getValue( prefix + "stringParams/stringParam[1]" ) );
- assertEquals( "PASSED-3", pom.getValue( prefix + "stringParams/stringParam[2]" ) );
- assertEquals( "PASSED-2", pom.getValue( prefix + "stringParams/stringParam[3]" ) );
- assertEquals( "PASSED-4", pom.getValue( prefix + "stringParams/stringParam[4]" ) );
- assertEquals( "PASSED-1", pom.getValue( prefix + "listParam/listParam[1]" ) );
- assertEquals( "PASSED-3", pom.getValue( prefix + "listParam/listParam[2]" ) );
- assertEquals( "PASSED-2", pom.getValue( prefix + "listParam/listParam[3]" ) );
- assertEquals( "PASSED-4", pom.getValue( prefix + "listParam/listParam[4]" ) );
- }
-
- /* MNG-2591 */
- public void testAppendOfInheritedPluginConfigurationWithNoProfile()
- throws Exception
- {
- testAppendOfInheritedPluginConfiguration( "no-profile" );
- }
-
- /* MNG-2591*/
- public void testAppendOfInheritedPluginConfigurationWithActiveProfile()
- throws Exception
- {
- testAppendOfInheritedPluginConfiguration( "with-profile" );
- }
-
- private void testAppendOfInheritedPluginConfiguration( String test )
- throws Exception
- {
- PomTestWrapper pom = buildPom( "plugin-config-append/" + test + "/subproject" );
- String prefix = "build/plugins[1]/configuration/";
- assertEquals( "PARENT-1", pom.getValue( prefix + "stringParams/stringParam[1]" ) );
- assertEquals( "PARENT-3", pom.getValue( prefix + "stringParams/stringParam[2]" ) );
- assertEquals( "PARENT-2", pom.getValue( prefix + "stringParams/stringParam[3]" ) );
- assertEquals( "PARENT-4", pom.getValue( prefix + "stringParams/stringParam[4]" ) );
- assertEquals( "CHILD-1", pom.getValue( prefix + "stringParams/stringParam[5]" ) );
- assertEquals( "CHILD-3", pom.getValue( prefix + "stringParams/stringParam[6]" ) );
- assertEquals( "CHILD-2", pom.getValue( prefix + "stringParams/stringParam[7]" ) );
- assertEquals( "CHILD-4", pom.getValue( prefix + "stringParams/stringParam[8]" ) );
- assertEquals( null, pom.getValue( prefix + "stringParams/stringParam[9]" ) );
- assertEquals( "PARENT-1", pom.getValue( prefix + "listParam/listParam[1]" ) );
- assertEquals( "PARENT-3", pom.getValue( prefix + "listParam/listParam[2]" ) );
- assertEquals( "PARENT-2", pom.getValue( prefix + "listParam/listParam[3]" ) );
- assertEquals( "PARENT-4", pom.getValue( prefix + "listParam/listParam[4]" ) );
- assertEquals( "CHILD-1", pom.getValue( prefix + "listParam/listParam[5]" ) );
- assertEquals( "CHILD-3", pom.getValue( prefix + "listParam/listParam[6]" ) );
- assertEquals( "CHILD-2", pom.getValue( prefix + "listParam/listParam[7]" ) );
- assertEquals( "CHILD-4", pom.getValue( prefix + "listParam/listParam[8]" ) );
- assertEquals( null, pom.getValue( prefix + "listParam/listParam[9]" ) );
- }
-
- /* MNG-4000 */
- public void testMultiplePluginExecutionsWithAndWithoutIdsWithoutPluginManagement()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "plugin-exec-w-and-wo-id/wo-plugin-mngt" );
- assertEquals( 2, ( (List<?>) pom.getValue( "build/plugins[1]/executions" ) ).size() );
- assertEquals( "log-string", pom.getValue( "build/plugins[1]/executions[1]/goals[1]" ) );
- assertEquals( "log-string", pom.getValue( "build/plugins[1]/executions[2]/goals[1]" ) );
- }
-
- public void testMultiplePluginExecutionsWithAndWithoutIdsWithPluginManagement()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "plugin-exec-w-and-wo-id/w-plugin-mngt" );
- assertEquals( 2, ( (List<?>) pom.getValue( "build/plugins[1]/executions" ) ).size() );
- assertEquals( "log-string", pom.getValue( "build/plugins[1]/executions[1]/goals[1]" ) );
- assertEquals( "log-string", pom.getValue( "build/plugins[1]/executions[2]/goals[1]" ) );
- }
-
- public void testDependencyOrderWithoutPluginManagement()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "dependency-order/wo-plugin-mngt" );
- assertEquals( 4, ( (List<?>) pom.getValue( "dependencies" ) ).size() );
- assertEquals( "a", pom.getValue( "dependencies[1]/artifactId" ) );
- assertEquals( "c", pom.getValue( "dependencies[2]/artifactId" ) );
- assertEquals( "b", pom.getValue( "dependencies[3]/artifactId" ) );
- assertEquals( "d", pom.getValue( "dependencies[4]/artifactId" ) );
- }
-
- public void testDependencyOrderWithPluginManagement()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "dependency-order/w-plugin-mngt" );
- assertEquals( 4, ( (List<?>) pom.getValue( "dependencies" ) ).size() );
- assertEquals( "a", pom.getValue( "dependencies[1]/artifactId" ) );
- assertEquals( "c", pom.getValue( "dependencies[2]/artifactId" ) );
- assertEquals( "b", pom.getValue( "dependencies[3]/artifactId" ) );
- assertEquals( "d", pom.getValue( "dependencies[4]/artifactId" ) );
- }
-
- public void testBuildDirectoriesUsePlatformSpecificFileSeparator()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "platform-file-separator" );
- assertPathWithNormalizedFileSeparators( pom.getValue( "build/directory" ) );
- assertPathWithNormalizedFileSeparators( pom.getValue( "build/outputDirectory" ) );
- assertPathWithNormalizedFileSeparators( pom.getValue( "build/testOutputDirectory" ) );
- assertPathWithNormalizedFileSeparators( pom.getValue( "build/sourceDirectory" ) );
- assertPathWithNormalizedFileSeparators( pom.getValue( "build/testSourceDirectory" ) );
- assertPathWithNormalizedFileSeparators( pom.getValue( "build/resources[1]/directory" ) );
- assertPathWithNormalizedFileSeparators( pom.getValue( "build/testResources[1]/directory" ) );
- assertPathWithNormalizedFileSeparators( pom.getValue( "build/filters[1]" ) );
- assertPathWithNormalizedFileSeparators( pom.getValue( "reporting/outputDirectory" ) );
- }
-
- /* MNG-4008 */
- public void testMergedFilterOrder()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "merged-filter-order/sub" );
-
- assertEquals( 7, ( (List<?>) pom.getValue( "build/filters" ) ).size() );
- assertTrue( pom.getValue( "build/filters[1]" ).toString().endsWith( "child-a.properties" ) );
- assertTrue( pom.getValue( "build/filters[2]" ).toString().endsWith( "child-c.properties" ) );
- assertTrue( pom.getValue( "build/filters[3]" ).toString().endsWith( "child-b.properties" ) );
- assertTrue( pom.getValue( "build/filters[4]" ).toString().endsWith( "child-d.properties" ) );
- assertTrue( pom.getValue( "build/filters[5]" ).toString().endsWith( "parent-c.properties" ) );
- assertTrue( pom.getValue( "build/filters[6]" ).toString().endsWith( "parent-b.properties" ) );
- assertTrue( pom.getValue( "build/filters[7]" ).toString().endsWith( "parent-d.properties" ) );
- }
-
- /** MNG-4027*/
- public void testProfileInjectedDependencies()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "profile-injected-dependencies" );
- assertEquals( 4, ( (List<?>) pom.getValue( "dependencies" ) ).size() );
- assertEquals( "a", pom.getValue( "dependencies[1]/artifactId" ) );
- assertEquals( "c", pom.getValue( "dependencies[2]/artifactId" ) );
- assertEquals( "b", pom.getValue( "dependencies[3]/artifactId" ) );
- assertEquals( "d", pom.getValue( "dependencies[4]/artifactId" ) );
- }
-
- /** IT-0021*/
- public void testProfileDependenciesMultipleProfiles()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "profile-dependencies-multiple-profiles", "profile-1", "profile-2" );
- assertEquals(2, ( (List<?>) pom.getValue( "dependencies" ) ).size() );
- }
-
- public void testDependencyInheritance()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "dependency-inheritance/sub" );
- assertEquals( 1, ( (List<?>) pom.getValue( "dependencies" ) ).size() );
- assertEquals( "4.4", pom.getValue( "dependencies[1]/version" ) );
- }
-
- /** MNG-4034 */
- public void testManagedProfileDependency()
- throws Exception
- {
- PomTestWrapper pom = this.buildPom( "managed-profile-dependency/sub", "maven-core-it" );
- assertEquals( 1, ( (List<?>) pom.getValue( "dependencies" ) ).size() );
- assertEquals( "org.apache.maven.its", pom.getValue( "dependencies[1]/groupId" ) );
- assertEquals( "maven-core-it-support", pom.getValue( "dependencies[1]/artifactId" ) );
- assertEquals( "1.3", pom.getValue( "dependencies[1]/version" ) );
- assertEquals( "runtime", pom.getValue( "dependencies[1]/scope" ) );
- assertEquals( 1, ( (List<?>) pom.getValue( "dependencies[1]/exclusions" ) ).size() );
- assertEquals( "commons-lang", pom.getValue( "dependencies[1]/exclusions[1]/groupId" ) );
- }
-
- /** MNG-4040 */
- public void testProfileModuleInheritance()
- throws Exception
- {
- PomTestWrapper pom = this.buildPom( "profile-module-inheritance/sub", "dist" );
- assertEquals( 0, ( (List<?>) pom.getValue( "modules" ) ).size() );
- }
-
- /** MNG-3621 */
- public void testUncPath()
- throws Exception
- {
- PomTestWrapper pom = this.buildPom( "unc-path/sub" );
- assertEquals( "file:////host/site/test-child", pom.getValue( "distributionManagement/site/url" ) );
- }
-
- /** MNG-2006 */
- public void testUrlAppendWithChildPathAdjustment()
- throws Exception
- {
- PomTestWrapper pom = this.buildPom( "url-append/child" );
- assertEquals( "http://project.url/child", pom.getValue( "url" ) );
- assertEquals( "http://viewvc.project.url/child", pom.getValue( "scm/url" ) );
- assertEquals( "http://scm.project.url/child", pom.getValue( "scm/connection" ) );
- assertEquals( "https://scm.project.url/child", pom.getValue( "scm/developerConnection" ) );
- assertEquals( "http://site.project.url/child", pom.getValue( "distributionManagement/site/url" ) );
- }
-
- /** MNG-0479 */
- public void testRepoInheritance()
- throws Exception
- {
- PomTestWrapper pom = this.buildPom( "repo-inheritance" );
- assertEquals( 1, ( (List<?>) pom.getValue( "repositories" ) ).size() );
- assertEquals( "it0043", pom.getValue( "repositories[1]/name" ) );
- }
-
- public void testEmptyScm()
- throws Exception
- {
- PomTestWrapper pom = this.buildPom( "empty-scm" );
- assertNull( pom.getValue( "scm" ) );
- }
-
- public void testPluginConfigurationUsingAttributesWithoutPluginManagement()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "plugin-config-attributes/wo-plugin-mngt" );
- assertEquals( "src", pom.getValue( "build/plugins[1]/configuration/domParam/copy/@todir" ) );
- assertEquals( "true", pom.getValue( "build/plugins[1]/configuration/domParam/copy/@overwrite" ) );
- assertEquals( "target", pom.getValue( "build/plugins[1]/configuration/domParam/copy/fileset/@dir" ) );
- assertEquals( null, pom.getValue( "build/plugins[1]/configuration/domParam/copy/fileset/@todir" ) );
- assertEquals( null, pom.getValue( "build/plugins[1]/configuration/domParam/copy/fileset/@overwrite" ) );
- }
-
- /** MNG-4053*/
- public void testPluginConfigurationUsingAttributesWithPluginManagement()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "plugin-config-attributes/w-plugin-mngt" );
- assertEquals( "src", pom.getValue( "build/plugins[1]/configuration/domParam/copy/@todir" ) );
- assertEquals( "true", pom.getValue( "build/plugins[1]/configuration/domParam/copy/@overwrite" ) );
- assertEquals( "target", pom.getValue( "build/plugins[1]/configuration/domParam/copy/fileset/@dir" ) );
- assertEquals( null, pom.getValue( "build/plugins[1]/configuration/domParam/copy/fileset/@todir" ) );
- assertEquals( null, pom.getValue( "build/plugins[1]/configuration/domParam/copy/fileset/@overwrite" ) );
- }
-
- public void testPluginConfigurationUsingAttributesWithPluginManagementAndProfile()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "plugin-config-attributes/w-profile", "maven-core-it" );
- assertEquals( "src", pom.getValue( "build/plugins[1]/configuration/domParam/copy/@todir" ) );
- assertEquals( "true", pom.getValue( "build/plugins[1]/configuration/domParam/copy/@overwrite" ) );
- assertEquals( "target", pom.getValue( "build/plugins[1]/configuration/domParam/copy/fileset/@dir" ) );
- assertEquals( null, pom.getValue( "build/plugins[1]/configuration/domParam/copy/fileset/@todir" ) );
- assertEquals( null, pom.getValue( "build/plugins[1]/configuration/domParam/copy/fileset/@overwrite" ) );
- }
-
- public void testPomEncoding()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "pom-encoding/utf-8" );
- assertEquals( "TEST-CHARS: \u00DF\u0131\u03A3\u042F\u05D0\u20AC", pom.getValue( "description" ) );
- pom = buildPom( "pom-encoding/latin-1" );
- assertEquals( "TEST-CHARS: \u00C4\u00D6\u00DC\u00E4\u00F6\u00FC\u00DF", pom.getValue( "description" ) );
- }
-
- /* MNG-4070 */
- public void testXmlWhitespaceHandling()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "xml-whitespace/sub" );
- assertEquals( "org.apache.maven.its.mng4070", pom.getValue( "groupId" ) );
- }
-
- /* MNG-3760*/
- public void testInterpolationOfBaseUrl()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "baseurl-interpolation/pom.xml" );
- assertEquals( pom.getBasedir().toURI().toString(), pom.getValue( "properties/prop1" ).toString() );
- }
-
- /* MNG-3811*/
- public void testReportingPluginConfig()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "reporting-plugin-config/sub" );
-
- assertEquals( 3, ( (List<?>) pom.getValue( "reporting/plugins[1]/configuration/stringParams" ) ).size() );
- 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( " preserve space ", pom.getValue( "reporting/plugins[1]/configuration/stringParams[1]/stringParam[3]" ) );
- assertEquals( "true", pom.getValue( "reporting/plugins[1]/configuration/booleanParam" ) );
- }
-
- public void testPropertiesNoDuplication()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "properties-no-duplication/sub" );
- assertEquals( 1, ( (Properties) pom.getValue( "properties" ) ).size() );
- assertEquals( "child", pom.getValue( "properties/pomProfile" ) );
- }
-
- public void testPomInheritance()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "pom-inheritance/sub" );
- assertEquals( "parent-description", pom.getValue( "description" ) );
- assertEquals( "jar", pom.getValue( "packaging" ) );
- }
-
- public void testCompleteModelWithoutParent()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "complete-model/wo-parent" );
-
- testCompleteModel( pom );
- }
-
- public void testCompleteModelWithParent()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "complete-model/w-parent/sub" );
-
- testCompleteModel( pom );
- }
-
- private void testCompleteModel( PomTestWrapper pom )
- throws Exception
- {
- assertEquals( "4.0.0", pom.getValue( "modelVersion" ) );
-
- assertEquals( "org.apache.maven.its.mng", pom.getValue( "groupId" ) );
- assertEquals( "test", pom.getValue( "artifactId" ) );
- assertEquals( "0.2", pom.getValue( "version" ) );
- assertEquals( "pom", pom.getValue( "packaging" ) );
-
- assertEquals( "project-name", pom.getValue( "name" ) );
- assertEquals( "project-description", pom.getValue( "description" ) );
- assertEquals( "http://project.url/", pom.getValue( "url" ) );
- assertEquals( "2009", pom.getValue( "inceptionYear" ) );
-
- assertEquals( "project-org", pom.getValue( "organization/name" ) );
- assertEquals( "http://project-org.url/", pom.getValue( "organization/url" ) );
-
- assertEquals( 1, ( (List<?>) pom.getValue( "licenses" ) ).size() );
- assertEquals( "project-license", pom.getValue( "licenses[1]/name" ) );
- assertEquals( "http://project.url/license", pom.getValue( "licenses[1]/url" ) );
- assertEquals( "repo", pom.getValue( "licenses[1]/distribution" ) );
- assertEquals( "free", pom.getValue( "licenses[1]/comments" ) );
-
- assertEquals( 1, ( (List<?>) pom.getValue( "developers" ) ).size() );
- assertEquals( "dev", pom.getValue( "developers[1]/id" ) );
- assertEquals( "project-developer", pom.getValue( "developers[1]/name" ) );
- assertEquals( "developer@", pom.getValue( "developers[1]/email" ) );
- assertEquals( "http://developer", pom.getValue( "developers[1]/url" ) );
- assertEquals( "developer", pom.getValue( "developers[1]/organization" ) );
- assertEquals( "http://devel.org", pom.getValue( "developers[1]/organizationUrl" ) );
- assertEquals( "-1", pom.getValue( "developers[1]/timezone" ) );
- assertEquals( "yes", pom.getValue( "developers[1]/properties/developer" ) );
- assertEquals( 1, ( (List<?>) pom.getValue( "developers[1]/roles" ) ).size() );
- assertEquals( "devel", pom.getValue( "developers[1]/roles[1]" ) );
-
- assertEquals( 1, ( (List<?>) pom.getValue( "contributors" ) ).size() );
- assertEquals( "project-contributor", pom.getValue( "contributors[1]/name" ) );
- assertEquals( "contributor@", pom.getValue( "contributors[1]/email" ) );
- assertEquals( "http://contributor", pom.getValue( "contributors[1]/url" ) );
- assertEquals( "contributor", pom.getValue( "contributors[1]/organization" ) );
- assertEquals( "http://contrib.org", pom.getValue( "contributors[1]/organizationUrl" ) );
- assertEquals( "+1", pom.getValue( "contributors[1]/timezone" ) );
- assertEquals( "yes", pom.getValue( "contributors[1]/properties/contributor" ) );
- assertEquals( 1, ( (List<?>) pom.getValue( "contributors[1]/roles" ) ).size() );
- assertEquals( "contrib", pom.getValue( "contributors[1]/roles[1]" ) );
-
- assertEquals( 1, ( (List<?>) pom.getValue( "mailingLists" ) ).size() );
- assertEquals( "project-mailing-list", pom.getValue( "mailingLists[1]/name" ) );
- assertEquals( "subscribe@", pom.getValue( "mailingLists[1]/subscribe" ) );
- assertEquals( "unsubscribe@", pom.getValue( "mailingLists[1]/unsubscribe" ) );
- assertEquals( "post@", pom.getValue( "mailingLists[1]/post" ) );
- assertEquals( "mail-archive", pom.getValue( "mailingLists[1]/archive" ) );
- assertEquals( 1, ( (List<?>) pom.getValue( "mailingLists[1]/otherArchives" ) ).size() );
- assertEquals( "other-archive", pom.getValue( "mailingLists[1]/otherArchives[1]" ) );
-
- assertEquals( "2.0.1", pom.getValue( "prerequisites/maven" ) );
-
- assertEquals( "http://project.url/trunk", pom.getValue( "scm/url" ) );
- assertEquals( "http://project.url/scm", pom.getValue( "scm/connection" ) );
- assertEquals( "https://project.url/scm", pom.getValue( "scm/developerConnection" ) );
- assertEquals( "TAG", pom.getValue( "scm/tag" ) );
-
- assertEquals( "issues", pom.getValue( "issueManagement/system" ) );
- assertEquals( "http://project.url/issues", pom.getValue( "issueManagement/url" ) );
-
- assertEquals( "ci", pom.getValue( "ciManagement/system" ) );
- assertEquals( "http://project.url/ci", pom.getValue( "ciManagement/url" ) );
- assertEquals( 1, ( (List<?>) pom.getValue( "ciManagement/notifiers" ) ).size() );
- assertEquals( "irc", pom.getValue( "ciManagement/notifiers[1]/type" ) );
- assertEquals( "ci@", pom.getValue( "ciManagement/notifiers[1]/address" ) );
- assertEquals( Boolean.TRUE, pom.getValue( "ciManagement/notifiers[1]/sendOnError" ) );
- assertEquals( Boolean.FALSE, pom.getValue( "ciManagement/notifiers[1]/sendOnFailure" ) );
- assertEquals( Boolean.FALSE, pom.getValue( "ciManagement/notifiers[1]/sendOnWarning" ) );
- assertEquals( Boolean.FALSE, pom.getValue( "ciManagement/notifiers[1]/sendOnSuccess" ) );
- assertEquals( "ci", pom.getValue( "ciManagement/notifiers[1]/configuration/ciProp" ) );
-
- assertEquals( "project.distros", pom.getValue( "distributionManagement/repository/id" ) );
- assertEquals( "distros", pom.getValue( "distributionManagement/repository/name" ) );
- assertEquals( "http://project.url/dist", pom.getValue( "distributionManagement/repository/url" ) );
- assertEquals( Boolean.TRUE, pom.getValue( "distributionManagement/repository/uniqueVersion" ) );
-
- assertEquals( "project.snaps", pom.getValue( "distributionManagement/snapshotRepository/id" ) );
- assertEquals( "snaps", pom.getValue( "distributionManagement/snapshotRepository/name" ) );
- assertEquals( "http://project.url/snaps", pom.getValue( "distributionManagement/snapshotRepository/url" ) );
- assertEquals( Boolean.FALSE, pom.getValue( "distributionManagement/snapshotRepository/uniqueVersion" ) );
-
- assertEquals( "project.site", pom.getValue( "distributionManagement/site/id" ) );
- assertEquals( "docs", pom.getValue( "distributionManagement/site/name" ) );
- assertEquals( "http://project.url/site", pom.getValue( "distributionManagement/site/url" ) );
-
- assertEquals( "http://project.url/download", pom.getValue( "distributionManagement/downloadUrl" ) );
- assertEquals( "reloc-gid", pom.getValue( "distributionManagement/relocation/groupId" ) );
- assertEquals( "reloc-aid", pom.getValue( "distributionManagement/relocation/artifactId" ) );
- assertEquals( "reloc-version", pom.getValue( "distributionManagement/relocation/version" ) );
- assertEquals( "project-reloc-msg", pom.getValue( "distributionManagement/relocation/message" ) );
-
- assertEquals( 1, ( (List<?>) pom.getValue( "modules" ) ).size() );
- assertEquals( "sub", pom.getValue( "modules[1]" ) );
-
- assertEquals( 1, ( (Map<?, ?>) pom.getValue( "properties" ) ).size() );
- assertEquals( "project-property", pom.getValue( "properties[1]/itProperty" ) );
-
- assertEquals( 1, ( (List<?>) pom.getValue( "dependencyManagement/dependencies" ) ).size() );
- assertEquals( "org.apache.maven.its", pom.getValue( "dependencyManagement/dependencies[1]/groupId" ) );
- assertEquals( "managed-dep", pom.getValue( "dependencyManagement/dependencies[1]/artifactId" ) );
- assertEquals( "0.1", pom.getValue( "dependencyManagement/dependencies[1]/version" ) );
- assertEquals( "war", pom.getValue( "dependencyManagement/dependencies[1]/type" ) );
- assertEquals( "runtime", pom.getValue( "dependencyManagement/dependencies[1]/scope" ) );
- assertEquals( Boolean.FALSE, pom.getValue( "dependencyManagement/dependencies[1]/optional" ) );
- assertEquals( 1, ( (List<?>) pom.getValue( "dependencyManagement/dependencies[1]/exclusions" ) ).size() );
- assertEquals( "org.apache.maven.its",
- pom.getValue( "dependencyManagement/dependencies[1]/exclusions[1]/groupId" ) );
- assertEquals( "excluded-managed-dep",
- pom.getValue( "dependencyManagement/dependencies[1]/exclusions[1]/artifactId" ) );
-
- assertEquals( 1, ( (List<?>) pom.getValue( "dependencies" ) ).size() );
- assertEquals( "org.apache.maven.its", pom.getValue( "dependencies[1]/groupId" ) );
- assertEquals( "dep", pom.getValue( "dependencies[1]/artifactId" ) );
- assertEquals( "0.2", pom.getValue( "dependencies[1]/version" ) );
- assertEquals( "ejb", pom.getValue( "dependencies[1]/type" ) );
- assertEquals( "test", pom.getValue( "dependencies[1]/scope" ) );
- assertEquals( Boolean.TRUE, pom.getValue( "dependencies[1]/optional" ) );
- 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( 2, ( (List<?>) pom.getValue( "repositories" ) ).size() );
- assertEquals( "project-remote-repo", pom.getValue( "repositories[1]/id" ) );
- assertEquals( "http://project.url/remote", pom.getValue( "repositories[1]/url" ) );
- assertEquals( "repo", pom.getValue( "repositories[1]/name" ) );
- assertEquals( RepositorySystem.DEFAULT_REMOTE_REPO_ID, pom.getValue( "repositories[2]/id" ) );
- assertEquals( RepositorySystem.DEFAULT_REMOTE_REPO_URL, pom.getValue( "repositories[2]/url" ) );
-
- 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/extensions" ) ).size() );
- assertEquals( "org.apache.maven.its.ext", pom.getValue( "build/extensions[1]/groupId" ) );
- assertEquals( "ext", pom.getValue( "build/extensions[1]/artifactId" ) );
- assertEquals( "3.0", pom.getValue( "build/extensions[1]/version" ) );
-
- 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.TRUE, 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]" ) );
- }
-
- /* MNG-2309*/
-
- public void testProfileInjectionOrder()
- throws Exception
- {
- PomTestWrapper pom =
- buildPom( "profile-injection-order", "pom-a", "pom-b", "pom-e", "pom-c", "pom-d" );
- assertEquals( "e", pom.getValue( "properties[1]/pomProperty" ) );
- }
-
- public void testPropertiesInheritance()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "properties-inheritance/sub" );
- assertEquals( "parent-property", pom.getValue( "properties/parentProperty" ) );
- assertEquals( "child-property", pom.getValue( "properties/childProperty" ) );
- assertEquals( "child-override", pom.getValue( "properties/overriddenProperty" ) );
- }
-
- /* MNG-4102*/
- public void testInheritedPropertiesInterpolatedWithValuesFromChildWithoutProfiles()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "inherited-properties-interpolation/no-profile/sub" );
-
- assertEquals( "CHILD", pom.getValue( "properties/overridden" ) );
- assertEquals( "CHILD", pom.getValue( "properties/interpolated" ) );
- }
-
- /* MNG-4102 */
- public void testInheritedPropertiesInterpolatedWithValuesFromChildWithActiveProfiles()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "inherited-properties-interpolation/active-profile/sub" );
-
- assertEquals( 1, pom.getMavenProject().getModel().getProfiles().size() );
-
- buildPom( "inherited-properties-interpolation/active-profile/sub", "it-parent", "it-child" );
- assertEquals( "CHILD", pom.getValue( "properties/overridden" ) );
- assertEquals( "CHILD", pom.getValue( "properties/interpolated" ) );
- }
-
- /* MNG-3545 */
- public void testProfileDefaultActivation()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "profile-default-deactivation", "profile4" );
- assertEquals( 1, pom.getMavenProject().getActiveProfiles().size() );
- assertEquals( 1, ( (List<?>) pom.getValue( "build/plugins" ) ).size() );
- assertEquals( "2.1", pom.getValue( "build/plugins[1]/version" ) );
- }
-
- /* MNG-1995 */
- public void testBooleanInterpolation()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "boolean-interpolation" );
- assertTrue ((Boolean) pom.getValue( "repositories[1]/releases/enabled" ) );
- assertTrue((Boolean) pom.getValue( "build/resources[1]/filtering" ) );
- }
-
-
- /* MNG-3899 */
- public void testBuildExtensionInheritance()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "build-extension-inheritance/sub" );
- assertEquals( 3, ( (List<?>) pom.getValue( "build/extensions" ) ).size() );
- assertEquals( "b", pom.getValue( "build/extensions[1]/artifactId" ) );
- assertEquals( "a", pom.getValue( "build/extensions[2]/artifactId" ) );
- assertEquals( "0.2", pom.getValue( "build/extensions[2]/version" ) );
- assertEquals( "c", pom.getValue( "build/extensions[3]/artifactId" ) );
- }
-
- /*MNG-1957*/
- public void testJdkActivation()
- throws Exception
- {
- Properties props = new Properties();
- props.put( "java.version", "1.5.0_15" );
-
- PomTestWrapper pom = buildPom( "jdk-activation", props );
- assertEquals( 3, pom.getMavenProject().getActiveProfiles().size() );
- assertEquals( "PASSED", pom.getValue( "properties/jdkProperty3" ) );
- assertEquals( "PASSED", pom.getValue( "properties/jdkProperty2" ) );
- assertEquals( "PASSED", pom.getValue( "properties/jdkProperty1" ) );
- }
-
- /* MNG-2174 */
- public void testProfilePluginMngDependencies()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "profile-plugin-mng-dependencies/sub", "maven-core-it" );
- assertEquals( "a", pom.getValue( "build/plugins[1]/dependencies[1]/artifactId" ) );
- }
-
- /** MNG-4116 */
- public void testPercentEncodedUrlsMustNotBeDecoded()
- throws Exception
- {
- PomTestWrapper pom = this.buildPom( "url-no-decoding" );
- assertEquals( "http://maven.apache.org/spacy%20path", pom.getValue( "url" ) );
- assertEquals( "http://svn.apache.org/viewvc/spacy%20path", pom.getValue( "scm/url" ) );
- assertEquals( "scm:svn:svn+ssh://svn.apache.org/spacy%20path", pom.getValue( "scm/connection" ) );
- assertEquals( "scm:svn:svn+ssh://svn.apache.org/spacy%20path", pom.getValue( "scm/developerConnection" ) );
- assertEquals( "http://issues.apache.org/spacy%20path", pom.getValue( "issueManagement/url" ) );
- assertEquals( "http://ci.apache.org/spacy%20path", pom.getValue( "ciManagement/url" ) );
- assertEquals( "scm:svn:svn+ssh://dist.apache.org/spacy%20path",
- pom.getValue( "distributionManagement/repository/url" ) );
- assertEquals( "scm:svn:svn+ssh://snap.apache.org/spacy%20path",
- pom.getValue( "distributionManagement/snapshotRepository/url" ) );
- assertEquals( "scm:svn:svn+ssh://site.apache.org/spacy%20path",
- pom.getValue( "distributionManagement/site/url" ) );
- }
-
- public void testPluginManagementInheritance()
- throws Exception
- {
- PomTestWrapper pom = this.buildPom( "plugin-management-inheritance" );
- assertEquals( "0.1-stub-SNAPSHOT",
- pom.getValue( "build/pluginManagement/plugins[@artifactId='maven-compiler-plugin']/version" ) );
- }
-
- public void testProfilePlugins()
- throws Exception
- {
- PomTestWrapper pom = this.buildPom( "profile-plugins", "standard" );
- assertEquals( 2, ( (List<?>) pom.getValue( "build/plugins" ) ).size() );
- assertEquals( "maven-assembly2-plugin", pom.getValue( "build/plugins[2]/artifactId" ) );
- }
-
- public void testPluginInheritanceSimple()
- throws Exception
- {
- PomTestWrapper pom = this.buildPom( "plugin-inheritance-simple/sub" );
- assertEquals( 2, ( (List<?>) pom.getValue( "build/plugins" ) ).size() );
- }
-
- public void testPluginManagementDuplicate()
- throws Exception
- {
- PomTestWrapper pom = this.buildPom( "plugin-management-duplicate/sub" );
- assertEquals( 12, ( (List<?>) pom.getValue( "build/pluginManagement/plugins" ) ).size() );
- }
-
- public void testDistributionManagement()
- throws Exception
- {
- PomTestWrapper pom = this.buildPom( "distribution-management" );
- assertEquals( "legacy", pom.getValue( "distributionManagement/repository/layout" ) );
- }
-
- public void testDependencyScopeInheritance()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "dependency-scope-inheritance/sub" );
- String scope = (String) pom.getValue( "dependencies[1]/scope" );
- assertEquals( "compile", scope );
- }
-
- public void testDependencyScope()
- throws Exception
- {
- buildPom( "dependency-scope/sub" );
- }
-
- //This will fail on a validation error if incorrect
- public void testDependencyManagementWithInterpolation()
- throws Exception
- {
- buildPom( "dependency-management-with-interpolation/sub" );
- }
-
- public void testInterpolationWithSystemProperty()
- throws Exception
- {
- Properties sysProps = new Properties();
- sysProps.setProperty( "system.property", "PASSED" );
- PomTestWrapper pom = buildPom( "sytem-property-interpolation", sysProps );
- assertEquals( "PASSED", pom.getValue( "name" ) );
- }
-
- /* MNG-4129 */
- public void testPluginExecutionInheritanceWhenChildDoesNotDeclarePlugin()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "plugin-exec-inheritance/wo-merge" );
- @SuppressWarnings( "unchecked" )
- List<PluginExecution> executions =
- (List<PluginExecution>) pom.getValue( "build/pluginsAsMap[@name='org.apache.maven.its.plugins:maven-it-plugin-log-file']/executions" );
- assertEquals( 1, executions.size() );
- assertEquals( "inherited-execution", executions.get( 0 ).getId() );
- }
-
- public void testPluginExecutionInheritanceWhenChildDoesDeclarePluginAsWell()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "plugin-exec-inheritance/w-merge" );
- @SuppressWarnings( "unchecked" )
- List<PluginExecution> executions =
- (List<PluginExecution>) pom.getValue( "build/pluginsAsMap[@name='org.apache.maven.its.plugins:maven-it-plugin-log-file']/executions" );
- assertEquals( 1, executions.size() );
- assertEquals( "inherited-execution", executions.get( 0 ).getId() );
- }
-
- /* MNG-4193 */
- public void testValidationErrorUponNonUniqueArtifactRepositoryId()
- throws Exception
- {
- try
- {
- buildPom( "unique-repo-id/artifact-repo" );
- fail( "Non-unique repository ids did not cause validation error" );
- }
- catch ( ProjectBuildingException e )
- {
- // expected
- }
- }
-
- /* MNG-4193 */
- public void testValidationErrorUponNonUniquePluginRepositoryId()
- throws Exception
- {
- try
- {
- buildPom( "unique-repo-id/plugin-repo" );
- fail( "Non-unique repository ids did not cause validation error" );
- }
- catch ( ProjectBuildingException e )
- {
- // expected
- }
- }
-
- /* MNG-4193 */
- public void testValidationErrorUponNonUniqueArtifactRepositoryIdInProfile()
- throws Exception
- {
- try
- {
- buildPom( "unique-repo-id/artifact-repo-in-profile" );
- fail( "Non-unique repository ids did not cause validation error" );
- }
- catch ( ProjectBuildingException e )
- {
- // expected
- }
- }
-
- /* MNG-4193 */
- public void testValidationErrorUponNonUniquePluginRepositoryIdInProfile()
- throws Exception
- {
- try
- {
- buildPom( "unique-repo-id/plugin-repo-in-profile" );
- fail( "Non-unique repository ids did not cause validation error" );
- }
- catch ( ProjectBuildingException e )
- {
- // expected
- }
- }
-
- /** MNG-3843 */
- public void testPrerequisitesAreNotInherited()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "prerequisites-inheritance/child" );
- assertSame( null, pom.getValue( "prerequisites" ) );
- }
-
- public void testLicensesAreInheritedButNotAggregated()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "licenses-inheritance/child-2" );
- assertEquals( 1, ( (List<?>) pom.getValue( "licenses" ) ).size() );
- assertEquals( "child-license", pom.getValue( "licenses[1]/name" ) );
- assertEquals( "http://child.url/license", pom.getValue( "licenses[1]/url" ) );
- }
-
- public void testDevelopersAreInheritedButNotAggregated()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "developers-inheritance/child-2" );
- assertEquals( 1, ( (List<?>) pom.getValue( "developers" ) ).size() );
- assertEquals( "child-developer", pom.getValue( "developers[1]/name" ) );
- }
-
- public void testContributorsAreInheritedButNotAggregated()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "contributors-inheritance/child-2" );
- assertEquals( 1, ( (List<?>) pom.getValue( "contributors" ) ).size() );
- assertEquals( "child-contributor", pom.getValue( "contributors[1]/name" ) );
- }
-
- public void testMailingListsAreInheritedButNotAggregated()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "mailing-lists-inheritance/child-2" );
- assertEquals( 1, ( (List<?>) pom.getValue( "mailingLists" ) ).size() );
- assertEquals( "child-mailing-list", pom.getValue( "mailingLists[1]/name" ) );
- }
-
- public void testPluginInheritanceOrder()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "plugin-inheritance-order/child" );
-
- assertEquals( "maven-it-plugin-log-file", pom.getValue( "build/plugins[1]/artifactId" ) );
- assertEquals( "maven-it-plugin-expression", pom.getValue( "build/plugins[2]/artifactId" ) );
- assertEquals( "maven-it-plugin-configuration", pom.getValue( "build/plugins[3]/artifactId" ) );
-
- assertEquals( "maven-it-plugin-log-file", pom.getValue( "reporting/plugins[1]/artifactId" ) );
- assertEquals( "maven-it-plugin-expression", pom.getValue( "reporting/plugins[2]/artifactId" ) );
- assertEquals( "maven-it-plugin-configuration", pom.getValue( "reporting/plugins[3]/artifactId" ) );
- }
-
- public void testCliPropsDominateProjectPropsDuringInterpolation()
- throws Exception
- {
- Properties props = new Properties();
- props.setProperty( "testProperty", "PASSED" );
- PomTestWrapper pom = buildPom( "interpolation-cli-wins", props );
-
- assertEquals( "PASSED", pom.getValue( "properties/interpolatedProperty" ) );
- }
-
- public void testParentPomPackagingMustBePom()
- throws Exception
- {
- try
- {
- buildPom( "parent-pom-packaging/sub" );
- fail( "Wrong packaging of parent POM was not rejected" );
- }
- catch ( ProjectBuildingException e )
- {
- // expected
- }
- }
-
- /** MNG-522, MNG-3018 */
- public void testManagedPluginConfigurationAppliesToImplicitPluginsIntroducedByPackaging()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "plugin-management-for-implicit-plugin/child" );
- assertEquals( "passed.txt",
- pom.getValue( "build/plugins[@artifactId='maven-resources-plugin']/configuration/pathname" ) );
- assertEquals( "passed.txt",
- pom.getValue( "build/plugins[@artifactId='maven-it-plugin-log-file']/configuration/logFile" ) );
- }
-
- public void testDefaultPluginsExecutionContributedByPackagingExecuteBeforeUserDefinedExecutions()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "plugin-exec-order-and-default-exec" );
- @SuppressWarnings( "unchecked" )
- List<PluginExecution> executions =
- (List<PluginExecution>) pom.getValue( "build/plugins[@artifactId='maven-resources-plugin']/executions" );
- assertNotNull( executions );
- assertEquals( 4, executions.size() );
- assertEquals( "default-resources", executions.get( 0 ).getId() );
- assertEquals( "default-testResources", executions.get( 1 ).getId() );
- assertEquals( "test-1", executions.get( 2 ).getId() );
- assertEquals( "test-2", executions.get( 3 ).getId() );
- }
-
- public void testPluginDeclarationsRetainPomOrderAfterInjectionOfDefaultPlugins()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "plugin-exec-order-with-lifecycle" );
- @SuppressWarnings( "unchecked" )
- List<Plugin> plugins = (List<Plugin>) pom.getValue( "build/plugins" );
- int resourcesPlugin = -1;
- int customPlugin = -1;
- for ( int i = 0; i < plugins.size(); i++ )
- {
- Plugin plugin = plugins.get( i );
- if ( "maven-resources-plugin".equals( plugin.getArtifactId() ) )
- {
- assertTrue( resourcesPlugin < 0 );
- resourcesPlugin = i;
- }
- else if ( "maven-it-plugin-log-file".equals( plugin.getArtifactId() ) )
- {
- assertTrue( customPlugin < 0 );
- customPlugin = i;
- }
- }
- assertTrue( plugins.toString(), customPlugin == resourcesPlugin - 1 );
- }
-
- /** MNG-4415 */
- public void testPluginOrderAfterMergingWithInheritedPlugins()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "plugin-inheritance-merge-order/sub" );
-
- List<String> expected = new ArrayList<String>();
- expected.add( "maven-it-plugin-error" );
- expected.add( "maven-it-plugin-configuration" );
- expected.add( "maven-it-plugin-dependency-resolution" );
- expected.add( "maven-it-plugin-packaging" );
- expected.add( "maven-it-plugin-log-file" );
- expected.add( "maven-it-plugin-expression" );
- expected.add( "maven-it-plugin-fork" );
- expected.add( "maven-it-plugin-touch" );
-
- List<String> actual = new ArrayList<String>();
- @SuppressWarnings( "unchecked" )
- List<Plugin> plugins = (List<Plugin>) pom.getValue( "build/plugins" );
- for ( Plugin plugin : plugins )
- {
- actual.add( plugin.getArtifactId() );
- }
-
- actual.retainAll( expected );
-
- assertEquals( actual, expected );
- }
-
- /** MNG-4416 */
- public void testPluginOrderAfterMergingWithInjectedPlugins()
- throws Exception
- {
- PomTestWrapper pom = buildPom( "plugin-injection-merge-order" );
-
- List<String> expected = new ArrayList<String>();
- expected.add( "maven-it-plugin-error" );
- expected.add( "maven-it-plugin-configuration" );
- expected.add( "maven-it-plugin-dependency-resolution" );
- expected.add( "maven-it-plugin-packaging" );
- expected.add( "maven-it-plugin-log-file" );
- expected.add( "maven-it-plugin-expression" );
- expected.add( "maven-it-plugin-fork" );
- expected.add( "maven-it-plugin-touch" );
-
- List<String> actual = new ArrayList<String>();
- @SuppressWarnings( "unchecked" )
- List<Plugin> plugins = (List<Plugin>) pom.getValue( "build/plugins" );
- for ( Plugin plugin : plugins )
- {
- actual.add( plugin.getArtifactId() );
- }
-
- actual.retainAll( expected );
-
- assertEquals( actual, expected );
- }
-
- public void testProjectArtifactIdIsNotInheritedButMandatory()
- throws Exception
- {
- try
- {
- buildPom( "artifact-id-inheritance/child" );
- fail( "Missing artifactId did not cause validation error" );
- }
- catch ( ProjectBuildingException e )
- {
- // expected
- }
- }
-
- 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() );
- }
-
- private PomTestWrapper buildPom( String pomPath, String... profileIds )
- throws Exception
- {
- return buildPom( pomPath, null, profileIds );
- }
-
- private PomTestWrapper buildPom( String pomPath, Properties executionProperties, String... profileIds )
- throws Exception
- {
- return buildPom( pomPath, false, executionProperties, profileIds );
- }
-
- private PomTestWrapper buildPom( String pomPath, boolean lenientValidation, Properties executionProperties,
- String... profileIds )
- throws Exception
- {
- File pomFile = new File( testDirectory, pomPath );
- if ( pomFile.isDirectory() )
- {
- pomFile = new File( pomFile, "pom.xml" );
- }
-
- ProjectBuildingRequest config = new DefaultProjectBuildingRequest();
-
- String localRepoUrl =
- System.getProperty( "maven.repo.local", System.getProperty( "user.home" ) + "/.m2/repository" );
- localRepoUrl = "file://" + localRepoUrl;
- config.setLocalRepository( repositorySystem.createArtifactRepository( "local", localRepoUrl, new DefaultRepositoryLayout(), null, null ) );
- config.setActiveProfileIds( Arrays.asList( profileIds ) );
- config.setSystemProperties( executionProperties );
- config.setUserProperties( executionProperties );
- config.setValidationLevel( lenientValidation ? ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_2_0
- : ModelBuildingRequest.VALIDATION_LEVEL_STRICT );
-
- DefaultRepositorySystemSession repoSession = MavenRepositorySystemUtils.newSession();
- LocalRepository localRepo = new LocalRepository( config.getLocalRepository().getBasedir() );
- repoSession.setLocalRepositoryManager( new SimpleLocalRepositoryManagerFactory().newInstance( repoSession, localRepo ) );
- config.setRepositorySession( repoSession );
-
- return new PomTestWrapper( pomFile, projectBuilder.build( pomFile, config ).getProject() );
- }
-
- protected void assertModelEquals( PomTestWrapper pom, Object expected, String expression )
- {
- assertEquals( expected, pom.getValue( expression ) );
- }
-
- private static String createPath( List<String> elements )
- {
- StringBuilder buffer = new StringBuilder( 256 );
- for ( String s : elements )
- {
- buffer.append( s ).append( File.separator );
- }
- return buffer.toString().substring( 0, buffer.toString().length() - 1 );
- }
-}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/ProjectBuilderTest.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/ProjectBuilderTest.java
deleted file mode 100644
index 5511cb1a..00000000
--- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/ProjectBuilderTest.java
+++ /dev/null
@@ -1,87 +0,0 @@
-package org.apache.maven.project;
-
-/*
- * 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.Properties;
-
-import org.apache.maven.AbstractCoreMavenComponentTestCase;
-import org.apache.maven.execution.MavenSession;
-import org.apache.maven.model.building.FileModelSource;
-import org.apache.maven.model.building.ModelSource;
-
-public class ProjectBuilderTest
- extends AbstractCoreMavenComponentTestCase
-{
- protected String getProjectsDirectory()
- {
- return "src/test/projects/project-builder";
- }
-
- public void testSystemScopeDependencyIsPresentInTheCompileClasspathElements()
- throws Exception
- {
- File pom = getProject( "it0063" );
-
- Properties eps = new Properties();
- eps.setProperty( "jre.home", new File( pom.getParentFile(), "jdk/jre" ).getPath() );
-
- MavenSession session = createMavenSession( pom, eps );
- MavenProject project = session.getCurrentProject();
-
- // Here we will actually not have any artifacts because the ProjectDependenciesResolver is not involved here. So
- // right now it's not valid to ask for artifacts unless plugins require the artifacts.
-
- project.getCompileClasspathElements();
- }
-
- public void testBuildFromModelSource()
- throws Exception
- {
- File pomFile = new File( "src/test/resources/projects/modelsource/module01/pom.xml" );
- MavenSession mavenSession = createMavenSession( pomFile );
- ProjectBuildingRequest configuration = new DefaultProjectBuildingRequest();
- configuration.setRepositorySession( mavenSession.getRepositorySession() );
- ModelSource modelSource = new FileModelSource( pomFile );
- ProjectBuildingResult result =
- lookup( org.apache.maven.project.ProjectBuilder.class ).build( modelSource, configuration );
-
- assertNotNull( result.getProject().getParentFile() );
- }
-
- public void testVersionlessManagedDependency()
- throws Exception
- {
- File pomFile = new File( "src/test/resources/projects/versionless-managed-dependency.xml" );
- MavenSession mavenSession = createMavenSession( null );
- ProjectBuildingRequest configuration = new DefaultProjectBuildingRequest();
- configuration.setRepositorySession( mavenSession.getRepositorySession() );
-
- try
- {
- lookup( org.apache.maven.project.ProjectBuilder.class ).build( pomFile, configuration );
- fail();
- }
- catch ( ProjectBuildingException e )
- {
- // this is expected
- }
- }
-}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/ProjectSorterTest.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/ProjectSorterTest.java
deleted file mode 100644
index 5cb45279..00000000
--- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/ProjectSorterTest.java
+++ /dev/null
@@ -1,363 +0,0 @@
-package org.apache.maven.project;
-
-/*
- * 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.Collections;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-import org.apache.maven.model.Build;
-import org.apache.maven.model.Dependency;
-import org.apache.maven.model.Extension;
-import org.apache.maven.model.Model;
-import org.apache.maven.model.Parent;
-import org.apache.maven.model.Plugin;
-import org.apache.maven.model.PluginManagement;
-import org.codehaus.plexus.util.dag.CycleDetectedException;
-
-/**
- * Test sorting projects by dependencies.
- *
- * @author <a href="mailto:brett@apache.org">Brett Porter</a>
- */
-public class ProjectSorterTest
- extends TestCase
-{
-
- private Parent createParent( MavenProject project )
- {
- return createParent( project.getGroupId(), project.getArtifactId(), project.getVersion() );
- }
-
- private Parent createParent( String groupId, String artifactId, String version )
- {
- Parent plugin = new Parent();
- plugin.setGroupId( groupId );
- plugin.setArtifactId( artifactId );
- plugin.setVersion( version );
- return plugin;
- }
-
- private Dependency createDependency( MavenProject project )
- {
- return createDependency( project.getGroupId(), project.getArtifactId(), project.getVersion() );
- }
-
- private Dependency createDependency( String groupId, String artifactId, String version )
- {
- Dependency depdendency = new Dependency();
- depdendency.setGroupId( groupId );
- depdendency.setArtifactId( artifactId );
- depdendency.setVersion( version );
- return depdendency;
- }
-
- private Plugin createPlugin( MavenProject project )
- {
- return createPlugin( project.getGroupId(), project.getArtifactId(), project.getVersion() );
- }
-
- private Plugin createPlugin( String groupId, String artifactId, String version )
- {
- Plugin plugin = new Plugin();
- plugin.setGroupId( groupId );
- plugin.setArtifactId( artifactId );
- plugin.setVersion( version );
- return plugin;
- }
-
- private Extension createExtension( String groupId, String artifactId, String version )
- {
- Extension extension = new Extension();
- extension.setGroupId( groupId );
- extension.setArtifactId( artifactId );
- extension.setVersion( version );
- return extension;
- }
-
- private static MavenProject createProject( String groupId, String artifactId, String version )
- {
- Model model = new Model();
- model.setGroupId( groupId );
- model.setArtifactId( artifactId );
- model.setVersion( version );
- model.setBuild( new Build() );
- return new MavenProject( model );
- }
-
- public void testShouldNotFailWhenPluginDepReferencesCurrentProject()
- throws CycleDetectedException, DuplicateProjectException
- {
- MavenProject project = createProject( "group", "artifact", "1.0" );
-
- Build build = project.getModel().getBuild();
-
- Plugin plugin = createPlugin( "other.group", "other-artifact", "1.0" );
-
- Dependency dep = createDependency( "group", "artifact", "1.0" );
-
- plugin.addDependency( dep );
-
- build.addPlugin( plugin );
-
- new ProjectSorter( Collections.singletonList( project ) );
- }
-
- public void testShouldNotFailWhenManagedPluginDepReferencesCurrentProject()
- throws CycleDetectedException, DuplicateProjectException
- {
- MavenProject project = createProject( "group", "artifact", "1.0" );
-
- Build build = project.getModel().getBuild();
-
- PluginManagement pMgmt = new PluginManagement();
-
- Plugin plugin = createPlugin( "other.group", "other-artifact", "1.0" );
-
- Dependency dep = createDependency( "group", "artifact", "1.0" );
-
- plugin.addDependency( dep );
-
- pMgmt.addPlugin( plugin );
-
- build.setPluginManagement( pMgmt );
-
- new ProjectSorter( Collections.singletonList( project ) );
- }
-
- public void testShouldNotFailWhenProjectReferencesNonExistentProject()
- throws CycleDetectedException, DuplicateProjectException
- {
- MavenProject project = createProject( "group", "artifact", "1.0" );
-
- Build build = project.getModel().getBuild();
-
- Extension extension = createExtension( "other.group", "other-artifact", "1.0" );
-
- build.addExtension( extension );
-
- new ProjectSorter( Collections.singletonList( project ) );
- }
-
- public void testMatchingArtifactIdsDifferentGroupIds()
- throws CycleDetectedException, DuplicateProjectException
- {
- List<MavenProject> projects = new ArrayList<MavenProject>();
- MavenProject project1 = createProject( "groupId1", "artifactId", "1.0" );
- projects.add( project1 );
- MavenProject project2 = createProject( "groupId2", "artifactId", "1.0" );
- projects.add( project2 );
- project1.getDependencies().add( createDependency( project2 ) );
-
- projects = new ProjectSorter( projects ).getSortedProjects();
-
- assertEquals( project2, projects.get( 0 ) );
- assertEquals( project1, projects.get( 1 ) );
- }
-
- public void testMatchingGroupIdsDifferentArtifactIds()
- throws CycleDetectedException, DuplicateProjectException
- {
- List<MavenProject> projects = new ArrayList<MavenProject>();
- MavenProject project1 = createProject( "groupId", "artifactId1", "1.0" );
- projects.add( project1 );
- MavenProject project2 = createProject( "groupId", "artifactId2", "1.0" );
- projects.add( project2 );
- project1.getDependencies().add( createDependency( project2 ) );
-
- projects = new ProjectSorter( projects ).getSortedProjects();
-
- assertEquals( project2, projects.get( 0 ) );
- assertEquals( project1, projects.get( 1 ) );
- }
-
- public void testMatchingIdsAndVersions()
- throws CycleDetectedException
- {
- List<MavenProject> projects = new ArrayList<MavenProject>();
- MavenProject project1 = createProject( "groupId", "artifactId", "1.0" );
- projects.add( project1 );
- MavenProject project2 = createProject( "groupId", "artifactId", "1.0" );
- projects.add( project2 );
-
- try
- {
- projects = new ProjectSorter( projects ).getSortedProjects();
- fail( "Duplicate projects should fail" );
- }
- catch ( DuplicateProjectException e )
- {
- // expected
- assertTrue( true );
- }
- }
-
- public void testMatchingIdsAndDifferentVersions()
- throws CycleDetectedException, DuplicateProjectException
- {
- List<MavenProject> projects = new ArrayList<MavenProject>();
- MavenProject project1 = createProject( "groupId", "artifactId", "1.0" );
- projects.add( project1 );
- MavenProject project2 = createProject( "groupId", "artifactId", "2.0" );
- projects.add( project2 );
-
- projects = new ProjectSorter( projects ).getSortedProjects();
- assertEquals( project1, projects.get( 0 ) );
- assertEquals( project2, projects.get( 1 ) );
- }
-
- public void testPluginDependenciesInfluenceSorting()
- throws Exception
- {
- List<MavenProject> projects = new ArrayList<MavenProject>();
-
- MavenProject parentProject = createProject( "groupId", "parent", "1.0" );
- projects.add( parentProject );
-
- MavenProject declaringProject = createProject( "groupId", "declarer", "1.0" );
- declaringProject.setParent( parentProject );
- declaringProject.getModel().setParent( createParent( parentProject ) );
- projects.add( declaringProject );
-
- MavenProject pluginLevelDepProject = createProject( "groupId", "plugin-level-dep", "1.0" );
- pluginLevelDepProject.setParent( parentProject );
- pluginLevelDepProject.getModel().setParent( createParent( parentProject ) );
- projects.add( pluginLevelDepProject );
-
- MavenProject pluginProject = createProject( "groupId", "plugin", "1.0" );
- pluginProject.setParent( parentProject );
- pluginProject.getModel().setParent( createParent( parentProject ) );
- projects.add( pluginProject );
-
- Plugin plugin = createPlugin( pluginProject );
-
- plugin.addDependency( createDependency( pluginLevelDepProject ) );
-
- Build build = declaringProject.getModel().getBuild();
-
- build.addPlugin( plugin );
-
- projects = new ProjectSorter( projects ).getSortedProjects();
-
- assertEquals( parentProject, projects.get( 0 ) );
-
- // the order of these two is non-deterministic, based on when they're added to the reactor.
- assertTrue( projects.contains( pluginProject ) );
- assertTrue( projects.contains( pluginLevelDepProject ) );
-
- // the declaring project MUST be listed after the plugin and its plugin-level dep, though.
- assertEquals( declaringProject, projects.get( 3 ) );
- }
-
- public void testPluginDependenciesInfluenceSorting_DeclarationInParent()
- throws Exception
- {
- List<MavenProject> projects = new ArrayList<MavenProject>();
-
- MavenProject parentProject = createProject( "groupId", "parent-declarer", "1.0" );
- projects.add( parentProject );
-
- MavenProject pluginProject = createProject( "groupId", "plugin", "1.0" );
- pluginProject.setParent( parentProject );
- pluginProject.getModel().setParent( createParent( parentProject ) );
- projects.add( pluginProject );
-
- MavenProject pluginLevelDepProject = createProject( "groupId", "plugin-level-dep", "1.0" );
- pluginLevelDepProject.setParent( parentProject );
- pluginLevelDepProject.getModel().setParent( createParent( parentProject ) );
- projects.add( pluginLevelDepProject );
-
- Plugin plugin = createPlugin( pluginProject );
-
- plugin.addDependency( createDependency( pluginLevelDepProject ) );
-
- Build build = parentProject.getModel().getBuild();
-
- build.addPlugin( plugin );
-
- projects = new ProjectSorter( projects ).getSortedProjects();
-
- System.out.println( projects );
-
- assertEquals( parentProject, projects.get( 0 ) );
-
- // the order of these two is non-deterministic, based on when they're added to the reactor.
- assertTrue( projects.contains( pluginProject ) );
- assertTrue( projects.contains( pluginLevelDepProject ) );
- }
-
- public void testPluginVersionsAreConsidered()
- throws Exception
- {
- List<MavenProject> projects = new ArrayList<MavenProject>();
-
- MavenProject pluginProjectA = createProject( "group", "plugin-a", "2.0-SNAPSHOT" );
- projects.add( pluginProjectA );
- pluginProjectA.getModel().getBuild().addPlugin( createPlugin( "group", "plugin-b", "1.0" ) );
-
- MavenProject pluginProjectB = createProject( "group", "plugin-b", "2.0-SNAPSHOT" );
- projects.add( pluginProjectB );
- pluginProjectB.getModel().getBuild().addPlugin( createPlugin( "group", "plugin-a", "1.0" ) );
-
- projects = new ProjectSorter( projects ).getSortedProjects();
-
- assertTrue( projects.contains( pluginProjectA ) );
- assertTrue( projects.contains( pluginProjectB ) );
- }
-
- public void testDependencyPrecedesProjectThatUsesSpecificDependencyVersion()
- throws Exception
- {
- List<MavenProject> projects = new ArrayList<MavenProject>();
-
- MavenProject usingProject = createProject( "group", "project", "1.0" );
- projects.add( usingProject );
- usingProject.getModel().addDependency( createDependency( "group", "dependency", "1.0" ) );
-
- MavenProject pluginProject = createProject( "group", "dependency", "1.0" );
- projects.add( pluginProject );
-
- projects = new ProjectSorter( projects ).getSortedProjects();
-
- assertEquals( pluginProject, projects.get( 0 ) );
- assertEquals( usingProject, projects.get( 1 ) );
- }
-
- public void testDependencyPrecedesProjectThatUsesUnresolvedDependencyVersion()
- throws Exception
- {
- List<MavenProject> projects = new ArrayList<MavenProject>();
-
- MavenProject usingProject = createProject( "group", "project", "1.0" );
- projects.add( usingProject );
- usingProject.getModel().addDependency( createDependency( "group", "dependency", "[1.0,)" ) );
-
- MavenProject pluginProject = createProject( "group", "dependency", "1.0" );
- projects.add( pluginProject );
-
- projects = new ProjectSorter( projects ).getSortedProjects();
-
- assertEquals( pluginProject, projects.get( 0 ) );
- assertEquals( usingProject, projects.get( 1 ) );
- }
-
-}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/TestMetadataSource.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/TestMetadataSource.java
deleted file mode 100644
index 67c0037b..00000000
--- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/TestMetadataSource.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package org.apache.maven.project;
-
-/*
- * 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.List;
-
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
-import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
-import org.apache.maven.artifact.metadata.ResolutionGroup;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.project.artifact.MavenMetadataSource;
-import org.codehaus.plexus.component.annotations.Component;
-
-@SuppressWarnings( "deprecation" )
-@Component( role = ArtifactMetadataSource.class, hint = "classpath" )
-public class TestMetadataSource
- extends MavenMetadataSource
-{
- @Override
- public ResolutionGroup retrieve( Artifact artifact, ArtifactRepository localRepository,
- List<ArtifactRepository> remoteRepositories )
- throws ArtifactMetadataRetrievalException
- {
- ResolutionGroup rg = super.retrieve( artifact, localRepository, remoteRepositories );
-
- for ( Artifact a : rg.getArtifacts() )
- {
- a.setResolved( true );
- }
-
- return rg;
- }
-} \ No newline at end of file
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/artifact/DefaultMavenMetadataCacheTest.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/artifact/DefaultMavenMetadataCacheTest.java
deleted file mode 100644
index 6b103b2c..00000000
--- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/artifact/DefaultMavenMetadataCacheTest.java
+++ /dev/null
@@ -1,81 +0,0 @@
-package org.apache.maven.project.artifact;
-
-/*
- * 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.Arrays;
-import java.util.Collections;
-
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.resolver.filter.ExcludesArtifactFilter;
-import org.apache.maven.project.artifact.DefaultMavenMetadataCache.CacheKey;
-import org.apache.maven.repository.DelegatingLocalArtifactRepository;
-import org.apache.maven.repository.RepositorySystem;
-import org.codehaus.plexus.PlexusTestCase;
-
-/**
- * @author Igor Fedorenko
- */
-public class DefaultMavenMetadataCacheTest
- extends PlexusTestCase
-{
- private RepositorySystem repositorySystem;
-
- protected void setUp()
- throws Exception
- {
- super.setUp();
- repositorySystem = lookup( RepositorySystem.class );
- }
-
- @Override
- protected void tearDown()
- throws Exception
- {
- repositorySystem = null;
- super.tearDown();
- }
-
- public void testCacheKey()
- throws Exception
- {
- Artifact a1 = repositorySystem.createArtifact( "testGroup", "testArtifact", "1.2.3", "jar" );
- @SuppressWarnings( "deprecation" )
- ArtifactRepository lr1 = new DelegatingLocalArtifactRepository( repositorySystem.createDefaultLocalRepository() );
- ArtifactRepository rr1 = repositorySystem.createDefaultRemoteRepository();
- a1.setDependencyFilter( new ExcludesArtifactFilter( Arrays.asList( "foo" ) ) );
-
- Artifact a2 = repositorySystem.createArtifact( "testGroup", "testArtifact", "1.2.3", "jar" );
- @SuppressWarnings( "deprecation" )
- ArtifactRepository lr2 = new DelegatingLocalArtifactRepository( repositorySystem.createDefaultLocalRepository() );
- ArtifactRepository rr2 = repositorySystem.createDefaultRemoteRepository();
- a2.setDependencyFilter( new ExcludesArtifactFilter( Arrays.asList( "foo" ) ) );
-
- // sanity checks
- assertNotSame( a1, a2 );
- assertNotSame( lr1, lr2 );
- assertNotSame( rr1, rr2 );
-
- CacheKey k1 = new CacheKey( a1, false, lr1, Collections.singletonList( rr1 ) );
- CacheKey k2 = new CacheKey( a2, false, lr2, Collections.singletonList( rr2 ) );
-
- assertEquals(k1.hashCode(), k2.hashCode());
- }
-}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/artifact/MavenMetadataSourceTest.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/artifact/MavenMetadataSourceTest.java
deleted file mode 100644
index 9c770da9..00000000
--- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/artifact/MavenMetadataSourceTest.java
+++ /dev/null
@@ -1,183 +0,0 @@
-package org.apache.maven.project.artifact;
-
-/*
- * 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.repository.RepositorySystem;
-import org.codehaus.plexus.PlexusTestCase;
-
-public class MavenMetadataSourceTest
- extends PlexusTestCase
-{
- private RepositorySystem repositorySystem;
-
- protected void setUp()
- throws Exception
- {
- super.setUp();
- repositorySystem = lookup( RepositorySystem.class );
- }
-
- @Override
- protected void tearDown()
- throws Exception
- {
- repositorySystem = null;
- super.tearDown();
- }
-
- public void testShouldNotCarryExclusionsOverFromDependencyToDependency()
- throws Exception
- {
- /*
- Dependency dep1 = new Dependency();
- dep1.setGroupId( "test" );
- dep1.setArtifactId( "test-artifact" );
- dep1.setVersion( "1" );
- dep1.setType( "jar" );
-
- Exclusion exc = new Exclusion();
- exc.setGroupId( "test" );
- exc.setArtifactId( "test-artifact3" );
-
- dep1.addExclusion( exc );
-
- Dependency dep2 = new Dependency();
- dep2.setGroupId( "test" );
- dep2.setArtifactId( "test-artifact2" );
- dep2.setVersion( "1" );
- dep2.setType( "jar" );
-
- List deps = new ArrayList();
- deps.add( dep1 );
- deps.add( dep2 );
-
- ArtifactFactory factory = lookup( ArtifactFactory.class );
-
- ArtifactFilter dependencyFilter = new ScopeArtifactFilter( Artifact.SCOPE_COMPILE );
-
- MavenProject project = new MavenProject( new Model() );
-
- Set result = project.createArtifacts( dependencyFilter );
-
- for ( Iterator it = result.iterator(); it.hasNext(); )
- {
- Artifact artifact = ( Artifact ) it.next();
-
- if ( "test-artifact2".equals( artifact.getArtifactId() ) )
- {
- ArtifactFilter filter = artifact.getDependencyFilter();
-
- assertSame( dependencyFilter, filter );
- }
- }
- */
- }
-
- //TODO: restore these if it makes sense
- /*
- public void testShouldUseCompileScopeIfDependencyScopeEmpty()
- throws Exception
- {
- String groupId = "org.apache.maven";
- String artifactId = "maven-model";
-
- Dependency dep = new Dependency();
-
- dep.setGroupId( groupId );
- dep.setArtifactId( artifactId );
- dep.setVersion( "2.0-alpha-3" );
-
- Model model = new Model();
-
- model.addDependency( dep );
-
- MavenProject project = new MavenProject( model, repositorySystem );
-
- project.setArtifacts( project.createArtifacts( null ) );
-
- String key = ArtifactUtils.versionlessKey( groupId, artifactId );
-
- Map artifactMap = project.getArtifactMap();
-
- assertNotNull( "artifact-map should not be null.", artifactMap );
- assertEquals( "artifact-map should contain 1 element.", 1, artifactMap.size() );
-
- Artifact artifact = (Artifact) artifactMap.get( key );
-
- assertNotNull( "dependency artifact not found in map.", artifact );
- assertEquals( "dependency artifact has wrong scope.", Artifact.SCOPE_COMPILE, artifact.getScope() );
-
- //check for back-propagation of default scope.
- assertEquals( "default scope NOT back-propagated to dependency.", Artifact.SCOPE_COMPILE, dep.getScope() );
- }
-
- public void testShouldUseInjectedTestScopeFromDependencyManagement()
- throws Exception
- {
- String groupId = "org.apache.maven";
- String artifactId = "maven-model";
-
- Dependency dep = new Dependency();
-
- dep.setGroupId( groupId );
- dep.setArtifactId( artifactId );
- dep.setVersion( "2.0-alpha-3" );
-
- Model model = new Model();
-
- model.addDependency( dep );
-
- Dependency mgd = new Dependency();
- mgd.setGroupId( groupId );
- mgd.setArtifactId( artifactId );
- mgd.setScope( Artifact.SCOPE_TEST );
-
- DependencyManagement depMgmt = new DependencyManagement();
-
- depMgmt.addDependency( mgd );
-
- model.setDependencyManagement( depMgmt );
-
- MavenProject project = new MavenProject( model, repositorySystem );
-
- TestModelDefaultsInjector injector = new TestModelDefaultsInjector();
-
- injector.injectDefaults( model );
-
- project.setArtifacts( project.createArtifacts( null ) );
-
- String key = ArtifactUtils.versionlessKey( groupId, artifactId );
-
- Map artifactMap = project.getArtifactMap();
-
- assertNotNull( "artifact-map should not be null.", artifactMap );
- assertEquals( "artifact-map should contain 1 element.", 1, artifactMap.size() );
-
- Artifact artifact = (Artifact) artifactMap.get( key );
-
- assertNotNull( "dependency artifact not found in map.", artifact );
- assertEquals( "dependency artifact has wrong scope.", Artifact.SCOPE_TEST, artifact.getScope() );
-
- //check for back-propagation of default scope.
- assertEquals( "default scope NOT back-propagated to dependency.", Artifact.SCOPE_TEST, dep.getScope() );
- }
- */
-
-}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/canonical/CanonicalProjectBuilderTest.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/canonical/CanonicalProjectBuilderTest.java
deleted file mode 100644
index 8b6454da..00000000
--- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/canonical/CanonicalProjectBuilderTest.java
+++ /dev/null
@@ -1,101 +0,0 @@
-package org.apache.maven.project.canonical;
-
-/*
- * 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.List;
-
-import org.apache.maven.model.Plugin;
-import org.apache.maven.model.PluginExecution;
-import org.apache.maven.project.AbstractMavenProjectTestCase;
-import org.apache.maven.project.MavenProject;
-import org.codehaus.plexus.util.xml.Xpp3Dom;
-
-/**
- * @author Jason van Zyl
- */
-public class CanonicalProjectBuilderTest
- extends AbstractMavenProjectTestCase
-{
- public void testProjectBuilder()
- throws Exception
- {
- File f = getFileForClasspathResource( "canonical-pom.xml" );
-
- MavenProject project = getProject( f );
-
- // ----------------------------------------------------------------------
- // Top-level elements
- // ----------------------------------------------------------------------
-
- assertEquals( "4.0.0", project.getModelVersion() );
-
- // ----------------------------------------------------------------------
- // Plugins
- // ----------------------------------------------------------------------
-
- List<Plugin> plugins = project.getBuildPlugins();
-
- // Plugin0 [plexus]
-
- String key = "org.apache.maven.plugins:maven-plexus-plugin";
-
- Plugin plugin = null;
- for ( Plugin check : plugins )
- {
- if ( key.equals( check.getKey() ) )
- {
- plugin = check;
- break;
- }
- }
-
- assertNotNull( plugin );
-
- assertEquals( "1.0", plugin.getVersion() );
-
- Xpp3Dom configuration = (Xpp3Dom) plugin.getConfiguration();
-
- assertEquals( "src/conf/plexus.conf", configuration.getChild( "plexusConfiguration" ).getValue() );
-
- assertEquals( "src/conf/plexus.properties",
- configuration.getChild( "plexusConfigurationPropertiesFile" ).getValue() );
-
- assertEquals( "Continuum", configuration.getChild( "plexusApplicationName" ).getValue() );
-
- // ----------------------------------------------------------------------
- // Goal specific configuration
- // ----------------------------------------------------------------------
-
- List<PluginExecution> executions = plugin.getExecutions();
-
- PluginExecution execution = executions.get( 0 );
-
- String g0 = execution.getGoals().get( 0 );
-
- assertEquals( "plexus:runtime", g0 );
-
- configuration = (Xpp3Dom) execution.getConfiguration();
-
- assertEquals( "ContinuumPro", configuration.getChild( "plexusApplicationName" ).getValue() );
-
- // Plugin1 [antlr]
- }
-}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/harness/PomTestWrapper.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/harness/PomTestWrapper.java
deleted file mode 100644
index c204140a..00000000
--- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/harness/PomTestWrapper.java
+++ /dev/null
@@ -1,121 +0,0 @@
-package org.apache.maven.project.harness;
-
-/*
- * 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 org.apache.commons.jxpath.JXPathContext;
-import org.apache.commons.jxpath.JXPathNotFoundException;
-import org.apache.commons.jxpath.ri.JXPathContextReferenceImpl;
-import org.apache.maven.project.MavenProject;
-
-public class PomTestWrapper
-{
-
- private File pomFile;
-
- private JXPathContext context;
-
- private MavenProject mavenProject;
-
- static
- {
- JXPathContextReferenceImpl.addNodePointerFactory( new Xpp3DomPointerFactory() );
- }
-
- public PomTestWrapper( File pomFile, MavenProject mavenProject )
- {
- if ( mavenProject == null )
- {
- throw new IllegalArgumentException( "mavenProject: null" );
- }
- this.mavenProject = mavenProject;
- this.pomFile = pomFile;
- context = JXPathContext.newContext( mavenProject.getModel() );
- }
-
- public PomTestWrapper( MavenProject mavenProject )
- {
- if ( mavenProject == null )
- {
- throw new IllegalArgumentException( "mavenProject: null" );
- }
- this.mavenProject = mavenProject;
- context = JXPathContext.newContext( mavenProject.getModel() );
- }
-
- public MavenProject getMavenProject()
- {
- return mavenProject;
- }
-
- public File getBasedir()
- {
- return ( pomFile != null ) ? pomFile.getParentFile() : null;
- }
-
- public void setValueOnModel( String expression, Object value )
- {
- context.setValue( expression, value );
- }
-
- /*
- public int containerCountForUri( String uri )
- throws IOException
- {
- if ( uri == null || uri.trim().equals( "" ) )
- {
- throw new IllegalArgumentException( "uri: null or empty" );
- }
- ModelDataSource source = new DefaultModelDataSource();
- source.init( domainModel.getModelProperties(), null );
- return source.queryFor( uri ).size();
- }
- */
-
- public Iterator<?> getIteratorForXPathExpression( String expression )
- {
- return context.iterate( expression );
- }
-
- public boolean containsXPathExpression( String expression )
- {
- return context.getValue( expression ) != null;
- }
-
- public Object getValue( String expression )
- {
- try
- {
- return context.getValue( expression );
- }
- catch ( JXPathNotFoundException e )
- {
- return null;
- }
- }
-
- public boolean xPathExpressionEqualsValue( String expression, String value )
- {
- return context.getValue( expression ) != null && context.getValue( expression ).equals( value );
- }
-
-}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/harness/Xpp3DomAttributeIterator.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/harness/Xpp3DomAttributeIterator.java
deleted file mode 100644
index 2811a848..00000000
--- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/harness/Xpp3DomAttributeIterator.java
+++ /dev/null
@@ -1,89 +0,0 @@
-package org.apache.maven.project.harness;
-
-/*
- * 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.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.commons.jxpath.ri.QName;
-import org.apache.commons.jxpath.ri.model.NodeIterator;
-import org.apache.commons.jxpath.ri.model.NodePointer;
-import org.codehaus.plexus.util.xml.Xpp3Dom;
-
-/**
- * An attribute iterator for JXPath to support <code>Xpp3Dom</code>.
- *
- * @author Benjamin Bentmann
- */
-class Xpp3DomAttributeIterator
- implements NodeIterator
-{
-
- private NodePointer parent;
-
- private Xpp3Dom node;
-
- private List<Map.Entry<String, String>> attributes;
-
- private Map.Entry<String, String> attribute;
-
- private int position;
-
- public Xpp3DomAttributeIterator( NodePointer parent, QName qname )
- {
- this.parent = parent;
- this.node = (Xpp3Dom) parent.getNode();
-
- Map<String, String> map = new LinkedHashMap<String, String>();
- for ( String name : this.node.getAttributeNames() )
- {
- if ( name.equals( qname.getName() ) || "*".equals( qname.getName() ) )
- {
- String value = this.node.getAttribute( name );
- map.put( name, value );
- }
- }
- this.attributes = new ArrayList<Map.Entry<String, String>>( map.entrySet() );
- }
-
- public NodePointer getNodePointer()
- {
- if ( position == 0 )
- {
- setPosition( 1 );
- }
- return ( attribute == null ) ? null : new Xpp3DomAttributePointer( parent, attribute );
- }
-
- public int getPosition()
- {
- return position;
- }
-
- public boolean setPosition( int position )
- {
- this.position = position;
- attribute = ( position > 0 && position <= attributes.size() ) ? attributes.get( position - 1 ) : null;
- return attribute != null;
- }
-
-}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/harness/Xpp3DomAttributePointer.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/harness/Xpp3DomAttributePointer.java
deleted file mode 100644
index 04514b18..00000000
--- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/harness/Xpp3DomAttributePointer.java
+++ /dev/null
@@ -1,105 +0,0 @@
-package org.apache.maven.project.harness;
-
-/*
- * 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.Map;
-
-import org.apache.commons.jxpath.ri.QName;
-import org.apache.commons.jxpath.ri.model.NodePointer;
-
-/**
- * An attribute pointer for JXPath to support <code>Xpp3Dom</code>.
- *
- * @author Benjamin Bentmann
- */
-class Xpp3DomAttributePointer
- extends NodePointer
-{
-
- private Map.Entry<String, String> attrib;
-
- public Xpp3DomAttributePointer( NodePointer parent, Map.Entry<String, String> attrib )
- {
- super( parent );
- this.attrib = attrib;
- }
-
- @Override
- public int compareChildNodePointers( NodePointer pointer1, NodePointer pointer2 )
- {
- // should never happen because attributes have no children
- return 0;
- }
-
- @Override
- public Object getValue()
- {
- return attrib.getValue();
- }
-
- @Override
- public Object getBaseValue()
- {
- return attrib;
- }
-
- @Override
- public Object getImmediateNode()
- {
- return attrib;
- }
-
- @Override
- public int getLength()
- {
- return 1;
- }
-
- @Override
- public QName getName()
- {
- return new QName( null, attrib.getKey() );
- }
-
- @Override
- public boolean isActual()
- {
- return true;
- }
-
- @Override
- public boolean isCollection()
- {
- return false;
- }
-
- @Override
- public boolean isLeaf()
- {
- return true;
- }
-
- @Override
- public void setValue( Object value )
- {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/harness/Xpp3DomNodeIterator.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/harness/Xpp3DomNodeIterator.java
deleted file mode 100644
index 796a5ca0..00000000
--- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/harness/Xpp3DomNodeIterator.java
+++ /dev/null
@@ -1,161 +0,0 @@
-package org.apache.maven.project.harness;
-
-/*
- * 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.List;
-
-import org.apache.commons.jxpath.ri.Compiler;
-import org.apache.commons.jxpath.ri.compiler.NodeNameTest;
-import org.apache.commons.jxpath.ri.compiler.NodeTest;
-import org.apache.commons.jxpath.ri.compiler.NodeTypeTest;
-import org.apache.commons.jxpath.ri.model.NodeIterator;
-import org.apache.commons.jxpath.ri.model.NodePointer;
-import org.codehaus.plexus.util.StringUtils;
-import org.codehaus.plexus.util.xml.Xpp3Dom;
-
-/**
- * A node iterator for JXPath to support <code>Xpp3Dom</code>.
- *
- * @author Benjamin Bentmann
- */
-class Xpp3DomNodeIterator
- implements NodeIterator
-{
-
- private NodePointer parent;
-
- private NodeTest test;
-
- private Xpp3Dom node;
-
- private Xpp3Dom[] children;
-
- private List<Xpp3Dom> filteredChildren = new ArrayList<Xpp3Dom>();
-
- private int filteredIndex;
-
- private Xpp3Dom child;
-
- private int position;
-
- public Xpp3DomNodeIterator( NodePointer parent, NodeTest test, boolean reverse, NodePointer startWith )
- {
- this.parent = parent;
- this.node = (Xpp3Dom) parent.getNode();
- this.children = this.node.getChildren();
- if ( startWith != null )
- {
- Xpp3Dom startWithNode = (Xpp3Dom) startWith.getNode();
- for ( ; filteredIndex < children.length; filteredIndex++ )
- {
- if ( startWithNode.equals( children[filteredIndex] ) )
- {
- filteredIndex++;
- break;
- }
- }
- }
- this.test = test;
- if ( reverse )
- {
- throw new UnsupportedOperationException();
- }
- }
-
- public NodePointer getNodePointer()
- {
- if ( position == 0 )
- {
- setPosition( 1 );
- }
- return ( child == null ) ? null : new Xpp3DomNodePointer( parent, child );
- }
-
- public int getPosition()
- {
- return position;
- }
-
- public boolean setPosition( int position )
- {
- this.position = position;
- filterChildren( position );
- child = ( position > 0 && position <= filteredChildren.size() ) ? filteredChildren.get( position - 1 ) : null;
- return child != null;
- }
-
- private void filterChildren( int position )
- {
- for ( ; position > filteredChildren.size() && filteredIndex < children.length; filteredIndex++ )
- {
- Xpp3Dom child = children[filteredIndex];
- if ( testNode( child ) )
- {
- filteredChildren.add( child );
- }
- }
- }
-
- private boolean testNode( Xpp3Dom node )
- {
- if ( test == null )
- {
- return true;
- }
- if ( test instanceof NodeNameTest )
- {
- String nodeName = node.getName();
- if ( StringUtils.isEmpty( nodeName ) )
- {
- return false;
- }
-
- NodeNameTest nodeNameTest = (NodeNameTest) test;
- String namespaceURI = nodeNameTest.getNamespaceURI();
- boolean wildcard = nodeNameTest.isWildcard();
- String testName = nodeNameTest.getNodeName().getName();
- String testPrefix = nodeNameTest.getNodeName().getPrefix();
- if ( wildcard && testPrefix == null )
- {
- return true;
- }
- if ( wildcard || testName.equals( nodeName ) )
- {
- return StringUtils.isEmpty( namespaceURI ) || StringUtils.isEmpty( testPrefix );
- }
- return false;
- }
- if ( test instanceof NodeTypeTest )
- {
- switch ( ( (NodeTypeTest) test ).getNodeType() )
- {
- case Compiler.NODE_TYPE_NODE:
- return true;
- case Compiler.NODE_TYPE_TEXT:
- return node.getValue() != null;
- default:
- return false;
- }
- }
- return false;
- }
-
-}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/harness/Xpp3DomNodePointer.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/harness/Xpp3DomNodePointer.java
deleted file mode 100644
index f93bd892..00000000
--- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/harness/Xpp3DomNodePointer.java
+++ /dev/null
@@ -1,155 +0,0 @@
-package org.apache.maven.project.harness;
-
-/*
- * 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.List;
-
-import org.apache.commons.jxpath.ri.QName;
-import org.apache.commons.jxpath.ri.compiler.NodeTest;
-import org.apache.commons.jxpath.ri.model.NodeIterator;
-import org.apache.commons.jxpath.ri.model.NodePointer;
-import org.codehaus.plexus.util.xml.Xpp3Dom;
-
-/**
- * A node pointer for JXPath to support <code>Xpp3Dom</code>.
- *
- * @author Benjamin Bentmann
- */
-class Xpp3DomNodePointer
- extends NodePointer
-{
-
- private Xpp3Dom node;
-
- public Xpp3DomNodePointer( Xpp3Dom node )
- {
- super( null );
- this.node = node;
- }
-
- public Xpp3DomNodePointer( NodePointer parent, Xpp3Dom node )
- {
- super( parent );
- this.node = node;
- }
-
- @Override
- public int compareChildNodePointers( NodePointer pointer1, NodePointer pointer2 )
- {
- Xpp3Dom node1 = (Xpp3Dom) pointer1.getBaseValue();
- Xpp3Dom node2 = (Xpp3Dom) pointer2.getBaseValue();
- if ( node1 == node2 )
- {
- return 0;
- }
- for ( int i = 0; i < node.getChildCount(); i++ )
- {
- Xpp3Dom child = node.getChild( i );
- if ( child == node1 )
- {
- return -1;
- }
- if ( child == node2 )
- {
- return 1;
- }
- }
- return 0;
- }
-
- @Override
- public Object getValue()
- {
- return getValue( node );
- }
-
- private static Object getValue( Xpp3Dom node )
- {
- if ( node.getValue() != null )
- {
- return node.getValue();
- }
- else
- {
- List<Object> children = new ArrayList<Object>();
- for ( int i = 0; i < node.getChildCount(); i++ )
- {
- children.add( getValue( node.getChild( i ) ) );
- }
- return children;
- }
- }
-
- @Override
- public Object getBaseValue()
- {
- return node;
- }
-
- @Override
- public Object getImmediateNode()
- {
- return node;
- }
-
- @Override
- public int getLength()
- {
- return 1;
- }
-
- @Override
- public QName getName()
- {
- return new QName( null, node.getName() );
- }
-
- @Override
- public boolean isCollection()
- {
- return false;
- }
-
- @Override
- public boolean isLeaf()
- {
- return node.getChildCount() <= 0;
- }
-
- @Override
- public void setValue( Object value )
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public NodeIterator childIterator( NodeTest test, boolean reverse, NodePointer startWith )
- {
- return new Xpp3DomNodeIterator( this, test, reverse, startWith );
- }
-
- @Override
- public NodeIterator attributeIterator( QName qname )
- {
- return new Xpp3DomAttributeIterator( this, qname );
- }
-
-}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/harness/Xpp3DomPointerFactory.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/harness/Xpp3DomPointerFactory.java
deleted file mode 100644
index 28c0f8ff..00000000
--- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/test/java/org/apache/maven/project/harness/Xpp3DomPointerFactory.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package org.apache.maven.project.harness;
-
-/*
- * 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.Locale;
-
-import org.apache.commons.jxpath.ri.QName;
-import org.apache.commons.jxpath.ri.model.NodePointer;
-import org.apache.commons.jxpath.ri.model.NodePointerFactory;
-import org.codehaus.plexus.util.xml.Xpp3Dom;
-
-/**
- * A node pointer factory for JXPath to support <code>Xpp3Dom</code>.
- *
- * @author Benjamin Bentmann
- */
-public class Xpp3DomPointerFactory
- implements NodePointerFactory
-{
-
- public int getOrder()
- {
- return 200;
- }
-
- public NodePointer createNodePointer( QName name, Object object, Locale locale )
- {
- if ( object instanceof Xpp3Dom )
- {
- return new Xpp3DomNodePointer( (Xpp3Dom) object );
- }
- return null;
- }
-
- public NodePointer createNodePointer( NodePointer parent, QName name, Object object )
- {
- if ( object instanceof Xpp3Dom )
- {
- return new Xpp3DomNodePointer( parent, (Xpp3Dom) object );
- }
- return null;
- }
-
-}