aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository
diff options
context:
space:
mode:
Diffstat (limited to 'framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository')
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/DefaultMirrorSelectorTest.java38
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/LegacyRepositoryLayout.java89
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/LegacyRepositorySystemTest.java206
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/MirrorProcessorTest.java259
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/DefaultUpdateCheckManagerTest.java240
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/DefaultWagonManagerTest.java422
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/LegacyRepositorySystemTest.java88
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/PerLookupWagon.java38
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/StringWagon.java107
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonA.java39
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonB.java39
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonC.java39
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonMock.java50
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/DefaultArtifactCollectorTest.java984
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/AbstractConflictResolverTest.java143
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/FarthestConflictResolverTest.java107
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/NearestConflictResolverTest.java107
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/NewestConflictResolverTest.java107
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/OldestConflictResolverTest.java107
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/metadata/DefaultClasspathTransformationTest.java120
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolutionPolicyTest.java59
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolverTest.java153
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/metadata/TestMetadataSource.java99
23 files changed, 0 insertions, 3640 deletions
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/DefaultMirrorSelectorTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/DefaultMirrorSelectorTest.java
deleted file mode 100644
index fb32f0f2..00000000
--- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/DefaultMirrorSelectorTest.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.apache.maven.repository;
-
-/*
- * 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.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.repository.DefaultArtifactRepository;
-import org.codehaus.plexus.PlexusTestCase;
-
-public class DefaultMirrorSelectorTest
- extends PlexusTestCase
-{
-
- public void testMirrorWithMirroOfPatternContainingANegationIsNotSelected()
- {
- ArtifactRepository repository = new DefaultArtifactRepository( "snapshots.repo", "http://whatever", null );
- String pattern = "external:*, !snapshots.repo";
- boolean matches = DefaultMirrorSelector.matchPattern( repository, pattern );
- System.out.println( matches );
- assertFalse( matches );
- }
-}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/LegacyRepositoryLayout.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/LegacyRepositoryLayout.java
deleted file mode 100644
index 77a6baef..00000000
--- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/LegacyRepositoryLayout.java
+++ /dev/null
@@ -1,89 +0,0 @@
-package org.apache.maven.repository;
-
-/*
- * 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.artifact.Artifact;
-import org.apache.maven.artifact.handler.ArtifactHandler;
-import org.apache.maven.artifact.metadata.ArtifactMetadata;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
-import org.codehaus.plexus.component.annotations.Component;
-
-/**
- * @author jdcasey
- */
-@Component(role=ArtifactRepositoryLayout.class, hint="legacy")
-public class LegacyRepositoryLayout
- implements ArtifactRepositoryLayout
-{
- private static final String PATH_SEPARATOR = "/";
-
- public String getId()
- {
- return "legacy";
- }
-
- public String pathOf( Artifact artifact )
- {
- ArtifactHandler artifactHandler = artifact.getArtifactHandler();
-
- StringBuilder path = new StringBuilder( 128 );
-
- path.append( artifact.getGroupId() ).append( '/' );
- path.append( artifactHandler.getDirectory() ).append( '/' );
- path.append( artifact.getArtifactId() ).append( '-' ).append( artifact.getVersion() );
-
- if ( artifact.hasClassifier() )
- {
- path.append( '-' ).append( artifact.getClassifier() );
- }
-
- if ( artifactHandler.getExtension() != null && artifactHandler.getExtension().length() > 0 )
- {
- path.append( '.' ).append( artifactHandler.getExtension() );
- }
-
- return path.toString();
- }
-
- public String pathOfLocalRepositoryMetadata( ArtifactMetadata metadata,
- ArtifactRepository repository )
- {
- return pathOfRepositoryMetadata( metadata, metadata.getLocalFilename( repository ) );
- }
-
- private String pathOfRepositoryMetadata( ArtifactMetadata metadata,
- String filename )
- {
- StringBuilder path = new StringBuilder( 128 );
-
- path.append( metadata.getGroupId() ).append( PATH_SEPARATOR ).append( "poms" ).append( PATH_SEPARATOR );
-
- path.append( filename );
-
- return path.toString();
- }
-
- public String pathOfRemoteRepositoryMetadata( ArtifactMetadata metadata )
- {
- return pathOfRepositoryMetadata( metadata, metadata.getRemoteFilename() );
- }
-
-}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/LegacyRepositorySystemTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/LegacyRepositorySystemTest.java
deleted file mode 100644
index 96af590c..00000000
--- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/LegacyRepositorySystemTest.java
+++ /dev/null
@@ -1,206 +0,0 @@
-package org.apache.maven.repository;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-
-import java.io.File;
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
-import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
-import org.apache.maven.artifact.resolver.ResolutionErrorHandler;
-import org.apache.maven.execution.DefaultMavenExecutionRequest;
-import org.apache.maven.execution.DefaultMavenExecutionResult;
-import org.apache.maven.execution.MavenSession;
-import org.apache.maven.model.Dependency;
-import org.apache.maven.model.Repository;
-import org.apache.maven.model.RepositoryPolicy;
-import org.apache.maven.plugin.LegacySupport;
-import org.apache.maven.repository.RepositorySystem;
-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;
-
-/**
- * Tests {@link LegacyRepositorySystem}.
- *
- * @author Benjamin Bentmann
- */
-public class LegacyRepositorySystemTest
- extends PlexusTestCase
-{
- private RepositorySystem repositorySystem;
-
- private ResolutionErrorHandler resolutionErrorHandler;
-
- @Override
- protected void customizeContainerConfiguration( ContainerConfiguration containerConfiguration )
- {
- super.customizeContainerConfiguration( containerConfiguration );
- containerConfiguration.setAutoWiring( true );
- containerConfiguration.setClassPathScanning( PlexusConstants.SCANNING_INDEX );
- }
-
- @Override
- protected void setUp()
- throws Exception
- {
- super.setUp();
- repositorySystem = lookup( RepositorySystem.class, "default" );
- resolutionErrorHandler = lookup( ResolutionErrorHandler.class );
- }
-
- @Override
- protected void tearDown()
- throws Exception
- {
- repositorySystem = null;
- resolutionErrorHandler = null;
- super.tearDown();
- }
-
- protected List<ArtifactRepository> getRemoteRepositories()
- throws Exception
- {
- File repoDir = new File( getBasedir(), "src/test/remote-repo" ).getAbsoluteFile();
-
- RepositoryPolicy policy = new RepositoryPolicy();
- policy.setEnabled( true );
- policy.setChecksumPolicy( "ignore" );
- policy.setUpdatePolicy( "always" );
-
- Repository repository = new Repository();
- repository.setId( RepositorySystem.DEFAULT_REMOTE_REPO_ID );
- repository.setUrl( "file://" + repoDir.toURI().getPath() );
- repository.setReleases( policy );
- repository.setSnapshots( policy );
-
- return Arrays.asList( repositorySystem.buildArtifactRepository( repository ) );
- }
-
- protected ArtifactRepository getLocalRepository()
- throws Exception
- {
- File repoDir = new File( getBasedir(), "target/local-repo" ).getAbsoluteFile();
-
- return repositorySystem.createLocalRepository( repoDir );
- }
-
- public void testThatASystemScopedDependencyIsNotResolvedFromRepositories()
- throws Exception
- {
- //
- // We should get a whole slew of dependencies resolving this artifact transitively
- //
- Dependency d = new Dependency();
- d.setGroupId( "org.apache.maven.its" );
- d.setArtifactId( "b" );
- d.setVersion( "0.1" );
- d.setScope( Artifact.SCOPE_COMPILE );
- Artifact artifact = repositorySystem.createDependencyArtifact( d );
-
- ArtifactResolutionRequest request = new ArtifactResolutionRequest()
- .setArtifact( artifact )
- .setResolveRoot( true )
- .setResolveTransitively( true )
- .setRemoteRepositories( getRemoteRepositories() )
- .setLocalRepository( getLocalRepository() );
-
- DefaultRepositorySystemSession session = new DefaultRepositorySystemSession();
- LocalRepository localRepo = new LocalRepository( request.getLocalRepository().getBasedir() );
- session.setLocalRepositoryManager( new SimpleLocalRepositoryManagerFactory().newInstance( session, localRepo ) );
- LegacySupport legacySupport = lookup( LegacySupport.class );
- legacySupport.setSession( new MavenSession( getContainer(), session, new DefaultMavenExecutionRequest(),
- new DefaultMavenExecutionResult() ) );
-
- ArtifactResolutionResult result = repositorySystem.resolve( request );
- resolutionErrorHandler.throwErrors( request, result );
- assertEquals( 2, result.getArtifacts().size() );
-
- //
- // System scoped version which should
- //
- d.setScope( Artifact.SCOPE_SYSTEM );
- File file = new File( getBasedir(), "src/test/repository-system/maven-core-2.1.0.jar" );
- assertTrue( file.exists() );
- d.setSystemPath( file.getCanonicalPath() );
-
- artifact = repositorySystem.createDependencyArtifact( d );
-
- //
- // The request has not set any local or remote repositories as the system scoped dependency being resolved should only
- // give us the dependency off the disk and nothing more.
- //
- request = new ArtifactResolutionRequest()
- .setArtifact( artifact )
- .setResolveRoot( true )
- .setResolveTransitively( true );
-
- result = repositorySystem.resolve( request );
- resolutionErrorHandler.throwErrors( request, result );
- assertEquals( 1, result.getArtifacts().size() );
-
- //
- // Put in a bogus file to make sure missing files cause the resolution to fail.
- //
- file = new File( getBasedir(), "src/test/repository-system/maven-monkey-2.1.0.jar" );
- assertFalse( file.exists() );
- d.setSystemPath( file.getCanonicalPath() );
- artifact = repositorySystem.createDependencyArtifact( d );
-
- //
- // The request has not set any local or remote repositories as the system scoped dependency being resolved should only
- // give us the dependency off the disk and nothing more.
- //
- request = new ArtifactResolutionRequest()
- .setArtifact( artifact )
- .setResolveRoot( true )
- .setResolveTransitively( true );
-
- try
- {
- result = repositorySystem.resolve( request );
- resolutionErrorHandler.throwErrors( request, result );
- }
- catch( Exception e )
- {
- assertTrue( result.hasMissingArtifacts() );
- }
- }
-
- public void testLocalRepositoryBasedir()
- throws Exception
- {
- File localRepoDir = new File( "" ).getAbsoluteFile();
-
- ArtifactRepository localRepo = repositorySystem.createLocalRepository( localRepoDir );
-
- String basedir = localRepo.getBasedir();
-
- assertFalse( basedir.endsWith( "/" ) );
- assertFalse( basedir.endsWith( "\\" ) );
-
- assertEquals( localRepoDir, new File( basedir ) );
-
- assertEquals( localRepoDir.getPath(), basedir );
- }
-
-}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/MirrorProcessorTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/MirrorProcessorTest.java
deleted file mode 100644
index 57645750..00000000
--- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/MirrorProcessorTest.java
+++ /dev/null
@@ -1,259 +0,0 @@
-package org.apache.maven.repository;
-
-/*
- * 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.List;
-
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.repository.legacy.repository.ArtifactRepositoryFactory;
-import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
-import org.apache.maven.settings.Mirror;
-import org.codehaus.plexus.PlexusTestCase;
-
-public class MirrorProcessorTest
- extends PlexusTestCase
-{
- private DefaultMirrorSelector mirrorSelector;
- private ArtifactRepositoryFactory repositorySystem;
-
- protected void setUp()
- throws Exception
- {
- mirrorSelector = (DefaultMirrorSelector) lookup( MirrorSelector.class );
- repositorySystem = lookup( ArtifactRepositoryFactory.class );
- }
-
- @Override
- protected void tearDown()
- throws Exception
- {
- mirrorSelector = null;
- repositorySystem = null;
-
- super.tearDown();
- }
-
- public void testExternalURL()
- {
- assertTrue( DefaultMirrorSelector.isExternalRepo( getRepo( "foo", "http://somehost" ) ) );
- assertTrue( DefaultMirrorSelector.isExternalRepo( getRepo( "foo", "http://somehost:9090/somepath" ) ) );
- assertTrue( DefaultMirrorSelector.isExternalRepo( getRepo( "foo", "ftp://somehost" ) ) );
- assertTrue( DefaultMirrorSelector.isExternalRepo( getRepo( "foo", "http://192.168.101.1" ) ) );
- assertTrue( DefaultMirrorSelector.isExternalRepo( getRepo( "foo", "http://" ) ) );
- // these are local
- assertFalse( DefaultMirrorSelector.isExternalRepo( getRepo( "foo", "http://localhost:8080" ) ) );
- assertFalse( DefaultMirrorSelector.isExternalRepo( getRepo( "foo", "http://127.0.0.1:9090" ) ) );
- assertFalse( DefaultMirrorSelector.isExternalRepo( getRepo( "foo", "file://localhost/somepath" ) ) );
- assertFalse( DefaultMirrorSelector.isExternalRepo( getRepo( "foo", "file://localhost/D:/somepath" ) ) );
- assertFalse( DefaultMirrorSelector.isExternalRepo( getRepo( "foo", "http://localhost" ) ) );
- assertFalse( DefaultMirrorSelector.isExternalRepo( getRepo( "foo", "http://127.0.0.1" ) ) );
- assertFalse( DefaultMirrorSelector.isExternalRepo( getRepo( "foo", "file:///somepath" ) ) );
- assertFalse( DefaultMirrorSelector.isExternalRepo( getRepo( "foo", "file://D:/somepath" ) ) );
-
- // not a proper url so returns false;
- assertFalse( DefaultMirrorSelector.isExternalRepo( getRepo( "foo", "192.168.101.1" ) ) );
- assertFalse( DefaultMirrorSelector.isExternalRepo( getRepo( "foo", "" ) ) );
- }
-
- public void testMirrorLookup()
- {
- Mirror mirrorA = newMirror( "a", "a", "http://a" );
- Mirror mirrorB = newMirror( "b", "b", "http://b" );
-
- List<Mirror> mirrors = Arrays.asList( mirrorA, mirrorB );
-
- assertSame( mirrorA, mirrorSelector.getMirror( getRepo( "a", "http://a.a" ), mirrors ) );
-
- assertSame( mirrorB, mirrorSelector.getMirror( getRepo( "b", "http://a.a" ), mirrors ) );
-
- assertNull( mirrorSelector.getMirror( getRepo( "c", "http://c.c" ), mirrors ) );
- }
-
- public void testMirrorWildcardLookup()
- {
- Mirror mirrorA = newMirror( "a", "a", "http://a" );
- Mirror mirrorB = newMirror( "b", "b", "http://b" );
- Mirror mirrorC = newMirror( "c", "*", "http://wildcard" );
-
- List<Mirror> mirrors = Arrays.asList( mirrorA, mirrorB, mirrorC );
-
- assertSame( mirrorA, mirrorSelector.getMirror( getRepo( "a", "http://a.a" ), mirrors ) );
-
- assertSame( mirrorB, mirrorSelector.getMirror( getRepo( "b", "http://a.a" ), mirrors ) );
-
- assertSame( mirrorC, mirrorSelector.getMirror( getRepo( "c", "http://c.c" ), mirrors ) );
- }
-
- public void testMirrorStopOnFirstMatch()
- {
- // exact matches win first
- Mirror mirrorA2 = newMirror( "a2", "a,b", "http://a2" );
- Mirror mirrorA = newMirror( "a", "a", "http://a" );
- // make sure repeated entries are skipped
- Mirror mirrorA3 = newMirror( "a", "a", "http://a3" );
-
- Mirror mirrorB = newMirror( "b", "b", "http://b" );
- Mirror mirrorC = newMirror( "c", "d,e", "http://de" );
- Mirror mirrorC2 = newMirror( "c", "*", "http://wildcard" );
- Mirror mirrorC3 = newMirror( "c", "e,f", "http://ef" );
-
- List<Mirror> mirrors = Arrays.asList( mirrorA2, mirrorA, mirrorA3, mirrorB, mirrorC, mirrorC2, mirrorC3 );
-
- assertSame( mirrorA, mirrorSelector.getMirror( getRepo( "a", "http://a.a" ), mirrors ) );
-
- assertSame( mirrorB, mirrorSelector.getMirror( getRepo( "b", "http://a.a" ), mirrors ) );
-
- assertSame( mirrorC2, mirrorSelector.getMirror( getRepo( "c", "http://c.c" ), mirrors ) );
-
- assertSame( mirrorC, mirrorSelector.getMirror( getRepo( "d", "http://d" ), mirrors ) );
-
- assertSame( mirrorC, mirrorSelector.getMirror( getRepo( "e", "http://e" ), mirrors ) );
-
- assertSame( mirrorC2, mirrorSelector.getMirror( getRepo( "f", "http://f" ), mirrors ) );
- }
-
- public void testPatterns()
- {
- assertTrue( DefaultMirrorSelector.matchPattern( getRepo( "a" ), "*" ) );
- assertTrue( DefaultMirrorSelector.matchPattern( getRepo( "a" ), "*," ) );
- assertTrue( DefaultMirrorSelector.matchPattern( getRepo( "a" ), ",*," ) );
- assertTrue( DefaultMirrorSelector.matchPattern( getRepo( "a" ), "*," ) );
-
- assertTrue( DefaultMirrorSelector.matchPattern( getRepo( "a" ), "a" ) );
- assertTrue( DefaultMirrorSelector.matchPattern( getRepo( "a" ), "a," ) );
- assertTrue( DefaultMirrorSelector.matchPattern( getRepo( "a" ), ",a," ) );
- assertTrue( DefaultMirrorSelector.matchPattern( getRepo( "a" ), "a," ) );
-
- assertFalse( DefaultMirrorSelector.matchPattern( getRepo( "b" ), "a" ) );
- assertFalse( DefaultMirrorSelector.matchPattern( getRepo( "b" ), "a," ) );
- assertFalse( DefaultMirrorSelector.matchPattern( getRepo( "b" ), ",a" ) );
- assertFalse( DefaultMirrorSelector.matchPattern( getRepo( "b" ), ",a," ) );
-
- assertTrue( DefaultMirrorSelector.matchPattern( getRepo( "a" ), "a,b" ) );
- assertTrue( DefaultMirrorSelector.matchPattern( getRepo( "b" ), "a,b" ) );
-
- assertFalse( DefaultMirrorSelector.matchPattern( getRepo( "c" ), "a,b" ) );
-
- assertTrue( DefaultMirrorSelector.matchPattern( getRepo( "a" ), "*" ) );
- assertTrue( DefaultMirrorSelector.matchPattern( getRepo( "a" ), "*,b" ) );
- assertTrue( DefaultMirrorSelector.matchPattern( getRepo( "a" ), "*,!b" ) );
-
- assertFalse( DefaultMirrorSelector.matchPattern( getRepo( "a" ), "*,!a" ) );
- assertFalse( DefaultMirrorSelector.matchPattern( getRepo( "a" ), "!a,*" ) );
-
- assertTrue( DefaultMirrorSelector.matchPattern( getRepo( "c" ), "*,!a" ) );
- assertTrue( DefaultMirrorSelector.matchPattern( getRepo( "c" ), "!a,*" ) );
-
- assertFalse( DefaultMirrorSelector.matchPattern( getRepo( "c" ), "!a,!c" ) );
- assertFalse( DefaultMirrorSelector.matchPattern( getRepo( "d" ), "!a,!c*" ) );
- }
-
- public void testPatternsWithExternal()
- {
- assertTrue( DefaultMirrorSelector.matchPattern( getRepo( "a", "http://localhost" ), "*" ) );
- assertFalse( DefaultMirrorSelector.matchPattern( getRepo( "a", "http://localhost" ), "external:*" ) );
-
- assertTrue( DefaultMirrorSelector.matchPattern( getRepo( "a", "http://localhost" ), "external:*,a" ) );
- assertFalse( DefaultMirrorSelector.matchPattern( getRepo( "a", "http://localhost" ), "external:*,!a" ) );
- assertTrue( DefaultMirrorSelector.matchPattern( getRepo( "a", "http://localhost" ), "a,external:*" ) );
- assertFalse( DefaultMirrorSelector.matchPattern( getRepo( "a", "http://localhost" ), "!a,external:*" ) );
-
- assertFalse( DefaultMirrorSelector.matchPattern( getRepo( "c", "http://localhost" ), "!a,external:*" ) );
- assertTrue( DefaultMirrorSelector.matchPattern( getRepo( "c", "http://somehost" ), "!a,external:*" ) );
- }
-
- public void testLayoutPattern()
- {
- assertTrue( DefaultMirrorSelector.matchesLayout( "default", null ) );
- assertTrue( DefaultMirrorSelector.matchesLayout( "default", "" ) );
- assertTrue( DefaultMirrorSelector.matchesLayout( "default", "*" ) );
-
- assertTrue( DefaultMirrorSelector.matchesLayout( "default", "default" ) );
- assertFalse( DefaultMirrorSelector.matchesLayout( "default", "legacy" ) );
-
- assertTrue( DefaultMirrorSelector.matchesLayout( "default", "legacy,default" ) );
- assertTrue( DefaultMirrorSelector.matchesLayout( "default", "default,legacy" ) );
-
- assertFalse( DefaultMirrorSelector.matchesLayout( "default", "legacy,!default" ) );
- assertFalse( DefaultMirrorSelector.matchesLayout( "default", "!default,legacy" ) );
-
- assertFalse( DefaultMirrorSelector.matchesLayout( "default", "*,!default" ) );
- assertFalse( DefaultMirrorSelector.matchesLayout( "default", "!default,*" ) );
- }
-
- public void testMirrorLayoutConsideredForMatching()
- {
- ArtifactRepository repo = getRepo( "a" );
-
- Mirror mirrorA = newMirror( "a", "a", null, "http://a" );
- Mirror mirrorB = newMirror( "b", "a", "p2", "http://b" );
-
- Mirror mirrorC = newMirror( "c", "*", null, "http://c" );
- Mirror mirrorD = newMirror( "d", "*", "p2", "http://d" );
-
- assertSame( mirrorA, mirrorSelector.getMirror( repo, Arrays.asList( mirrorA ) ) );
- assertNull( mirrorSelector.getMirror( repo, Arrays.asList( mirrorB ) ) );
-
- assertSame( mirrorC, mirrorSelector.getMirror( repo, Arrays.asList( mirrorC ) ) );
- assertNull( mirrorSelector.getMirror( repo, Arrays.asList( mirrorD ) ) );
- }
-
- /**
- * Build an ArtifactRepository object.
- *
- * @param id
- * @param url
- * @return
- */
- private ArtifactRepository getRepo( String id, String url )
- {
- return repositorySystem.createArtifactRepository( id, url, new DefaultRepositoryLayout(), null, null );
- }
-
- /**
- * Build an ArtifactRepository object.
- *
- * @param id
- * @return
- */
- private ArtifactRepository getRepo( String id )
- {
- return getRepo( id, "http://something" );
- }
-
- private Mirror newMirror( String id, String mirrorOf, String url )
- {
- return newMirror( id, mirrorOf, null, url );
- }
-
- private Mirror newMirror( String id, String mirrorOf, String layouts, String url )
- {
- Mirror mirror = new Mirror();
-
- mirror.setId( id );
- mirror.setMirrorOf( mirrorOf );
- mirror.setMirrorOfLayouts( layouts );
- mirror.setUrl( url );
-
- return mirror;
- }
-
-}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/DefaultUpdateCheckManagerTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/DefaultUpdateCheckManagerTest.java
deleted file mode 100644
index 1c5f34c3..00000000
--- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/DefaultUpdateCheckManagerTest.java
+++ /dev/null
@@ -1,240 +0,0 @@
-package org.apache.maven.repository.legacy;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.File;
-
-import org.apache.maven.artifact.AbstractArtifactComponentTestCase;
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.factory.ArtifactFactory;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata;
-import org.apache.maven.artifact.repository.metadata.RepositoryMetadata;
-import org.apache.maven.repository.legacy.DefaultUpdateCheckManager;
-import org.codehaus.plexus.logging.Logger;
-import org.codehaus.plexus.logging.console.ConsoleLogger;
-
-public class DefaultUpdateCheckManagerTest
- extends AbstractArtifactComponentTestCase
-{
-
- DefaultUpdateCheckManager updateCheckManager;
-
- @Override
- protected String component()
- {
- return "updateCheckManager";
- }
-
- @Override
- protected void setUp()
- throws Exception
- {
- super.setUp();
-
- updateCheckManager = new DefaultUpdateCheckManager( new ConsoleLogger( Logger.LEVEL_DEBUG, "test" ) );
- }
-
- public void testArtifact() throws Exception
- {
- ArtifactRepository remoteRepository = remoteRepository();
-
- ArtifactRepository localRepository = localRepository();
-
- Artifact a = createArtifact( "a", "0.0.1-SNAPSHOT" );
- File file = new File( localRepository.getBasedir(),
- localRepository.pathOf( a ) );
- file.delete();
- a.setFile( file );
-
- File touchFile = updateCheckManager.getTouchfile( a );
- touchFile.delete();
-
- assertTrue( updateCheckManager.isUpdateRequired( a, remoteRepository ) );
-
- file.getParentFile().mkdirs();
- file.createNewFile();
- updateCheckManager.touch( a, remoteRepository, null );
-
- assertFalse( updateCheckManager.isUpdateRequired( a, remoteRepository ) );
-
- assertNull( updateCheckManager.readLastUpdated( touchFile,
- updateCheckManager.getRepositoryKey( remoteRepository ) ) );
-
- assertFalse( updateCheckManager.getTouchfile( a ).exists() );
- }
-
- public void testMissingArtifact()
- throws Exception
- {
- ArtifactRepository remoteRepository = remoteRepository();
-
- ArtifactRepository localRepository = localRepository();
-
- Artifact a = createArtifact( "a", "0.0.1-SNAPSHOT" );
- File file = new File( localRepository.getBasedir(),
- localRepository.pathOf( a ) );
- file.delete();
- a.setFile( file );
-
- File touchFile = updateCheckManager.getTouchfile( a );
- touchFile.delete();
-
- assertTrue( updateCheckManager.isUpdateRequired( a, remoteRepository ) );
-
- updateCheckManager.touch( a, remoteRepository, null );
-
- assertFalse( updateCheckManager.isUpdateRequired( a, remoteRepository ) );
-
- assertFalse( file.exists() );
- assertNotNull( updateCheckManager.readLastUpdated( touchFile,
- updateCheckManager.getRepositoryKey( remoteRepository ) ) );
- }
-
- public void testPom() throws Exception
- {
- ArtifactRepository remoteRepository = remoteRepository();
-
- ArtifactRepository localRepository = localRepository();
-
- Artifact a = createArtifact( "a", "0.0.1", "pom" );
- File file = new File( localRepository.getBasedir(),
- localRepository.pathOf( a ) );
- file.delete();
- a.setFile( file );
-
- File touchFile = updateCheckManager.getTouchfile( a );
- touchFile.delete();
-
- assertTrue( updateCheckManager.isUpdateRequired( a, remoteRepository ) );
-
- file.getParentFile().mkdirs();
- file.createNewFile();
- updateCheckManager.touch( a, remoteRepository, null );
-
- assertFalse( updateCheckManager.isUpdateRequired( a, remoteRepository ) );
-
- assertNull( updateCheckManager.readLastUpdated( touchFile,
- updateCheckManager.getRepositoryKey( remoteRepository ) ) );
-
- assertFalse( updateCheckManager.getTouchfile( a ).exists() );
- }
-
- public void testMissingPom()
- throws Exception
- {
- ArtifactRepository remoteRepository = remoteRepository();
-
- ArtifactRepository localRepository = localRepository();
-
- Artifact a = createArtifact( "a", "0.0.1", "pom" );
- File file = new File( localRepository.getBasedir(),
- localRepository.pathOf( a ) );
- file.delete();
- a.setFile( file );
-
- File touchFile = updateCheckManager.getTouchfile( a );
- touchFile.delete();
-
- assertTrue( updateCheckManager.isUpdateRequired( a, remoteRepository ) );
-
- updateCheckManager.touch( a, remoteRepository, null );
-
- assertFalse( updateCheckManager.isUpdateRequired( a, remoteRepository ) );
-
- assertFalse( file.exists() );
- assertNotNull( updateCheckManager.readLastUpdated( touchFile,
- updateCheckManager.getRepositoryKey( remoteRepository ) ) );
- }
-
- public void testMetadata() throws Exception
- {
- ArtifactRepository remoteRepository = remoteRepository();
-
- ArtifactRepository localRepository = localRepository();
-
- Artifact a = createRemoteArtifact( "a", "0.0.1-SNAPSHOT" );
- RepositoryMetadata metadata = new ArtifactRepositoryMetadata( a );
-
- File file = new File( localRepository.getBasedir(),
- localRepository.pathOfLocalRepositoryMetadata( metadata, localRepository ) );
- file.delete();
-
- File touchFile = updateCheckManager.getTouchfile( metadata, file );
- touchFile.delete();
-
- assertTrue( updateCheckManager.isUpdateRequired( metadata, remoteRepository, file ) );
-
- file.getParentFile().mkdirs();
- file.createNewFile();
- updateCheckManager.touch( metadata, remoteRepository, file );
-
- assertFalse( updateCheckManager.isUpdateRequired( metadata, remoteRepository, file ) );
-
- assertNotNull( updateCheckManager.readLastUpdated( touchFile, updateCheckManager.getMetadataKey( remoteRepository, file ) ) );
- }
-
- public void testMissingMetadata() throws Exception
- {
- ArtifactRepository remoteRepository = remoteRepository();
-
- ArtifactRepository localRepository = localRepository();
-
- Artifact a = createRemoteArtifact( "a", "0.0.1-SNAPSHOT" );
- RepositoryMetadata metadata = new ArtifactRepositoryMetadata( a );
-
- File file = new File( localRepository.getBasedir(),
- localRepository.pathOfLocalRepositoryMetadata( metadata, localRepository ) );
- file.delete();
-
- File touchFile = updateCheckManager.getTouchfile( metadata, file );
- touchFile.delete();
-
- assertTrue( updateCheckManager.isUpdateRequired( metadata, remoteRepository, file ) );
-
- updateCheckManager.touch( metadata, remoteRepository, file );
-
- assertFalse( updateCheckManager.isUpdateRequired( metadata, remoteRepository, file ) );
-
- assertNotNull( updateCheckManager.readLastUpdated( touchFile, updateCheckManager.getMetadataKey( remoteRepository, file ) ) );
- }
-
- public void testArtifactTouchFileName() throws Exception
- {
- ArtifactFactory artifactFactory = (ArtifactFactory) lookup( ArtifactFactory.ROLE );
-
- ArtifactRepository localRepository = localRepository();
-
- Artifact a = artifactFactory.createArtifactWithClassifier( "groupdId", "a", "0.0.1-SNAPSHOT", "jar", null );
- File file = new File( localRepository.getBasedir(),
- localRepository.pathOf( a ) );
- a.setFile( file );
-
- assertEquals( "a-0.0.1-SNAPSHOT.jar.lastUpdated", updateCheckManager.getTouchfile( a ).getName() );
-
- a = artifactFactory.createArtifactWithClassifier( "groupdId", "a", "0.0.1-SNAPSHOT", "jar", "classifier" );
- file = new File( localRepository.getBasedir(),
- localRepository.pathOf( a ) );
- a.setFile( file );
-
- assertEquals( "a-0.0.1-SNAPSHOT-classifier.jar.lastUpdated", updateCheckManager.getTouchfile( a ).getName() );
- }
-
-}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/DefaultWagonManagerTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/DefaultWagonManagerTest.java
deleted file mode 100644
index 068c0e0a..00000000
--- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/DefaultWagonManagerTest.java
+++ /dev/null
@@ -1,422 +0,0 @@
-package org.apache.maven.repository.legacy;
-
-/*
- * 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.ArrayList;
-import java.util.List;
-
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.DefaultArtifact;
-import org.apache.maven.artifact.factory.ArtifactFactory;
-import org.apache.maven.artifact.metadata.ArtifactMetadata;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.repository.legacy.repository.ArtifactRepositoryFactory;
-import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
-import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
-import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
-import org.apache.maven.artifact.versioning.VersionRange;
-import org.apache.maven.wagon.ResourceDoesNotExistException;
-import org.apache.maven.wagon.TransferFailedException;
-import org.apache.maven.wagon.UnsupportedProtocolException;
-import org.apache.maven.wagon.Wagon;
-import org.apache.maven.wagon.authorization.AuthorizationException;
-import org.apache.maven.wagon.events.TransferEvent;
-import org.apache.maven.wagon.events.TransferListener;
-import org.apache.maven.wagon.observers.AbstractTransferListener;
-import org.apache.maven.wagon.observers.Debug;
-import org.codehaus.plexus.PlexusTestCase;
-import org.codehaus.plexus.util.FileUtils;
-
-/**
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- */
-public class DefaultWagonManagerTest
- extends PlexusTestCase
-{
- private DefaultWagonManager wagonManager;
-
- private TransferListener transferListener = new Debug();
-
- private ArtifactFactory artifactFactory;
-
- private ArtifactRepositoryFactory artifactRepositoryFactory;
-
- protected void setUp()
- throws Exception
- {
- super.setUp();
- wagonManager = (DefaultWagonManager) lookup( WagonManager.class );
- artifactFactory = lookup( ArtifactFactory.class );
- artifactRepositoryFactory = lookup( ArtifactRepositoryFactory.class );
- }
-
- @Override
- protected void tearDown()
- throws Exception
- {
- wagonManager = null;
- artifactFactory = null;
- super.tearDown();
- }
-
- public void testUnnecessaryRepositoryLookup()
- throws Exception
- {
- Artifact artifact = createTestPomArtifact( "target/test-data/get-missing-pom" );
-
- List<ArtifactRepository> repos = new ArrayList<ArtifactRepository>();
- repos.add( artifactRepositoryFactory.createArtifactRepository( "repo1", "string://url1",
- new ArtifactRepositoryLayoutStub(), null, null ) );
- repos.add( artifactRepositoryFactory.createArtifactRepository( "repo2", "string://url2",
- new ArtifactRepositoryLayoutStub(), null, null ) );
-
- StringWagon wagon = (StringWagon) wagonManager.getWagon( "string" );
- wagon.addExpectedContent( repos.get( 0 ).getLayout().pathOf( artifact ), "expected" );
- wagon.addExpectedContent( repos.get( 1 ).getLayout().pathOf( artifact ), "expected" );
-
- class TransferListener
- extends AbstractTransferListener
- {
- public List<TransferEvent> events = new ArrayList<TransferEvent>();
-
- @Override
- public void transferInitiated( TransferEvent transferEvent )
- {
- events.add( transferEvent );
- }
- }
-
- TransferListener listener = new TransferListener();
- wagonManager.getArtifact( artifact, repos, listener, false );
- assertEquals( 1, listener.events.size() );
- }
-
- public void testGetMissingJar() throws TransferFailedException, UnsupportedProtocolException, IOException
- {
- Artifact artifact = createTestArtifact( "target/test-data/get-missing-jar", "jar" );
-
- ArtifactRepository repo = createStringRepo();
-
- try
- {
- wagonManager.getArtifact( artifact, repo, null, false );
-
- fail();
- }
- catch ( ResourceDoesNotExistException e )
- {
- assertTrue( true );
- }
-
- assertFalse( artifact.getFile().exists() );
- }
-
- public void testGetMissingJarForced() throws TransferFailedException, UnsupportedProtocolException, IOException
- {
- Artifact artifact = createTestArtifact( "target/test-data/get-missing-jar", "jar" );
-
- ArtifactRepository repo = createStringRepo();
-
- try
- {
- wagonManager.getArtifact( artifact, repo, null, false );
-
- fail();
- }
- catch ( ResourceDoesNotExistException e )
- {
- assertTrue( true );
- }
-
- assertFalse( artifact.getFile().exists() );
- }
-
- public void testGetRemoteJar()
- throws TransferFailedException, ResourceDoesNotExistException, UnsupportedProtocolException, IOException,
- AuthorizationException
- {
- Artifact artifact = createTestArtifact( "target/test-data/get-remote-jar", "jar" );
-
- ArtifactRepository repo = createStringRepo();
-
- StringWagon wagon = (StringWagon) wagonManager.getWagon( "string" );
- wagon.addExpectedContent( repo.getLayout().pathOf( artifact ), "expected" );
-
- wagonManager.getArtifact( artifact, repo, null, false );
-
- assertTrue( artifact.getFile().exists() );
- assertEquals( "expected", FileUtils.fileRead( artifact.getFile(), "UTF-8" ) );
- }
-
- private Artifact createTestPomArtifact( String directory )
- throws IOException
- {
- File testData = getTestFile( directory );
- FileUtils.deleteDirectory( testData );
- testData.mkdirs();
-
- Artifact artifact = artifactFactory.createProjectArtifact( "test", "test", "1.0" );
- artifact.setFile( new File( testData, "test-1.0.pom" ) );
- assertFalse( artifact.getFile().exists() );
- return artifact;
- }
-
- private Artifact createTestArtifact( String directory, String type )
- throws IOException
- {
- return createTestArtifact( directory, "1.0", type );
- }
-
- private Artifact createTestArtifact( String directory, String version, String type )
- throws IOException
- {
- File testData = getTestFile( directory );
- FileUtils.deleteDirectory( testData );
- testData.mkdirs();
-
- Artifact artifact = artifactFactory.createBuildArtifact( "test", "test", version, type );
- artifact.setFile( new File( testData, "test-" + version + "." + artifact.getArtifactHandler().getExtension() ) );
- assertFalse( artifact.getFile().exists() );
- return artifact;
- }
-
- private ArtifactRepository createStringRepo()
- {
- return artifactRepositoryFactory.createArtifactRepository( "id", "string://url", new ArtifactRepositoryLayoutStub(), null, null );
- }
-
- /**
- * Build an ArtifactRepository object.
- *
- * @param id
- * @param url
- * @return
- */
- private ArtifactRepository getRepo( String id, String url )
- {
- return artifactRepositoryFactory.createArtifactRepository( id, url, new DefaultRepositoryLayout(), null, null );
- }
-
- /**
- * Build an ArtifactRepository object.
- *
- * @param id
- * @return
- */
- private ArtifactRepository getRepo( String id )
- {
- return getRepo( id, "http://something" );
- }
-
- public void testDefaultWagonManager()
- throws Exception
- {
- assertWagon( "a" );
-
- assertWagon( "b" );
-
- assertWagon( "c" );
-
- assertWagon( "string" );
-
- try
- {
- assertWagon( "d" );
-
- fail( "Expected :" + UnsupportedProtocolException.class.getName() );
- }
- catch ( UnsupportedProtocolException e )
- {
- // ok
- assertTrue( true );
- }
- }
-
- /**
- * Check that transfer listeners are properly removed after getArtifact and putArtifact
- */
- public void testWagonTransferListenerRemovedAfterGetArtifactAndPutArtifact()
- throws Exception
- {
- Artifact artifact = createTestArtifact( "target/test-data/transfer-listener", "jar" );
- ArtifactRepository repo = createStringRepo();
- StringWagon wagon = (StringWagon) wagonManager.getWagon( "string" );
- wagon.addExpectedContent( repo.getLayout().pathOf( artifact ), "expected" );
-
- /* getArtifact */
- assertFalse( "Transfer listener is registered before test",
- wagon.getTransferEventSupport().hasTransferListener( transferListener ) );
- wagonManager.getArtifact( artifact, repo, transferListener, false );
- assertFalse( "Transfer listener still registered after getArtifact",
- wagon.getTransferEventSupport().hasTransferListener( transferListener ) );
-
- /* putArtifact */
- File sampleFile = getTestFile( "target/test-file" );
- FileUtils.fileWrite( sampleFile.getAbsolutePath(), "sample file" );
-
- assertFalse( "Transfer listener is registered before test", wagon.getTransferEventSupport().hasTransferListener( transferListener ) );
- wagonManager.putArtifact( sampleFile, artifact, repo, transferListener );
- assertFalse( "Transfer listener still registered after putArtifact", wagon.getTransferEventSupport().hasTransferListener( transferListener ) );
- }
-
- /**
- * Checks the verification of checksums.
- */
- public void xtestChecksumVerification()
- throws Exception
- {
- ArtifactRepositoryPolicy policy = new ArtifactRepositoryPolicy( true, ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS, ArtifactRepositoryPolicy.CHECKSUM_POLICY_FAIL );
-
- ArtifactRepository repo = artifactRepositoryFactory.createArtifactRepository( "id", "string://url", new ArtifactRepositoryLayoutStub(), policy, policy );
-
- Artifact artifact =
- new DefaultArtifact( "sample.group", "sample-art", VersionRange.createFromVersion( "1.0" ), "scope",
- "jar", "classifier", null );
- artifact.setFile( getTestFile( "target/sample-art" ) );
-
- StringWagon wagon = (StringWagon) wagonManager.getWagon( "string" );
-
- wagon.clearExpectedContent();
- wagon.addExpectedContent( "path", "lower-case-checksum" );
- wagon.addExpectedContent( "path.sha1", "2a25dc564a3b34f68237fc849066cbc7bb7a36a1" );
-
- try
- {
- wagonManager.getArtifact( artifact, repo, null, false );
- }
- catch ( ChecksumFailedException e )
- {
- fail( "Checksum verification did not pass: " + e.getMessage() );
- }
-
- wagon.clearExpectedContent();
- wagon.addExpectedContent( "path", "upper-case-checksum" );
- wagon.addExpectedContent( "path.sha1", "B7BB97D7D0B9244398D9B47296907F73313663E6" );
-
- try
- {
- wagonManager.getArtifact( artifact, repo, null, false );
- }
- catch ( ChecksumFailedException e )
- {
- fail( "Checksum verification did not pass: " + e.getMessage() );
- }
-
- wagon.clearExpectedContent();
- wagon.addExpectedContent( "path", "expected-failure" );
- wagon.addExpectedContent( "path.sha1", "b7bb97d7d0b9244398d9b47296907f73313663e6" );
-
- try
- {
- wagonManager.getArtifact( artifact, repo, null, false );
- fail( "Checksum verification did not fail" );
- }
- catch ( ChecksumFailedException e )
- {
- // expected
- }
-
- wagon.clearExpectedContent();
- wagon.addExpectedContent( "path", "lower-case-checksum" );
- wagon.addExpectedContent( "path.md5", "50b2cf50a103a965efac62b983035cac" );
-
- try
- {
- wagonManager.getArtifact( artifact, repo, null, false );
- }
- catch ( ChecksumFailedException e )
- {
- fail( "Checksum verification did not pass: " + e.getMessage() );
- }
-
- wagon.clearExpectedContent();
- wagon.addExpectedContent( "path", "upper-case-checksum" );
- wagon.addExpectedContent( "path.md5", "842F568FCCFEB7E534DC72133D42FFDC" );
-
- try
- {
- wagonManager.getArtifact( artifact, repo, null, false );
- }
- catch ( ChecksumFailedException e )
- {
- fail( "Checksum verification did not pass: " + e.getMessage() );
- }
-
- wagon.clearExpectedContent();
- wagon.addExpectedContent( "path", "expected-failure" );
- wagon.addExpectedContent( "path.md5", "b7bb97d7d0b9244398d9b47296907f73313663e6" );
-
- try
- {
- wagonManager.getArtifact( artifact, repo, null, false );
- fail( "Checksum verification did not fail" );
- }
- catch ( ChecksumFailedException e )
- {
- // expected
- }
- }
-
- public void testPerLookupInstantiation()
- throws Exception
- {
- String protocol = "perlookup";
-
- Wagon one = wagonManager.getWagon( protocol );
- Wagon two = wagonManager.getWagon( protocol );
-
- assertNotSame( one, two );
- }
-
- private void assertWagon( String protocol )
- throws Exception
- {
- Wagon wagon = wagonManager.getWagon( protocol );
-
- assertNotNull( "Check wagon, protocol=" + protocol, wagon );
- }
-
- private final class ArtifactRepositoryLayoutStub
- implements ArtifactRepositoryLayout
- {
- public String getId()
- {
- return "test";
- }
-
- public String pathOfRemoteRepositoryMetadata( ArtifactMetadata metadata )
- {
- return "path";
- }
-
- public String pathOfLocalRepositoryMetadata( ArtifactMetadata metadata, ArtifactRepository repository )
- {
- return "path";
- }
-
- public String pathOf( Artifact artifact )
- {
- return "path";
- }
- }
-
-}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/LegacyRepositorySystemTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/LegacyRepositorySystemTest.java
deleted file mode 100644
index f34c05fb..00000000
--- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/LegacyRepositorySystemTest.java
+++ /dev/null
@@ -1,88 +0,0 @@
-package org.apache.maven.repository.legacy;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-
-import java.io.File;
-import java.util.Arrays;
-
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.repository.Authentication;
-import org.apache.maven.repository.RepositorySystem;
-import org.apache.maven.settings.Server;
-import org.codehaus.plexus.ContainerConfiguration;
-import org.codehaus.plexus.PlexusConstants;
-import org.codehaus.plexus.PlexusTestCase;
-
-/**
- * Tests {@link LegacyRepositorySystem}.
- *
- * @author Benjamin Bentmann
- */
-public class LegacyRepositorySystemTest
- extends PlexusTestCase
-{
- private RepositorySystem repositorySystem;
-
- @Override
- protected void customizeContainerConfiguration( ContainerConfiguration containerConfiguration )
- {
- super.customizeContainerConfiguration( containerConfiguration );
- containerConfiguration.setAutoWiring( true );
- containerConfiguration.setClassPathScanning( PlexusConstants.SCANNING_INDEX );
- }
-
- @Override
- protected void setUp()
- throws Exception
- {
- super.setUp();
- repositorySystem = lookup( RepositorySystem.class, "default" );
- }
-
- @Override
- protected void tearDown()
- throws Exception
- {
- repositorySystem = null;
- super.tearDown();
- }
-
- public void testThatLocalRepositoryWithSpacesIsProperlyHandled()
- throws Exception
- {
- File basedir = new File( "target/spacy path" ).getAbsoluteFile();
- ArtifactRepository repo = repositorySystem.createLocalRepository( basedir );
- assertEquals( basedir, new File( repo.getBasedir() ) );
- }
-
- public void testAuthenticationHandling()
- throws Exception
- {
- Server server = new Server();
- server.setId( "repository" );
- server.setUsername( "jason" );
- server.setPassword( "abc123" );
-
- ArtifactRepository repository =
- repositorySystem.createArtifactRepository( "repository", "http://foo", null, null, null );
- repositorySystem.injectAuthentication( Arrays.asList( repository ), Arrays.asList( server ) );
- Authentication authentication = repository.getAuthentication();
- assertNotNull( authentication );
- assertEquals( "jason", authentication.getUsername() );
- assertEquals( "abc123", authentication.getPassword() );
- }
-
-}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/PerLookupWagon.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/PerLookupWagon.java
deleted file mode 100644
index 051f3e46..00000000
--- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/PerLookupWagon.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.apache.maven.repository.legacy;
-
-/*
- * 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.wagon.Wagon;
-import org.codehaus.plexus.component.annotations.Component;
-
-/**
- * Wagon with per-lookup instantiation strategy.
- */
-@Component( role = Wagon.class, hint = "perlookup", instantiationStrategy = "per-lookup" )
-public class PerLookupWagon
- extends WagonMock
-{
-
- public String[] getSupportedProtocols()
- {
- return new String[] { "perlookup" };
- }
-
-}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/StringWagon.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/StringWagon.java
deleted file mode 100644
index d0325db4..00000000
--- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/StringWagon.java
+++ /dev/null
@@ -1,107 +0,0 @@
-package org.apache.maven.repository.legacy;
-
-/*
- * 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.ByteArrayOutputStream;
-import java.io.UnsupportedEncodingException;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.maven.wagon.ConnectionException;
-import org.apache.maven.wagon.InputData;
-import org.apache.maven.wagon.OutputData;
-import org.apache.maven.wagon.ResourceDoesNotExistException;
-import org.apache.maven.wagon.StreamWagon;
-import org.apache.maven.wagon.TransferFailedException;
-import org.apache.maven.wagon.Wagon;
-import org.apache.maven.wagon.authentication.AuthenticationException;
-import org.apache.maven.wagon.authorization.AuthorizationException;
-import org.apache.maven.wagon.resource.Resource;
-import org.codehaus.plexus.component.annotations.Component;
-
-@Component(role=Wagon.class,hint="string")
-public class StringWagon
- extends StreamWagon
-{
- private Map<String, String> expectedContent = new HashMap<String, String>();
-
- public void addExpectedContent( String resourceName, String expectedContent )
- {
- this.expectedContent.put( resourceName, expectedContent );
- }
-
- public String[] getSupportedProtocols()
- {
- return new String[] { "string" };
- }
-
- @Override
- public void closeConnection()
- throws ConnectionException
- {
- }
-
- @Override
- public void fillInputData( InputData inputData )
- throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException
- {
- Resource resource = inputData.getResource();
-
- String content = expectedContent.get( resource.getName() );
-
- if ( content != null )
- {
- resource.setContentLength( content.length() );
- resource.setLastModified( System.currentTimeMillis() );
-
- try
- {
- inputData.setInputStream( new ByteArrayInputStream( content.getBytes( "UTF-8" ) ) );
- }
- catch ( UnsupportedEncodingException e )
- {
- throw new Error( "broken JVM", e );
- }
- }
- else
- {
- throw new ResourceDoesNotExistException( "No content provided for " + resource.getName() );
- }
- }
-
- @Override
- public void fillOutputData( OutputData outputData )
- throws TransferFailedException
- {
- outputData.setOutputStream( new ByteArrayOutputStream() );
- }
-
- @Override
- protected void openConnectionInternal()
- throws ConnectionException, AuthenticationException
- {
- }
-
- public void clearExpectedContent()
- {
- expectedContent.clear();
- }
-}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonA.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonA.java
deleted file mode 100644
index 601eefac..00000000
--- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonA.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package org.apache.maven.repository.legacy;
-
-import org.apache.maven.wagon.Wagon;
-import org.codehaus.plexus.component.annotations.Component;
-
-/*
- * 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.
- */
-
-/**
- * Wagon for testing, for protocol <code>a</code>
- *
- * @author <a href="mailto:carlos@apache.org">Carlos Sanchez</a>
- * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
- */
-@Component(role=Wagon.class,hint="a")
-public class WagonA
- extends WagonMock
-{
- public String[] getSupportedProtocols()
- {
- return new String[]{ "a" };
- }
-}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonB.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonB.java
deleted file mode 100644
index ecaef642..00000000
--- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonB.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package org.apache.maven.repository.legacy;
-
-import org.apache.maven.wagon.Wagon;
-import org.codehaus.plexus.component.annotations.Component;
-
-/*
- * 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.
- */
-
-/**
- * Wagon for testing, for protocols <code>b1</code> and <code>b2</code>
- *
- * @author <a href="mailto:carlos@apache.org">Carlos Sanchez</a>
- * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
- */
-@Component(role=Wagon.class,hint="b")
-public class WagonB
- extends WagonMock
-{
- public String[] getSupportedProtocols()
- {
- return new String[]{ "b1", "b2" };
- }
-}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonC.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonC.java
deleted file mode 100644
index 29316ed5..00000000
--- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonC.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package org.apache.maven.repository.legacy;
-
-import org.apache.maven.wagon.Wagon;
-import org.codehaus.plexus.component.annotations.Component;
-
-/*
- * 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.
- */
-
-/**
- * Wagon for testing, for protocol <code>c</code>
- *
- * @author <a href="mailto:carlos@apache.org">Carlos Sanchez</a>
- * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
- */
-@Component(role=Wagon.class,hint="c")
-public class WagonC
- extends WagonMock
-{
- public String[] getSupportedProtocols()
- {
- return new String[]{ "c" };
- }
-}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonMock.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonMock.java
deleted file mode 100644
index c5163609..00000000
--- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonMock.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package org.apache.maven.repository.legacy;
-
-/*
- * 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.wagon.providers.file.FileWagon;
-
-/**
- * Mock of a Wagon for testing
- *
- * @author <a href="mailto:carlos@apache.org">Carlos Sanchez</a>
- */
-public class WagonMock
- extends FileWagon
-{
-
- /**
- * A field that can be configured in the Wagon
- *
- * @component.configuration default="configurableField"
- */
- private String configurableField = null;
-
- public void setConfigurableField( String configurableField )
- {
- this.configurableField = configurableField;
- }
-
- public String getConfigurableField()
- {
- return configurableField;
- }
-
-}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/DefaultArtifactCollectorTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/DefaultArtifactCollectorTest.java
deleted file mode 100644
index 58dd3fa2..00000000
--- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/DefaultArtifactCollectorTest.java
+++ /dev/null
@@ -1,984 +0,0 @@
-package org.apache.maven.repository.legacy.resolver;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.factory.ArtifactFactory;
-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.artifact.resolver.ArtifactResolutionException;
-import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
-import org.apache.maven.artifact.resolver.CyclicDependencyException;
-import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
-import org.apache.maven.artifact.resolver.filter.ExclusionSetFilter;
-import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter;
-import org.apache.maven.artifact.versioning.ArtifactVersion;
-import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
-import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
-import org.apache.maven.artifact.versioning.OverConstrainedVersionException;
-import org.apache.maven.artifact.versioning.VersionRange;
-import org.apache.maven.repository.legacy.metadata.MetadataResolutionRequest;
-import org.codehaus.plexus.PlexusTestCase;
-
-/**
- * Test the default artifact collector.
- *
- * @author <a href="mailto:brett@apache.org">Brett Porter</a>
- */
-public class DefaultArtifactCollectorTest
- extends PlexusTestCase
-{
- private LegacyArtifactCollector artifactCollector;
-
- private ArtifactFactory artifactFactory;
-
- private ArtifactSpec projectArtifact;
-
- private Source source;
-
- private static final String GROUP_ID = "test";
-
- @Override
- protected void setUp()
- throws Exception
- {
- super.setUp();
-
- source = new Source();
- artifactFactory = (ArtifactFactory) lookup( ArtifactFactory.ROLE );
- artifactCollector = lookup( LegacyArtifactCollector.class );
-
- projectArtifact = createArtifactSpec( "project", "1.0", null );
- }
-
- @Override
- protected void tearDown()
- throws Exception
- {
- artifactCollector = null;
- artifactFactory = null;
- super.tearDown();
- }
-
- // works, but we don't fail on cycles presently
- public void disabledtestCircularDependencyNotIncludingCurrentProject()
- throws ArtifactResolutionException, InvalidVersionSpecificationException
- {
- ArtifactSpec a = createArtifactSpec( "a", "1.0" );
- ArtifactSpec b = a.addDependency( "b", "1.0" );
- b.addDependency( "a", "1.0" );
- try
- {
- collect( a );
- fail( "Should have failed on cyclic dependency not involving project" );
- }
- catch ( CyclicDependencyException expected )
- {
- assertTrue( true );
- }
- }
-
- // works, but we don't fail on cycles presently
- public void disabledtestCircularDependencyIncludingCurrentProject()
- throws ArtifactResolutionException, InvalidVersionSpecificationException
- {
- ArtifactSpec a = createArtifactSpec( "a", "1.0" );
- ArtifactSpec b = a.addDependency( "b", "1.0" );
- b.addDependency( "project", "1.0" );
- try
- {
- collect( a );
- fail( "Should have failed on cyclic dependency involving project" );
- }
- catch ( CyclicDependencyException expected )
- {
- assertTrue( true );
- }
- }
-
- public void testResolveWithFilter()
- throws ArtifactResolutionException, InvalidVersionSpecificationException
- {
- ArtifactSpec a = createArtifactSpec( "a", "1.0" );
- ArtifactSpec b = a.addDependency( "b", "1.0" );
- ArtifactSpec c = a.addDependency( "c", "3.0" );
-
- b.addDependency( "c", "2.0" );
- ArtifactSpec d = b.addDependency( "d", "4.0" );
-
- ArtifactResolutionResult res = collect( a );
- assertEquals( "Check artifact list",
- createSet( new Object[] { a.artifact, b.artifact, c.artifact, d.artifact } ), res.getArtifacts() );
-
- ArtifactFilter filter = new ExclusionSetFilter( new String[] { "b" } );
- res = collect( a, filter );
- assertEquals( "Check artifact list", createSet( new Object[] { a.artifact, c.artifact } ), res.getArtifacts() );
- }
-
- public void testResolveCorrectDependenciesWhenDifferentDependenciesOnNearest()
- throws ArtifactResolutionException, InvalidVersionSpecificationException
- {
- ArtifactSpec a = createArtifactSpec( "a", "1.0" );
- ArtifactSpec b = a.addDependency( "b", "1.0" );
- ArtifactSpec c2 = b.addDependency( "c", "2.0" );
- c2.addDependency( "d", "1.0" );
-
- ArtifactSpec e = createArtifactSpec( "e", "1.0" );
- ArtifactSpec c1 = e.addDependency( "c", "1.0" );
- ArtifactSpec f = c1.addDependency( "f", "1.0" );
-
- ArtifactResolutionResult res = collect( createSet( new Object[] { a.artifact, e.artifact } ) );
- assertEquals( "Check artifact list", createSet( new Object[] { a.artifact, b.artifact, e.artifact, c1.artifact,
- f.artifact } ), res.getArtifacts() );
- assertEquals( "Check version", "1.0", getArtifact( "c", res.getArtifacts() ).getVersion() );
- }
-
- public void disabledtestResolveCorrectDependenciesWhenDifferentDependenciesOnNewest()
- throws ArtifactResolutionException, InvalidVersionSpecificationException
- {
- // TODO: use newest conflict resolver
- ArtifactSpec a = createArtifactSpec( "a", "1.0" );
- ArtifactSpec b = a.addDependency( "b", "1.0" );
- ArtifactSpec c2 = b.addDependency( "c", "2.0" );
- ArtifactSpec d = c2.addDependency( "d", "1.0" );
-
- ArtifactSpec e = createArtifactSpec( "e", "1.0" );
- ArtifactSpec c1 = e.addDependency( "c", "1.0" );
- c1.addDependency( "f", "1.0" );
-
- ArtifactResolutionResult res = collect( createSet( new Object[] { a.artifact, e.artifact } ) );
- assertEquals( "Check artifact list", createSet( new Object[] { a.artifact, b.artifact, e.artifact, c2.artifact,
- d.artifact } ), res.getArtifacts() );
- assertEquals( "Check version", "2.0", getArtifact( "c", res.getArtifacts() ).getVersion() );
- }
-
- public void disabledtestResolveCorrectDependenciesWhenDifferentDependenciesOnNewestVersionReplaced()
- throws ArtifactResolutionException, InvalidVersionSpecificationException
- {
- // TODO: use newest conflict resolver
- ArtifactSpec a = createArtifactSpec( "a", "1.0" );
- ArtifactSpec b1 = a.addDependency( "b", "1.0" );
- ArtifactSpec c = a.addDependency( "c", "1.0" );
- ArtifactSpec d2 = b1.addDependency( "d", "2.0" );
- d2.addDependency( "h", "1.0" );
- ArtifactSpec d1 = c.addDependency( "d", "1.0" );
- ArtifactSpec b2 = c.addDependency( "b", "2.0" );
- ArtifactSpec e = b2.addDependency( "e", "1.0" );
- ArtifactSpec g = d1.addDependency( "g", "1.0" );
-
- ArtifactResolutionResult res = collect( createSet( new Object[] { a.artifact } ) );
- Object[] artifacts = new Object[] { a.artifact, c.artifact, d1.artifact, b2.artifact, e.artifact, g.artifact };
- assertEquals( "Check artifact list", createSet( artifacts ), res.getArtifacts() );
- assertEquals( "Check version", "1.0", getArtifact( "d", res.getArtifacts() ).getVersion() );
- assertEquals( "Check version", "2.0", getArtifact( "b", res.getArtifacts() ).getVersion() );
- }
-
- public void testResolveNearestNewestIsNearest()
- throws ArtifactResolutionException, InvalidVersionSpecificationException
- {
- ArtifactSpec a = createArtifactSpec( "a", "1.0" );
- ArtifactSpec b = a.addDependency( "b", "1.0" );
- ArtifactSpec c = a.addDependency( "c", "3.0" );
-
- b.addDependency( "c", "2.0" );
-
- ArtifactResolutionResult res = collect( a );
- assertEquals( "Check artifact list", createSet( new Object[] { a.artifact, b.artifact, c.artifact } ),
- res.getArtifacts() );
- assertEquals( "Check version", "3.0", getArtifact( "c", res.getArtifacts() ).getVersion() );
- }
-
- public void testResolveNearestOldestIsNearest()
- throws ArtifactResolutionException, InvalidVersionSpecificationException
- {
- ArtifactSpec a = createArtifactSpec( "a", "1.0" );
- ArtifactSpec b = a.addDependency( "b", "1.0" );
- ArtifactSpec c = a.addDependency( "c", "2.0" );
-
- b.addDependency( "c", "3.0" );
-
- ArtifactResolutionResult res = collect( a );
- assertEquals( "Check artifact list", createSet( new Object[] { a.artifact, b.artifact, c.artifact } ),
- res.getArtifacts() );
- assertEquals( "Check version", "2.0", getArtifact( "c", res.getArtifacts() ).getVersion() );
- }
-
- public void testResolveLocalNewestIsLocal()
- throws ArtifactResolutionException, InvalidVersionSpecificationException
- {
- ArtifactSpec a = createArtifactSpec( "a", "1.0" );
- a.addDependency( "b", "2.0" );
- ArtifactSpec b = createArtifactSpec( "b", "3.0" );
-
- ArtifactResolutionResult res = collect( createSet( new Object[] { a.artifact, b.artifact } ) );
- assertEquals( "Check artifact list", createSet( new Object[] { a.artifact, b.artifact } ), res.getArtifacts() );
- assertEquals( "Check version", "3.0", getArtifact( "b", res.getArtifacts() ).getVersion() );
- }
-
- public void testResolveLocalOldestIsLocal()
- throws ArtifactResolutionException, InvalidVersionSpecificationException
- {
- ArtifactSpec a = createArtifactSpec( "a", "1.0" );
- a.addDependency( "b", "3.0" );
- ArtifactSpec b = createArtifactSpec( "b", "2.0" );
-
- ArtifactResolutionResult res = collect( createSet( new Object[] { a.artifact, b.artifact } ) );
- assertEquals( "Check artifact list", createSet( new Object[] { a.artifact, b.artifact } ), res.getArtifacts() );
- assertEquals( "Check version", "2.0", getArtifact( "b", res.getArtifacts() ).getVersion() );
- }
-
- public void testResolveLocalWithNewerVersionButLesserScope()
- throws ArtifactResolutionException, InvalidVersionSpecificationException
- {
- ArtifactSpec a = createArtifactSpec( "commons-logging", "1.0" );
- a.addDependency( "junit", "3.7" );
- ArtifactSpec b = createArtifactSpec( "junit", "3.8.1", Artifact.SCOPE_TEST );
-
- ArtifactResolutionResult res = collect( createSet( new Object[] { a.artifact, b.artifact } ) );
- assertEquals( "Check artifact list", createSet( new Object[] { a.artifact, b.artifact } ), res.getArtifacts() );
- assertEquals( "Check version", "3.8.1", getArtifact( "junit", res.getArtifacts() ).getVersion() );
- assertEquals( "Check artifactScope", Artifact.SCOPE_TEST, getArtifact( "junit", res.getArtifacts() ).getScope() );
- }
-
- public void testResolveLocalWithNewerVersionButLesserScopeResolvedFirst()
- throws ArtifactResolutionException, InvalidVersionSpecificationException
- {
- ArtifactSpec b = createArtifactSpec( "junit", "3.8.1", Artifact.SCOPE_TEST );
- ArtifactSpec a = createArtifactSpec( "commons-logging", "1.0" );
- a.addDependency( "junit", "3.7" );
-
- ArtifactResolutionResult res = collect( createSet( new Object[] { a.artifact, b.artifact } ) );
- assertEquals( "Check artifact list", createSet( new Object[] { a.artifact, b.artifact } ), res.getArtifacts() );
- assertEquals( "Check version", "3.8.1", getArtifact( "junit", res.getArtifacts() ).getVersion() );
- assertEquals( "Check artifactScope", Artifact.SCOPE_TEST, getArtifact( "junit", res.getArtifacts() ).getScope() );
- }
-
- public void testResolveNearestWithRanges()
- throws ArtifactResolutionException, InvalidVersionSpecificationException
- {
- ArtifactSpec a = createArtifactSpec( "a", "1.0" );
- ArtifactSpec b = a.addDependency( "b", "1.0" );
- ArtifactSpec c = a.addDependency( "c", "2.0" );
-
- b.addDependency( "c", "[1.0,3.0]" );
-
- ArtifactResolutionResult res = collect( a );
- assertEquals( "Check artifact list", createSet( new Object[] { a.artifact, b.artifact, c.artifact } ),
- res.getArtifacts() );
- assertEquals( "Check version", "2.0", getArtifact( "c", res.getArtifacts() ).getVersion() );
- }
-
- public void testResolveRangeWithManagedVersion()
- throws ArtifactResolutionException, InvalidVersionSpecificationException
- {
- ArtifactSpec a = createArtifactSpec( "a", "1.0" );
- ArtifactSpec b = a.addDependency( "b", "[1.0,3.0]" );
-
- ArtifactSpec managedB = createArtifactSpec( "b", "5.0" );
-
- ArtifactResolutionResult res = collect( a, managedB.artifact );
- assertEquals( "Check artifact list", createSet( new Object[] { a.artifact, managedB.artifact } ),
- res.getArtifacts() );
- assertEquals( "Check version", "5.0", getArtifact( "b", res.getArtifacts() ).getVersion() );
- }
-
- public void testCompatibleRanges()
- throws ArtifactResolutionException, InvalidVersionSpecificationException
- {
- ArtifactSpec a = createArtifactSpec( "a", "1.0" );
- ArtifactSpec b = a.addDependency( "b", "1.0" );
- a.addDependency( "c", "[2.0,2.5]" );
- b.addDependency( "c", "[1.0,3.0]" );
- ArtifactSpec c = createArtifactSpec( "c", "2.5" );
-
- ArtifactResolutionResult res = collect( a );
-
- assertEquals( "Check artifact list", createSet( new Object[] { a.artifact, b.artifact, c.artifact } ),
- res.getArtifacts() );
- assertEquals( "Check version", "2.5", getArtifact( "c", res.getArtifacts() ).getVersion() );
- }
-
- public void testIncompatibleRanges()
- throws ArtifactResolutionException, InvalidVersionSpecificationException
- {
- ArtifactSpec a = createArtifactSpec( "a", "1.0" );
- ArtifactSpec b = a.addDependency( "b", "1.0" );
- a.addDependency( "c", "[2.4,3.0]" );
-
- b.addDependency( "c", "[1.0,2.0]" );
-
- ArtifactResolutionResult res = collect( a );
-
- assertTrue( res.hasVersionRangeViolations() );
- }
-
- public void testUnboundedRangeWhenVersionUnavailable()
- throws ArtifactResolutionException, InvalidVersionSpecificationException
- {
- ArtifactSpec a = createArtifactSpec( "a", "1.0" );
- ArtifactSpec b = a.addDependency( "b", "1.0" );
- a.addDependency( "c", "[2.0,]" );
- b.addDependency( "c", "[1.0,]" );
-
- ArtifactResolutionResult res = collect( a );
-
- assertTrue( res.hasVersionRangeViolations() );
- }
-
- public void testUnboundedRangeBelowLastRelease()
- throws ArtifactResolutionException, InvalidVersionSpecificationException
- {
- ArtifactSpec a = createArtifactSpec( "a", "1.0" );
- createArtifactSpec( "c", "1.5" );
- ArtifactSpec c = createArtifactSpec( "c", "2.0" );
- createArtifactSpec( "c", "1.1" );
- a.addDependency( "c", "[1.0,)" );
-
- ArtifactResolutionResult res = collect( a );
-
- assertEquals( "Check artifact list", createSet( new Object[] { a.artifact, c.artifact } ), res.getArtifacts() );
- assertEquals( "Check version", "2.0", getArtifact( "c", res.getArtifacts() ).getVersion() );
- }
-
- public void testUnboundedRangeAboveLastRelease()
- throws ArtifactResolutionException, InvalidVersionSpecificationException
- {
- ArtifactSpec a = createArtifactSpec( "a", "1.0" );
- createArtifactSpec( "c", "2.0" );
- a.addDependency( "c", "[10.0,)" );
-
- ArtifactResolutionResult res = collect( a );
-
- assertTrue( res.hasVersionRangeViolations() );
- }
-
- public void testResolveManagedVersion()
- throws ArtifactResolutionException, InvalidVersionSpecificationException
- {
- ArtifactSpec a = createArtifactSpec( "a", "1.0" );
- a.addDependency( "b", "3.0", Artifact.SCOPE_RUNTIME );
-
- Artifact managedVersion = createArtifactSpec( "b", "5.0" ).artifact;
- Artifact modifiedB = createArtifactSpec( "b", "5.0", Artifact.SCOPE_RUNTIME ).artifact;
-
- ArtifactResolutionResult res = collect( a, managedVersion );
- assertEquals( "Check artifact list", createSet( new Object[] { a.artifact, modifiedB } ), res.getArtifacts() );
- }
-
- public void testCollectChangesVersionOfOriginatingArtifactIfInDependencyManagementHasDifferentVersion()
- throws ArtifactResolutionException, InvalidVersionSpecificationException
- {
- ArtifactSpec a = createArtifactSpec( "a", "1.0" );
-
- Artifact artifact = projectArtifact.artifact;
- Artifact managedVersion = createArtifactSpec( artifact.getArtifactId(), "2.0" ).artifact;
-
- ArtifactResolutionResult result = collect( a, managedVersion );
-
- assertEquals( "collect has modified version in originating artifact", "1.0", artifact.getVersion() );
-
- Artifact resolvedArtifact = result.getArtifacts().iterator().next();
-
- assertEquals( "Resolved version don't match original artifact version", "1.0", resolvedArtifact.getVersion() );
- }
-
- public void testResolveCompileScopeOverTestScope()
- throws ArtifactResolutionException, InvalidVersionSpecificationException
- {
- ArtifactSpec a = createArtifactSpec( "a", "1.0" );
- ArtifactSpec c = createArtifactSpec( "c", "3.0", Artifact.SCOPE_TEST );
-
- a.addDependency( "c", "2.0", Artifact.SCOPE_COMPILE );
-
- Artifact modifiedC = createArtifactSpec( "c", "3.0", Artifact.SCOPE_COMPILE ).artifact;
-
- ArtifactResolutionResult res = collect( createSet( new Object[] { a.artifact, c.artifact } ) );
- assertEquals( "Check artifact list", createSet( new Object[] { a.artifact, modifiedC } ), res.getArtifacts() );
- Artifact artifact = getArtifact( "c", res.getArtifacts() );
- // local wins now, and irrelevant if not local as test/provided aren't transitive
- // assertEquals( "Check artifactScope", Artifact.SCOPE_COMPILE, artifact.getArtifactScope() );
- assertEquals( "Check artifactScope", Artifact.SCOPE_TEST, artifact.getScope() );
- }
-
- public void testResolveRuntimeScopeOverTestScope()
- throws ArtifactResolutionException, InvalidVersionSpecificationException
- {
- ArtifactSpec a = createArtifactSpec( "a", "1.0" );
- ArtifactSpec c = createArtifactSpec( "c", "3.0", Artifact.SCOPE_TEST );
-
- a.addDependency( "c", "2.0", Artifact.SCOPE_RUNTIME );
-
- Artifact modifiedC = createArtifactSpec( "c", "3.0", Artifact.SCOPE_RUNTIME ).artifact;
-
- ArtifactResolutionResult res = collect( createSet( new Object[] { a.artifact, c.artifact } ) );
- assertEquals( "Check artifact list", createSet( new Object[] { a.artifact, modifiedC } ), res.getArtifacts() );
- Artifact artifact = getArtifact( "c", res.getArtifacts() );
- // local wins now, and irrelevant if not local as test/provided aren't transitive
- // assertEquals( "Check artifactScope", Artifact.SCOPE_RUNTIME, artifact.getArtifactScope() );
- assertEquals( "Check artifactScope", Artifact.SCOPE_TEST, artifact.getScope() );
- }
-
- public void testResolveCompileScopeOverRuntimeScope()
- throws ArtifactResolutionException, InvalidVersionSpecificationException
- {
- ArtifactSpec root = createArtifactSpec( "root", "1.0" );
- ArtifactSpec a = root.addDependency( "a", "1.0" );
- root.addDependency( "c", "3.0", Artifact.SCOPE_RUNTIME );
-
- a.addDependency( "c", "2.0", Artifact.SCOPE_COMPILE );
-
- Artifact modifiedC = createArtifactSpec( "c", "3.0", Artifact.SCOPE_COMPILE ).artifact;
-
- ArtifactResolutionResult res = collect( createSet( new Object[] { root.artifact } ) );
- assertEquals( "Check artifact list", createSet( new Object[] { a.artifact, root.artifact, modifiedC } ),
- res.getArtifacts() );
- Artifact artifact = getArtifact( "c", res.getArtifacts() );
- assertEquals( "Check artifactScope", Artifact.SCOPE_COMPILE, artifact.getScope() );
- }
-
- public void testResolveCompileScopeOverProvidedScope()
- throws ArtifactResolutionException, InvalidVersionSpecificationException
- {
- ArtifactSpec a = createArtifactSpec( "a", "1.0" );
- ArtifactSpec c = createArtifactSpec( "c", "3.0", Artifact.SCOPE_PROVIDED );
-
- a.addDependency( "c", "2.0", Artifact.SCOPE_COMPILE );
-
- Artifact modifiedC = createArtifactSpec( "c", "3.0", Artifact.SCOPE_COMPILE ).artifact;
-
- ArtifactResolutionResult res = collect( createSet( new Object[] { a.artifact, c.artifact } ) );
- assertEquals( "Check artifact list", createSet( new Object[] { a.artifact, modifiedC } ), res.getArtifacts() );
- Artifact artifact = getArtifact( "c", res.getArtifacts() );
- // local wins now, and irrelevant if not local as test/provided aren't transitive
- // assertEquals( "Check artifactScope", Artifact.SCOPE_COMPILE, artifact.getArtifactScope() );
- assertEquals( "Check artifactScope", Artifact.SCOPE_PROVIDED, artifact.getScope() );
- }
-
- public void testResolveRuntimeScopeOverProvidedScope()
- throws ArtifactResolutionException, InvalidVersionSpecificationException
- {
- ArtifactSpec a = createArtifactSpec( "a", "1.0" );
- ArtifactSpec c = createArtifactSpec( "c", "3.0", Artifact.SCOPE_PROVIDED );
-
- a.addDependency( "c", "2.0", Artifact.SCOPE_RUNTIME );
-
- Artifact modifiedC = createArtifactSpec( "c", "3.0", Artifact.SCOPE_RUNTIME ).artifact;
-
- ArtifactResolutionResult res = collect( createSet( new Object[] { a.artifact, c.artifact } ) );
- assertEquals( "Check artifact list", createSet( new Object[] { a.artifact, modifiedC } ), res.getArtifacts() );
- Artifact artifact = getArtifact( "c", res.getArtifacts() );
- // local wins now, and irrelevant if not local as test/provided aren't transitive
- // assertEquals( "Check artifactScope", Artifact.SCOPE_RUNTIME, artifact.getArtifactScope() );
- assertEquals( "Check artifactScope", Artifact.SCOPE_PROVIDED, artifact.getScope() );
- }
-
- public void testProvidedScopeNotTransitive()
- throws ArtifactResolutionException, InvalidVersionSpecificationException
- {
- ArtifactSpec a = createArtifactSpec( "a", "1.0", Artifact.SCOPE_PROVIDED );
- ArtifactSpec b = createArtifactSpec( "b", "1.0" );
- b.addDependency( "c", "3.0", Artifact.SCOPE_PROVIDED );
-
- ArtifactResolutionResult res = collect( createSet( new Object[] { a.artifact, b.artifact } ) );
- assertEquals( "Check artifact list", createSet( new Object[] { a.artifact, b.artifact } ), res.getArtifacts() );
- }
-
- public void testOptionalNotTransitive()
- throws ArtifactResolutionException, InvalidVersionSpecificationException
- {
- ArtifactSpec a = createArtifactSpec( "a", "1.0" );
- ArtifactSpec b = createArtifactSpec( "b", "1.0" );
- b.addDependency( "c", "3.0", true );
-
- ArtifactResolutionResult res = collect( createSet( new Object[] { a.artifact, b.artifact } ) );
- assertEquals( "Check artifact list", createSet( new Object[] { a.artifact, b.artifact } ), res.getArtifacts() );
- }
-
- public void testOptionalIncludedAtRoot()
- throws ArtifactResolutionException, InvalidVersionSpecificationException
- {
- ArtifactSpec a = createArtifactSpec( "a", "1.0" );
-
- ArtifactSpec b = createArtifactSpec( "b", "1.0", true );
-
- ArtifactResolutionResult res = collect( createSet( new Object[] { a.artifact, b.artifact } ) );
- assertEquals( "Check artifact list", createSet( new Object[] { a.artifact, b.artifact } ), res.getArtifacts() );
- }
-
- public void testScopeUpdate()
- throws InvalidVersionSpecificationException, ArtifactResolutionException
- {
- /* farthest = compile */
- checkScopeUpdate( Artifact.SCOPE_COMPILE, Artifact.SCOPE_COMPILE, Artifact.SCOPE_COMPILE );
- checkScopeUpdate( Artifact.SCOPE_COMPILE, Artifact.SCOPE_PROVIDED, Artifact.SCOPE_COMPILE );
- checkScopeUpdate( Artifact.SCOPE_COMPILE, Artifact.SCOPE_RUNTIME, Artifact.SCOPE_COMPILE );
- checkScopeUpdate( Artifact.SCOPE_COMPILE, Artifact.SCOPE_SYSTEM, Artifact.SCOPE_COMPILE );
- checkScopeUpdate( Artifact.SCOPE_COMPILE, Artifact.SCOPE_TEST, Artifact.SCOPE_COMPILE );
-
- /* farthest = provided */
- checkScopeUpdate( Artifact.SCOPE_PROVIDED, Artifact.SCOPE_COMPILE, Artifact.SCOPE_COMPILE );
- checkScopeUpdate( Artifact.SCOPE_PROVIDED, Artifact.SCOPE_PROVIDED, Artifact.SCOPE_PROVIDED );
- checkScopeUpdate( Artifact.SCOPE_PROVIDED, Artifact.SCOPE_RUNTIME, Artifact.SCOPE_RUNTIME );
- checkScopeUpdate( Artifact.SCOPE_PROVIDED, Artifact.SCOPE_SYSTEM, Artifact.SCOPE_SYSTEM );
- checkScopeUpdate( Artifact.SCOPE_PROVIDED, Artifact.SCOPE_TEST, Artifact.SCOPE_TEST );
-
- /* farthest = runtime */
- checkScopeUpdate( Artifact.SCOPE_RUNTIME, Artifact.SCOPE_COMPILE, Artifact.SCOPE_COMPILE );
- checkScopeUpdate( Artifact.SCOPE_RUNTIME, Artifact.SCOPE_PROVIDED, Artifact.SCOPE_RUNTIME );
- checkScopeUpdate( Artifact.SCOPE_RUNTIME, Artifact.SCOPE_RUNTIME, Artifact.SCOPE_RUNTIME );
- checkScopeUpdate( Artifact.SCOPE_RUNTIME, Artifact.SCOPE_SYSTEM, Artifact.SCOPE_SYSTEM );
- checkScopeUpdate( Artifact.SCOPE_RUNTIME, Artifact.SCOPE_TEST, Artifact.SCOPE_RUNTIME );
-
- /* farthest = system */
- checkScopeUpdate( Artifact.SCOPE_SYSTEM, Artifact.SCOPE_COMPILE, Artifact.SCOPE_COMPILE );
- checkScopeUpdate( Artifact.SCOPE_SYSTEM, Artifact.SCOPE_PROVIDED, Artifact.SCOPE_PROVIDED );
- checkScopeUpdate( Artifact.SCOPE_SYSTEM, Artifact.SCOPE_RUNTIME, Artifact.SCOPE_RUNTIME );
- checkScopeUpdate( Artifact.SCOPE_SYSTEM, Artifact.SCOPE_SYSTEM, Artifact.SCOPE_SYSTEM );
- checkScopeUpdate( Artifact.SCOPE_SYSTEM, Artifact.SCOPE_TEST, Artifact.SCOPE_TEST );
-
- /* farthest = test */
- checkScopeUpdate( Artifact.SCOPE_TEST, Artifact.SCOPE_COMPILE, Artifact.SCOPE_COMPILE );
- checkScopeUpdate( Artifact.SCOPE_TEST, Artifact.SCOPE_PROVIDED, Artifact.SCOPE_PROVIDED );
- checkScopeUpdate( Artifact.SCOPE_TEST, Artifact.SCOPE_RUNTIME, Artifact.SCOPE_RUNTIME );
- checkScopeUpdate( Artifact.SCOPE_TEST, Artifact.SCOPE_SYSTEM, Artifact.SCOPE_SYSTEM );
- checkScopeUpdate( Artifact.SCOPE_TEST, Artifact.SCOPE_TEST, Artifact.SCOPE_TEST );
- }
-
- private void checkScopeUpdate( String farthestScope, String nearestScope, String expectedScope )
- throws ArtifactResolutionException, InvalidVersionSpecificationException
- {
- checkScopeUpdateDirect( farthestScope, nearestScope, expectedScope );
- checkScopeUpdateTransitively( farthestScope, nearestScope, expectedScope );
- }
-
- private void checkScopeUpdateTransitively( String farthestScope, String nearestScope, String expectedScope )
- throws ArtifactResolutionException, InvalidVersionSpecificationException
- {
- ArtifactSpec a = createArtifactSpec( "a", "1.0" );
- ArtifactSpec b = createArtifactSpec( "b", "1.0", nearestScope );
- ArtifactSpec c = createArtifactSpec( "c", "1.0" );
- a.addDependency( c );
- ArtifactSpec dNearest = createArtifactSpec( "d", "2.0" );
- b.addDependency( dNearest );
- ArtifactSpec dFarthest = createArtifactSpec( "d", "3.0", farthestScope );
- c.addDependency( dFarthest );
-
- /* system and provided dependencies are not transitive */
- if ( !Artifact.SCOPE_SYSTEM.equals( nearestScope ) && !Artifact.SCOPE_PROVIDED.equals( nearestScope ) )
- {
- checkScopeUpdate( a, b, expectedScope, "2.0" );
- }
- }
-
- private void checkScopeUpdateDirect( String farthestScope, String nearestScope, String expectedScope )
- throws ArtifactResolutionException, InvalidVersionSpecificationException
- {
- ArtifactSpec a = createArtifactSpec( "a", "1.0" );
- ArtifactSpec b = createArtifactSpec( "b", "1.0" );
- ArtifactSpec c = createArtifactSpec( "c", "1.0" );
- a.addDependency( c );
- ArtifactSpec dNearest = createArtifactSpec( "d", "2.0", nearestScope );
- b.addDependency( dNearest );
- ArtifactSpec dFarthest = createArtifactSpec( "d", "3.0", farthestScope );
- c.addDependency( dFarthest );
-
- checkScopeUpdate( a, b, expectedScope, "2.0" );
- }
-
- private void checkScopeUpdate( ArtifactSpec a, ArtifactSpec b, String expectedScope, String expectedVersion )
- throws ArtifactResolutionException, InvalidVersionSpecificationException
- {
- ScopeArtifactFilter filter;
- if ( Artifact.SCOPE_PROVIDED.equals( expectedScope ) )
- {
- filter = new ScopeArtifactFilter( Artifact.SCOPE_COMPILE );
- }
- else if ( Artifact.SCOPE_SYSTEM.equals( expectedScope ) )
- {
- filter = new ScopeArtifactFilter( Artifact.SCOPE_COMPILE );
- }
- else
- {
- filter = new ScopeArtifactFilter( expectedScope );
- }
-
- ArtifactResolutionResult res = collect( createSet( new Object[] { a.artifact, b.artifact } ), filter );
- Artifact artifact = getArtifact( "d", res.getArtifacts() );
- assertNotNull( "MNG-1895 Dependency was not added to resolution", artifact );
- assertEquals( "Check artifactScope", expectedScope, artifact.getScope() );
- assertEquals( "Check version", expectedVersion, artifact.getVersion() );
-
- ArtifactSpec d = createArtifactSpec( "d", "1.0" );
- res = collect( createSet( new Object[] { a.artifact, b.artifact, d.artifact } ), filter );
- artifact = getArtifact( "d", res.getArtifacts() );
- assertNotNull( "MNG-1895 Dependency was not added to resolution", artifact );
- assertEquals( "Check artifactScope", d.artifact.getScope(), artifact.getScope() );
- assertEquals( "Check version", "1.0", artifact.getVersion() );
- }
-
- public void disabledtestOptionalNotTransitiveButVersionIsInfluential()
- throws ArtifactResolutionException, InvalidVersionSpecificationException
- {
- ArtifactSpec a = createArtifactSpec( "a", "1.0" );
- ArtifactSpec b = createArtifactSpec( "b", "1.0" );
- b.addDependency( "c", "3.0", true );
- ArtifactSpec d = a.addDependency( "d", "1.0" );
- ArtifactSpec e = d.addDependency( "e", "1.0" );
- e.addDependency( "c", "2.0" );
-
- ArtifactSpec c = createArtifactSpec( "c", "3.0" );
-
- ArtifactResolutionResult res = collect( createSet( new Object[] { a.artifact, b.artifact } ) );
- assertEquals( "Check artifact list", createSet( new Object[] { a.artifact, b.artifact, c.artifact, d.artifact,
- e.artifact } ), res.getArtifacts() );
- Artifact artifact = getArtifact( "c", res.getArtifacts() );
- assertEquals( "Check version", "3.0", artifact.getVersion() );
- }
-
- public void testTestScopeNotTransitive()
- throws ArtifactResolutionException, InvalidVersionSpecificationException
- {
- ArtifactSpec a = createArtifactSpec( "a", "1.0", Artifact.SCOPE_TEST );
- ArtifactSpec b = createArtifactSpec( "b", "1.0" );
- b.addDependency( "c", "3.0", Artifact.SCOPE_TEST );
-
- ArtifactResolutionResult res = collect( createSet( new Object[] { a.artifact, b.artifact } ) );
- assertEquals( "Check artifact list", createSet( new Object[] { a.artifact, b.artifact } ), res.getArtifacts() );
- }
-
- public void testSnapshotNotIncluded()
- throws ArtifactResolutionException, InvalidVersionSpecificationException
- {
- ArtifactSpec a = createArtifactSpec( "a", "1.0" );
- a.addDependency( "b", "[1.0,)" );
- createArtifactSpec( "b", "1.0-SNAPSHOT" );
-
- ArtifactResolutionResult res = collect( a );
-
- assertTrue( res.hasVersionRangeViolations() );
-
- /*
- * try { ArtifactResolutionResult res = collect( a ); fail( "Expected b not to resolve: " + res ); } catch (
- * OverConstrainedVersionException e ) { assertTrue( e.getMessage().indexOf( "[1.0-SNAPSHOT]" ) <
- * e.getMessage().indexOf( "[1.0,)" ) ); }
- */
- }
-
- public void testOverConstrainedVersionException()
- throws ArtifactResolutionException, InvalidVersionSpecificationException
- {
- ArtifactSpec a = createArtifactSpec( "a", "1.0" );
- a.addDependency( "b", "[1.0, 2.0)" );
- a.addDependency( "c", "[3.3.0,4.0.0)" );
-
- ArtifactSpec b = createArtifactSpec( "b", "1.0.0" );
- b.addDependency( "c", "3.3.0-v3346" );
-
- ArtifactSpec c = createArtifactSpec( "c", "3.2.1-v3235e" );
-
- try
- {
- ArtifactResolutionResult res = collect( createSet( new Object[] { a.artifact } ) );
- }
- catch ( OverConstrainedVersionException e )
- {
- assertTrue( "Versions unordered", e.getMessage().contains( "[3.2.1-v3235e, 3.3.0-v3346]" ) );
- assertTrue( "DependencyTrail unresolved", e.getMessage().contains( "Path to dependency:" ) );
- }
- }
-
- private Artifact getArtifact( String id, Set artifacts )
- {
- for ( Object artifact : artifacts )
- {
- Artifact a = (Artifact) artifact;
- if ( a.getArtifactId().equals( id ) && a.getGroupId().equals( GROUP_ID ) )
- {
- return a;
- }
- }
- return null;
- }
-
- private ArtifactResolutionResult collect( Set artifacts )
- throws ArtifactResolutionException
- {
- return collect( artifacts, null );
- }
-
- private ArtifactResolutionResult collect( Set artifacts, ArtifactFilter filter )
- throws ArtifactResolutionException
- {
- return artifactCollector.collect( artifacts, projectArtifact.artifact, null, null, null, source, filter,
- Collections.EMPTY_LIST, null );
- }
-
- private ArtifactResolutionResult collect( ArtifactSpec a )
- throws ArtifactResolutionException
- {
- return artifactCollector.collect( Collections.singleton( a.artifact ), projectArtifact.artifact, null, null,
- null, source, null, Collections.EMPTY_LIST, null );
- }
-
- private ArtifactResolutionResult collect( ArtifactSpec a, ArtifactFilter filter )
- throws ArtifactResolutionException
- {
- return artifactCollector.collect( Collections.singleton( a.artifact ), projectArtifact.artifact, null, null,
- null, source, filter, Collections.EMPTY_LIST, null );
- }
-
- private ArtifactResolutionResult collect( ArtifactSpec a, Artifact managedVersion )
- throws ArtifactResolutionException
- {
- Map managedVersions = Collections.singletonMap( managedVersion.getDependencyConflictId(), managedVersion );
- return artifactCollector.collect( Collections.singleton( a.artifact ), projectArtifact.artifact,
- managedVersions, null, null, source, null, Collections.EMPTY_LIST, null );
- }
-
- private ArtifactSpec createArtifactSpec( String id, String version )
- throws InvalidVersionSpecificationException
- {
- return createArtifactSpec( id, version, Artifact.SCOPE_COMPILE );
- }
-
- private ArtifactSpec createArtifactSpec( String id, String version, boolean optional )
- throws InvalidVersionSpecificationException
- {
- return createArtifactSpec( id, version, Artifact.SCOPE_COMPILE, null, optional );
- }
-
- private ArtifactSpec createArtifactSpec( String id, String version, String scope )
- throws InvalidVersionSpecificationException
- {
- return createArtifactSpec( id, version, scope, null, false );
- }
-
- private ArtifactSpec createArtifactSpec( String id, String version, String scope, String inheritedScope,
- boolean optional )
- throws InvalidVersionSpecificationException
- {
- VersionRange versionRange = VersionRange.createFromVersionSpec( version );
- Artifact artifact =
- artifactFactory.createDependencyArtifact( GROUP_ID, id, versionRange, "jar", null, scope, inheritedScope,
- optional );
- ArtifactSpec spec = null;
- if ( artifact != null )
- {
- spec = new ArtifactSpec();
- spec.artifact = artifact;
- source.addArtifact( spec );
- }
- return spec;
- }
-
- private static Set createSet( Object[] x )
- {
- return new LinkedHashSet( Arrays.asList( x ) );
- }
-
- private class ArtifactSpec
- {
- private Artifact artifact;
-
- private Set dependencies = new HashSet();
-
- public ArtifactSpec addDependency( String id, String version )
- throws InvalidVersionSpecificationException
- {
- return addDependency( id, version, Artifact.SCOPE_COMPILE );
- }
-
- public ArtifactSpec addDependency( String id, String version, String scope )
- throws InvalidVersionSpecificationException
- {
- return addDependency( id, version, scope, false );
- }
-
- private ArtifactSpec addDependency( ArtifactSpec dep )
- throws InvalidVersionSpecificationException
- {
- if ( dep != null )
- {
- dependencies.add( dep.artifact );
- }
- return dep;
- }
-
- private ArtifactSpec addDependency( String id, String version, String scope, boolean optional )
- throws InvalidVersionSpecificationException
- {
- ArtifactSpec dep = createArtifactSpec( id, version, scope, artifact.getScope(), optional );
- return addDependency( dep );
- }
-
- public ArtifactSpec addDependency( String id, String version, boolean optional )
- throws InvalidVersionSpecificationException
- {
- return addDependency( id, version, Artifact.SCOPE_COMPILE, optional );
- }
- }
-
- private class Source
- implements ArtifactMetadataSource
- {
- private Map artifacts = new HashMap();
-
- private Map versions = new HashMap();
-
- public ResolutionGroup retrieve( Artifact artifact, ArtifactRepository localRepository,
- List<ArtifactRepository> remoteRepositories )
- throws ArtifactMetadataRetrievalException
- {
- String key = getKey( artifact );
-
- ArtifactSpec a = (ArtifactSpec) artifacts.get( key );
- try
- {
- return new ResolutionGroup( artifact, createArtifacts( artifactFactory, a.dependencies,
- artifact.getScope(),
- artifact.getDependencyFilter() ),
- Collections.EMPTY_LIST );
- }
- catch ( InvalidVersionSpecificationException e )
- {
- throw new ArtifactMetadataRetrievalException( "Invalid version creating artifacts", e, artifact );
- }
- }
-
- private String getKey( Artifact artifact )
- {
- return artifact.getDependencyConflictId();
- }
-
- private Set createArtifacts( ArtifactFactory artifactFactory, Set dependencies, String inheritedScope,
- ArtifactFilter dependencyFilter )
- throws InvalidVersionSpecificationException
- {
- Set projectArtifacts = new HashSet();
-
- for ( Object dependency : dependencies )
- {
- Artifact d = (Artifact) dependency;
-
- VersionRange versionRange;
- if ( d.getVersionRange() != null )
- {
- versionRange = d.getVersionRange();
- }
- else
- {
- versionRange = VersionRange.createFromVersionSpec( d.getVersion() );
- }
- Artifact artifact;
- if ( d.getScope().equals( Artifact.SCOPE_TEST ) || d.getScope().equals( Artifact.SCOPE_PROVIDED ) )
- {
- /* don't call createDependencyArtifact as it'll ignore test and provided scopes */
- artifact =
- artifactFactory.createArtifact( d.getGroupId(), d.getArtifactId(), d.getVersion(), d.getScope(),
- d.getType() );
- }
- else
- {
- artifact =
- artifactFactory.createDependencyArtifact( d.getGroupId(), d.getArtifactId(), versionRange,
- d.getType(), d.getClassifier(), d.getScope(),
- inheritedScope, d.isOptional() );
- }
-
- if ( artifact != null && ( dependencyFilter == null || dependencyFilter.include( artifact ) ) )
- {
- artifact.setDependencyFilter( dependencyFilter );
-
- projectArtifacts.add( artifact );
- }
- }
-
- return projectArtifacts;
- }
-
- public void addArtifact( ArtifactSpec spec )
- {
- artifacts.put( getKey( spec.artifact ), spec );
-
- String key = spec.artifact.getDependencyConflictId();
- List artifactVersions = (List) versions.get( key );
- if ( artifactVersions == null )
- {
- artifactVersions = new ArrayList();
- versions.put( key, artifactVersions );
- }
- if ( spec.artifact.getVersion() != null )
- {
- artifactVersions.add( new DefaultArtifactVersion( spec.artifact.getVersion() ) );
- }
- }
-
- public List<ArtifactVersion> retrieveAvailableVersions( Artifact artifact, ArtifactRepository localRepository,
- List<ArtifactRepository> remoteRepositories )
- throws ArtifactMetadataRetrievalException
- {
- return retrieveAvailableVersions( artifact );
- }
-
- public List<ArtifactVersion> retrieveAvailableVersionsFromDeploymentRepository(
- Artifact artifact,
- ArtifactRepository localRepository,
- ArtifactRepository remoteRepository )
- throws ArtifactMetadataRetrievalException
- {
- return retrieveAvailableVersions( artifact );
- }
-
- private List<ArtifactVersion> retrieveAvailableVersions( Artifact artifact )
- {
- List artifactVersions = (List) versions.get( artifact.getDependencyConflictId() );
- if ( artifactVersions == null )
- {
- artifactVersions = Collections.EMPTY_LIST;
- }
- return artifactVersions;
- }
-
- public ResolutionGroup retrieve( MetadataResolutionRequest request )
- throws ArtifactMetadataRetrievalException
- {
- return retrieve( request.getArtifact(), request.getLocalRepository(), request.getRemoteRepositories() );
- }
-
- public List<ArtifactVersion> retrieveAvailableVersions( MetadataResolutionRequest request )
- throws ArtifactMetadataRetrievalException
- {
- return retrieveAvailableVersions( request.getArtifact(), request.getLocalRepository(), request.getRemoteRepositories() );
- }
- }
-}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/AbstractConflictResolverTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/AbstractConflictResolverTest.java
deleted file mode 100644
index bfab0d26..00000000
--- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/AbstractConflictResolverTest.java
+++ /dev/null
@@ -1,143 +0,0 @@
-package org.apache.maven.repository.legacy.resolver.conflict;
-
-/*
- * 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.artifact.Artifact;
-import org.apache.maven.artifact.factory.ArtifactFactory;
-import org.apache.maven.artifact.resolver.ResolutionNode;
-import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
-import org.apache.maven.artifact.versioning.VersionRange;
-import org.apache.maven.repository.legacy.resolver.conflict.ConflictResolver;
-import org.codehaus.plexus.PlexusTestCase;
-
-/**
- * Provides a basis for testing conflict resolvers.
- *
- * @author <a href="mailto:markhobson@gmail.com">Mark Hobson</a>
- */
-public abstract class AbstractConflictResolverTest
- extends PlexusTestCase
-{
- // constants --------------------------------------------------------------
-
- private static final String GROUP_ID = "test";
-
- // fields -----------------------------------------------------------------
-
- protected Artifact a1;
-
- protected Artifact a2;
-
- protected Artifact b1;
-
- private final String roleHint;
-
- private ArtifactFactory artifactFactory;
-
- private ConflictResolver conflictResolver;
-
- // constructors -----------------------------------------------------------
-
- public AbstractConflictResolverTest( String roleHint )
- throws Exception
- {
- this.roleHint = roleHint;
- }
-
- // TestCase methods -------------------------------------------------------
-
- /*
- * @see junit.framework.TestCase#setUp()
- */
- protected void setUp() throws Exception
- {
- super.setUp();
-
- artifactFactory = (ArtifactFactory) lookup( ArtifactFactory.ROLE );
- conflictResolver = (ConflictResolver) lookup( ConflictResolver.ROLE, roleHint );
-
- a1 = createArtifact( "a", "1.0" );
- a2 = createArtifact( "a", "2.0" );
- b1 = createArtifact( "b", "1.0" );
- }
-
- /*
- * @see org.codehaus.plexus.PlexusTestCase#tearDown()
- */
- protected void tearDown() throws Exception
- {
- a1 = null;
- a2 = null;
- b1 = null;
-
- artifactFactory = null;
- conflictResolver = null;
-
- super.tearDown();
- }
-
- // protected methods ------------------------------------------------------
-
- protected ConflictResolver getConflictResolver()
- {
- return conflictResolver;
- }
-
- protected void assertResolveConflict( ResolutionNode expectedNode, ResolutionNode actualNode1, ResolutionNode actualNode2 )
- {
- ResolutionNode resolvedNode = getConflictResolver().resolveConflict( actualNode1, actualNode2 );
-
- assertNotNull( "Expected resolvable", resolvedNode );
- assertEquals( "Resolution node", expectedNode, resolvedNode );
- }
-
- protected void assertUnresolvableConflict( ResolutionNode actualNode1, ResolutionNode actualNode2 )
- {
- ResolutionNode resolvedNode = getConflictResolver().resolveConflict( actualNode1, actualNode2 );
-
- assertNull( "Expected unresolvable", resolvedNode );
- }
-
- protected Artifact createArtifact( String id, String version ) throws InvalidVersionSpecificationException
- {
- return createArtifact( id, version, Artifact.SCOPE_COMPILE );
- }
-
- protected Artifact createArtifact( String id, String version, boolean optional )
- throws InvalidVersionSpecificationException
- {
- return createArtifact( id, version, Artifact.SCOPE_COMPILE, null, optional );
- }
-
- protected Artifact createArtifact( String id, String version, String scope )
- throws InvalidVersionSpecificationException
- {
- return createArtifact( id, version, scope, null, false );
- }
-
- protected Artifact createArtifact( String id, String version, String scope, String inheritedScope, boolean optional )
- throws InvalidVersionSpecificationException
- {
- VersionRange versionRange = VersionRange.createFromVersionSpec( version );
-
- return artifactFactory.createDependencyArtifact( GROUP_ID, id, versionRange, "jar", null, scope,
- inheritedScope, optional );
- }
-}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/FarthestConflictResolverTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/FarthestConflictResolverTest.java
deleted file mode 100644
index 96e283df..00000000
--- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/FarthestConflictResolverTest.java
+++ /dev/null
@@ -1,107 +0,0 @@
-package org.apache.maven.repository.legacy.resolver.conflict;
-
-/*
- * 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 org.apache.maven.artifact.resolver.ResolutionNode;
-import org.apache.maven.repository.legacy.resolver.conflict.FarthestConflictResolver;
-
-/**
- * Tests <code>FarthestConflictResolver</code>.
- *
- * @author <a href="mailto:markhobson@gmail.com">Mark Hobson</a>
- * @see FarthestConflictResolver
- */
-public class FarthestConflictResolverTest
- extends AbstractConflictResolverTest
-{
- // constructors -----------------------------------------------------------
-
- public FarthestConflictResolverTest()
- throws Exception
- {
- super("farthest");
- }
-
- // tests ------------------------------------------------------------------
-
- /**
- * Tests that <code>a:2.0</code> wins in the scenario:
- * <pre>
- * a:1.0
- * b:1.0 -> a:2.0
- * </pre>
- */
- public void testDepth()
- {
- ResolutionNode a1n = new ResolutionNode( a1, Collections.EMPTY_LIST );
- ResolutionNode b1n = new ResolutionNode( b1, Collections.EMPTY_LIST );
- ResolutionNode a2n = new ResolutionNode( a2, Collections.EMPTY_LIST, b1n );
-
- assertResolveConflict( a2n, a1n, a2n );
- }
-
- /**
- * Tests that <code>a:2.0</code> wins in the scenario:
- * <pre>
- * b:1.0 -> a:2.0
- * a:1.0
- * </pre>
- */
- public void testDepthReversed()
- {
- ResolutionNode b1n = new ResolutionNode( b1, Collections.EMPTY_LIST );
- ResolutionNode a2n = new ResolutionNode( a2, Collections.EMPTY_LIST, b1n );
- ResolutionNode a1n = new ResolutionNode( a1, Collections.EMPTY_LIST );
-
- assertResolveConflict( a2n, a2n, a1n );
- }
-
- /**
- * Tests that <code>a:1.0</code> wins in the scenario:
- * <pre>
- * a:1.0
- * a:2.0
- * </pre>
- */
- public void testEqual()
- {
- ResolutionNode a1n = new ResolutionNode( a1, Collections.EMPTY_LIST );
- ResolutionNode a2n = new ResolutionNode( a2, Collections.EMPTY_LIST );
-
- assertResolveConflict( a1n, a1n, a2n );
- }
-
- /**
- * Tests that <code>a:2.0</code> wins in the scenario:
- * <pre>
- * a:2.0
- * a:1.0
- * </pre>
- */
- public void testEqualReversed()
- {
- ResolutionNode a2n = new ResolutionNode( a2, Collections.EMPTY_LIST );
- ResolutionNode a1n = new ResolutionNode( a1, Collections.EMPTY_LIST );
-
- assertResolveConflict( a2n, a2n, a1n );
- }
-}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/NearestConflictResolverTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/NearestConflictResolverTest.java
deleted file mode 100644
index 0c7b035f..00000000
--- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/NearestConflictResolverTest.java
+++ /dev/null
@@ -1,107 +0,0 @@
-package org.apache.maven.repository.legacy.resolver.conflict;
-
-/*
- * 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 org.apache.maven.artifact.resolver.ResolutionNode;
-import org.apache.maven.repository.legacy.resolver.conflict.NearestConflictResolver;
-
-/**
- * Tests <code>NearestConflictResolver</code>.
- *
- * @author <a href="mailto:markhobson@gmail.com">Mark Hobson</a>
- * @see NearestConflictResolver
- */
-public class NearestConflictResolverTest
- extends AbstractConflictResolverTest
-{
- // constructors -----------------------------------------------------------
-
- public NearestConflictResolverTest()
- throws Exception
- {
- super("nearest");
- }
-
- // tests ------------------------------------------------------------------
-
- /**
- * Tests that <code>a:1.0</code> wins in the scenario:
- * <pre>
- * a:1.0
- * b:1.0 -> a:2.0
- * </pre>
- */
- public void testDepth()
- {
- ResolutionNode a1n = new ResolutionNode( a1, Collections.EMPTY_LIST );
- ResolutionNode b1n = new ResolutionNode( b1, Collections.EMPTY_LIST );
- ResolutionNode a2n = new ResolutionNode( a2, Collections.EMPTY_LIST, b1n );
-
- assertResolveConflict( a1n, a1n, a2n );
- }
-
- /**
- * Tests that <code>a:1.0</code> wins in the scenario:
- * <pre>
- * b:1.0 -> a:2.0
- * a:1.0
- * </pre>
- */
- public void testDepthReversed()
- {
- ResolutionNode b1n = new ResolutionNode( b1, Collections.EMPTY_LIST );
- ResolutionNode a2n = new ResolutionNode( a2, Collections.EMPTY_LIST, b1n );
- ResolutionNode a1n = new ResolutionNode( a1, Collections.EMPTY_LIST );
-
- assertResolveConflict( a1n, a2n, a1n );
- }
-
- /**
- * Tests that <code>a:1.0</code> wins in the scenario:
- * <pre>
- * a:1.0
- * a:2.0
- * </pre>
- */
- public void testEqual()
- {
- ResolutionNode a1n = new ResolutionNode( a1, Collections.EMPTY_LIST );
- ResolutionNode a2n = new ResolutionNode( a2, Collections.EMPTY_LIST );
-
- assertResolveConflict( a1n, a1n, a2n );
- }
-
- /**
- * Tests that <code>a:2.0</code> wins in the scenario:
- * <pre>
- * a:2.0
- * a:1.0
- * </pre>
- */
- public void testEqualReversed()
- {
- ResolutionNode a2n = new ResolutionNode( a2, Collections.EMPTY_LIST );
- ResolutionNode a1n = new ResolutionNode( a1, Collections.EMPTY_LIST );
-
- assertResolveConflict( a2n, a2n, a1n );
- }
-}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/NewestConflictResolverTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/NewestConflictResolverTest.java
deleted file mode 100644
index 68d19d6c..00000000
--- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/NewestConflictResolverTest.java
+++ /dev/null
@@ -1,107 +0,0 @@
-package org.apache.maven.repository.legacy.resolver.conflict;
-
-/*
- * 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 org.apache.maven.artifact.resolver.ResolutionNode;
-import org.apache.maven.repository.legacy.resolver.conflict.NewestConflictResolver;
-
-/**
- * Tests <code>NewestConflictResolver</code>.
- *
- * @author <a href="mailto:markhobson@gmail.com">Mark Hobson</a>
- * @see NewestConflictResolver
- */
-public class NewestConflictResolverTest
- extends AbstractConflictResolverTest
-{
- // constructors -----------------------------------------------------------
-
- public NewestConflictResolverTest()
- throws Exception
- {
- super("newest");
- }
-
- // tests ------------------------------------------------------------------
-
- /**
- * Tests that <code>a:2.0</code> wins in the scenario:
- * <pre>
- * a:1.0
- * b:1.0 -> a:2.0
- * </pre>
- */
- public void testDepth()
- {
- ResolutionNode a1n = new ResolutionNode( a1, Collections.EMPTY_LIST );
- ResolutionNode b1n = new ResolutionNode( b1, Collections.EMPTY_LIST );
- ResolutionNode a2n = new ResolutionNode( a2, Collections.EMPTY_LIST, b1n );
-
- assertResolveConflict( a2n, a1n, a2n );
- }
-
- /**
- * Tests that <code>a:2.0</code> wins in the scenario:
- * <pre>
- * b:1.0 -> a:2.0
- * a:1.0
- * </pre>
- */
- public void testDepthReversed()
- {
- ResolutionNode b1n = new ResolutionNode( b1, Collections.EMPTY_LIST );
- ResolutionNode a2n = new ResolutionNode( a2, Collections.EMPTY_LIST, b1n );
- ResolutionNode a1n = new ResolutionNode( a1, Collections.EMPTY_LIST );
-
- assertResolveConflict( a2n, a2n, a1n );
- }
-
- /**
- * Tests that <code>a:2.0</code> wins in the scenario:
- * <pre>
- * a:1.0
- * a:2.0
- * </pre>
- */
- public void testEqual()
- {
- ResolutionNode a1n = new ResolutionNode( a1, Collections.EMPTY_LIST );
- ResolutionNode a2n = new ResolutionNode( a2, Collections.EMPTY_LIST );
-
- assertResolveConflict( a2n, a1n, a2n );
- }
-
- /**
- * Tests that <code>a:2.0</code> wins in the scenario:
- * <pre>
- * a:2.0
- * a:1.0
- * </pre>
- */
- public void testEqualReversed()
- {
- ResolutionNode a2n = new ResolutionNode( a2, Collections.EMPTY_LIST );
- ResolutionNode a1n = new ResolutionNode( a1, Collections.EMPTY_LIST );
-
- assertResolveConflict( a2n, a2n, a1n );
- }
-}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/OldestConflictResolverTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/OldestConflictResolverTest.java
deleted file mode 100644
index 6b06d34e..00000000
--- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/OldestConflictResolverTest.java
+++ /dev/null
@@ -1,107 +0,0 @@
-package org.apache.maven.repository.legacy.resolver.conflict;
-
-/*
- * 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 org.apache.maven.artifact.resolver.ResolutionNode;
-import org.apache.maven.repository.legacy.resolver.conflict.OldestConflictResolver;
-
-/**
- * Tests <code>OldestConflictResolver</code>.
- *
- * @author <a href="mailto:markhobson@gmail.com">Mark Hobson</a>
- * @see OldestConflictResolver
- */
-public class OldestConflictResolverTest
- extends AbstractConflictResolverTest
-{
- // constructors -----------------------------------------------------------
-
- public OldestConflictResolverTest()
- throws Exception
- {
- super("oldest");
- }
-
- // tests ------------------------------------------------------------------
-
- /**
- * Tests that <code>a:1.0</code> wins in the scenario:
- * <pre>
- * a:1.0
- * b:1.0 -> a:2.0
- * </pre>
- */
- public void testDepth()
- {
- ResolutionNode a1n = new ResolutionNode( a1, Collections.EMPTY_LIST );
- ResolutionNode b1n = new ResolutionNode( b1, Collections.EMPTY_LIST );
- ResolutionNode a2n = new ResolutionNode( a2, Collections.EMPTY_LIST, b1n );
-
- assertResolveConflict( a1n, a1n, a2n );
- }
-
- /**
- * Tests that <code>a:1.0</code> wins in the scenario:
- * <pre>
- * b:1.0 -> a:2.0
- * a:1.0
- * </pre>
- */
- public void testDepthReversed()
- {
- ResolutionNode b1n = new ResolutionNode( b1, Collections.EMPTY_LIST );
- ResolutionNode a2n = new ResolutionNode( a2, Collections.EMPTY_LIST, b1n );
- ResolutionNode a1n = new ResolutionNode( a1, Collections.EMPTY_LIST );
-
- assertResolveConflict( a1n, a2n, a1n );
- }
-
- /**
- * Tests that <code>a:1.0</code> wins in the scenario:
- * <pre>
- * a:1.0
- * a:2.0
- * </pre>
- */
- public void testEqual()
- {
- ResolutionNode a1n = new ResolutionNode( a1, Collections.EMPTY_LIST );
- ResolutionNode a2n = new ResolutionNode( a2, Collections.EMPTY_LIST );
-
- assertResolveConflict( a1n, a1n, a2n );
- }
-
- /**
- * Tests that <code>a:1.0</code> wins in the scenario:
- * <pre>
- * a:2.0
- * a:1.0
- * </pre>
- */
- public void testEqualReversed()
- {
- ResolutionNode a2n = new ResolutionNode( a2, Collections.EMPTY_LIST );
- ResolutionNode a1n = new ResolutionNode( a1, Collections.EMPTY_LIST );
-
- assertResolveConflict( a1n, a2n, a1n );
- }
-}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/metadata/DefaultClasspathTransformationTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/metadata/DefaultClasspathTransformationTest.java
deleted file mode 100644
index 4f40516c..00000000
--- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/metadata/DefaultClasspathTransformationTest.java
+++ /dev/null
@@ -1,120 +0,0 @@
-package org.apache.maven.repository.metadata;
-
-/*
- * 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.artifact.ArtifactScopeEnum;
-import org.apache.maven.repository.metadata.ArtifactMetadata;
-import org.apache.maven.repository.metadata.ClasspathContainer;
-import org.apache.maven.repository.metadata.ClasspathTransformation;
-import org.apache.maven.repository.metadata.MetadataGraph;
-import org.apache.maven.repository.metadata.MetadataGraphEdge;
-import org.apache.maven.repository.metadata.MetadataGraphVertex;
-import org.codehaus.plexus.PlexusTestCase;
-
-/**
- *
- * @author <a href="mailto:oleg@codehaus.org">Oleg Gusakov</a>
- *
- */
-
-public class DefaultClasspathTransformationTest
-extends PlexusTestCase
-{
- ClasspathTransformation transform;
-
- MetadataGraph graph;
-
- MetadataGraphVertex v1;
- MetadataGraphVertex v2;
- MetadataGraphVertex v3;
- MetadataGraphVertex v4;
- //------------------------------------------------------------------------------------------
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
- transform = (ClasspathTransformation) lookup( ClasspathTransformation.ROLE, "default" );
-
- graph = new MetadataGraph( 4, 3 );
- /*
- * v2
- * v1<
- * v3-v4
- *
- */
- v1 = graph.addVertex(new ArtifactMetadata("g","a1","1.0"));
- graph.setEntry(v1);
- v2 = graph.addVertex(new ArtifactMetadata("g","a2","1.0"));
- v3 = graph.addVertex(new ArtifactMetadata("g","a3","1.0"));
- v4 = graph.addVertex(new ArtifactMetadata("g","a4","1.0"));
-
- // v1-->v2
- graph.addEdge(v1, v2, new MetadataGraphEdge( "1.1", true, null, null, 2, 1 ) );
- graph.addEdge(v1, v2, new MetadataGraphEdge( "1.2", true, null, null, 2, 2 ) );
-
- // v1-->v3
- graph.addEdge(v1, v3, new MetadataGraphEdge( "1.1", true, null, null, 2, 1 ) );
- graph.addEdge(v1, v3, new MetadataGraphEdge( "1.2", true, null, null, 4, 2 ) );
-
- // v3-->v4
- graph.addEdge(v3, v4, new MetadataGraphEdge( "1.1", true, ArtifactScopeEnum.runtime, null, 2, 2 ) );
- graph.addEdge(v3, v4, new MetadataGraphEdge( "1.2", true, ArtifactScopeEnum.test, null, 2, 2 ) );
- }
- //------------------------------------------------------------------------------------------
- public void testCompileClasspathTransform()
- throws Exception
- {
- ClasspathContainer res;
-
- res = transform.transform( graph, ArtifactScopeEnum.compile, false );
-
- assertNotNull("null classpath container after compile transform", res );
- assertNotNull("null classpath after compile transform", res.getClasspath() );
- assertEquals("compile classpath should have 3 entries", 3, res.getClasspath().size() );
- }
- //------------------------------------------------------------------------------------------
- public void testRuntimeClasspathTransform()
- throws Exception
- {
- ClasspathContainer res;
-
- res = transform.transform( graph, ArtifactScopeEnum.runtime, false );
-
- assertNotNull("null classpath container after runtime transform", res );
- assertNotNull("null classpath after runtime transform", res.getClasspath() );
- assertEquals("runtime classpath should have 4 entries", 4, res.getClasspath().size() );
-
- ArtifactMetadata md = res.getClasspath().get(3);
- assertEquals("runtime artifact version should be 1.1", "1.1", md.getVersion() );
- }
- //------------------------------------------------------------------------------------------
- public void testTestClasspathTransform()
- throws Exception
- {
- ClasspathContainer res;
-
- res = transform.transform( graph, ArtifactScopeEnum.test, false );
-
- assertNotNull("null classpath container after runtime transform", res );
- assertNotNull("null classpath after runtime transform", res.getClasspath() );
- assertEquals("runtime classpath should have 4 entries", 4, res.getClasspath().size() );
-
- ArtifactMetadata md = res.getClasspath().get(3);
- assertEquals("test artifact version should be 1.2", "1.2", md.getVersion() );
- }
- //------------------------------------------------------------------------------------------
- //------------------------------------------------------------------------------------------
-}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolutionPolicyTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolutionPolicyTest.java
deleted file mode 100644
index 31832c33..00000000
--- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolutionPolicyTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package org.apache.maven.repository.metadata;
-
-/*
- * 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.metadata.GraphConflictResolutionPolicy;
-import org.apache.maven.repository.metadata.MetadataGraphEdge;
-import org.codehaus.plexus.PlexusTestCase;
-
-/**
- *
- * @author <a href="mailto:oleg@codehaus.org">Oleg Gusakov</a>
- *
- */
-
-public class DefaultGraphConflictResolutionPolicyTest
-extends PlexusTestCase
-{
- GraphConflictResolutionPolicy policy;
- MetadataGraphEdge e1;
- MetadataGraphEdge e2;
- MetadataGraphEdge e3;
- //------------------------------------------------------------------------------------------
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
- policy = (GraphConflictResolutionPolicy) lookup( GraphConflictResolutionPolicy.ROLE, "default" );
- e1 = new MetadataGraphEdge( "1.1", true, null, null, 2, 1 );
- e2 = new MetadataGraphEdge( "1.2", true, null, null, 3, 2 );
- e3 = new MetadataGraphEdge( "1.2", true, null, null, 2, 3 );
- }
- //------------------------------------------------------------------------------------------
- public void testDefaultPolicy()
- throws Exception
- {
- MetadataGraphEdge res;
-
- res = policy.apply( e1, e2 );
- assertEquals( "Wrong depth edge selected", "1.1", res.getVersion() );
-
- res = policy.apply( e1, e3 );
- assertEquals( "Wrong version edge selected", "1.2", res.getVersion() );
- }
- //------------------------------------------------------------------------------------------
- //------------------------------------------------------------------------------------------
-}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolverTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolverTest.java
deleted file mode 100644
index 4fba8f54..00000000
--- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolverTest.java
+++ /dev/null
@@ -1,153 +0,0 @@
-package org.apache.maven.repository.metadata;
-
-/*
- * 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.artifact.ArtifactScopeEnum;
-import org.apache.maven.repository.metadata.ArtifactMetadata;
-import org.apache.maven.repository.metadata.GraphConflictResolver;
-import org.apache.maven.repository.metadata.MetadataGraph;
-import org.apache.maven.repository.metadata.MetadataGraphEdge;
-import org.apache.maven.repository.metadata.MetadataGraphVertex;
-import org.codehaus.plexus.PlexusTestCase;
-import org.codehaus.plexus.logging.Logger;
-
-/**
- *
- * @author <a href="mailto:oleg@codehaus.org">Oleg Gusakov</a>
- *
- */
-
-public class DefaultGraphConflictResolverTest
-extends PlexusTestCase
-{
- Logger log;
-
- GraphConflictResolver resolver;
-
- MetadataGraph graph;
-
- MetadataGraphVertex v1;
- MetadataGraphVertex v2;
- MetadataGraphVertex v3;
- MetadataGraphVertex v4;
- //------------------------------------------------------------------------------------------
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
- resolver = (GraphConflictResolver) lookup( GraphConflictResolver.ROLE, "default" );
-
- /*
- * v2
- * v1<
- * v3-v4
- *
- */
- graph = new MetadataGraph( 4, 3 );
- v1 = graph.addVertex(new ArtifactMetadata("g","a1","1.0"));
- graph.setEntry(v1);
- v2 = graph.addVertex(new ArtifactMetadata("g","a2","1.0"));
- v3 = graph.addVertex(new ArtifactMetadata("g","a3","1.0"));
- v4 = graph.addVertex(new ArtifactMetadata("g","a4","1.0"));
-
- // v1-->v2
- graph.addEdge(v1, v2, new MetadataGraphEdge( "1.1", true, null, null, 2, 1 ) );
- graph.addEdge(v1, v2, new MetadataGraphEdge( "1.2", true, null, null, 2, 2 ) );
-
- // v1-->v3
- graph.addEdge(v1, v3, new MetadataGraphEdge( "1.1", true, null, null, 2, 1 ) );
- graph.addEdge(v1, v3, new MetadataGraphEdge( "1.2", true, null, null, 4, 2 ) );
-
- // v3-->v4
- graph.addEdge(v3, v4, new MetadataGraphEdge( "1.1", true, ArtifactScopeEnum.runtime, null, 2, 1 ) );
- graph.addEdge(v3, v4, new MetadataGraphEdge( "1.2", true, ArtifactScopeEnum.provided, null, 2, 2 ) );
- }
- //------------------------------------------------------------------------------------------
- public void testCompileResolution()
- throws Exception
- {
- MetadataGraph res;
-
- res = resolver.resolveConflicts( graph, ArtifactScopeEnum.compile );
-
- assertNotNull("null graph after resolver", res );
- assertNotNull("no vertices in the resulting graph after resolver", res.getVertices() );
-
- assertNotNull("no edges in the resulting graph after resolver", res.getExcidentEdges(v1) );
-
- assertEquals( "wrong # of vertices in the resulting graph after resolver", 4, res.getVertices().size() );
- assertEquals( "wrong # of excident edges in the resulting graph entry after resolver", 2, res.getExcidentEdges(v1).size() );
-
- assertEquals( "wrong # of v2 incident edges in the resulting graph after resolver", 1, res.getIncidentEdges(v2).size() );
- assertEquals( "wrong edge v1-v2 in the resulting graph after resolver", "1.2", res.getIncidentEdges(v2).get(0).getVersion() );
-
- assertEquals( "wrong # of edges v1-v3 in the resulting graph after resolver", 1, res.getIncidentEdges(v3).size() );
- assertEquals( "wrong edge v1-v3 in the resulting graph after resolver", "1.1", res.getIncidentEdges(v3).get(0).getVersion() );
-
- assertEquals( "wrong # of edges v3-v4 in the resulting graph after resolver", 1, res.getIncidentEdges(v4).size() );
- assertEquals( "wrong edge v3-v4 in the resulting graph after resolver", "1.2", res.getIncidentEdges(v4).get(0).getVersion() );
- }
- //------------------------------------------------------------------------------------------
- public void testRuntimeResolution()
- throws Exception
- {
- MetadataGraph res;
-
- res = resolver.resolveConflicts( graph, ArtifactScopeEnum.runtime );
-
- assertNotNull("null graph after resolver", res );
- assertNotNull("no vertices in the resulting graph after resolver", res.getVertices() );
- assertNotNull("no edges in the resulting graph after resolver", res.getExcidentEdges(v1) );
-
- assertEquals( "wrong # of vertices in the resulting graph after resolver", 4, res.getVertices().size() );
- assertEquals( "wrong # of excident edges in the resulting graph entry after resolver", 2, res.getExcidentEdges(v1).size() );
-
- assertEquals( "wrong # of v2 incident edges in the resulting graph after resolver", 1, res.getIncidentEdges(v2).size() );
- assertEquals( "wrong edge v1-v2 in the resulting graph after resolver", "1.2", res.getIncidentEdges(v2).get(0).getVersion() );
-
- assertEquals( "wrong # of edges v1-v3 in the resulting graph after resolver", 1, res.getIncidentEdges(v3).size() );
- assertEquals( "wrong edge v1-v3 in the resulting graph after resolver", "1.1", res.getIncidentEdges(v3).get(0).getVersion() );
-
- assertEquals( "wrong # of edges v3-v4 in the resulting graph after resolver", 1, res.getIncidentEdges(v4).size() );
- assertEquals( "wrong edge v3-v4 in the resulting graph after resolver", "1.1", res.getIncidentEdges(v4).get(0).getVersion() );
- }
- //------------------------------------------------------------------------------------------
- public void testTestResolution()
- throws Exception
- {
- MetadataGraph res;
-
- res = resolver.resolveConflicts( graph, ArtifactScopeEnum.test );
-
- assertNotNull("null graph after resolver", res );
- assertNotNull("no vertices in the resulting graph after resolver", res.getVertices() );
- assertNotNull("no edges in the resulting graph after resolver", res.getExcidentEdges(v1) );
-
- assertEquals( "wrong # of vertices in the resulting graph after resolver", 4, res.getVertices().size() );
- assertEquals( "wrong # of excident edges in the resulting graph entry after resolver", 2, res.getExcidentEdges(v1).size() );
-
- assertEquals( "wrong # of v2 incident edges in the resulting graph after resolver", 1, res.getIncidentEdges(v2).size() );
- assertEquals( "wrong edge v1-v2 in the resulting graph after resolver", "1.2", res.getIncidentEdges(v2).get(0).getVersion() );
-
- assertEquals( "wrong # of edges v1-v3 in the resulting graph after resolver", 1, res.getIncidentEdges(v3).size() );
- assertEquals( "wrong edge v1-v3 in the resulting graph after resolver", "1.1", res.getIncidentEdges(v3).get(0).getVersion() );
-
- assertEquals( "wrong # of edges v3-v4 in the resulting graph after resolver", 1, res.getIncidentEdges(v4).size() );
- assertEquals( "wrong edge v3-v4 in the resulting graph after resolver", "1.2", res.getIncidentEdges(v4).get(0).getVersion() );
- }
- //------------------------------------------------------------------------------------------
- //------------------------------------------------------------------------------------------
-}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/metadata/TestMetadataSource.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/metadata/TestMetadataSource.java
deleted file mode 100644
index dd9a9001..00000000
--- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/metadata/TestMetadataSource.java
+++ /dev/null
@@ -1,99 +0,0 @@
-package org.apache.maven.repository.metadata;
-
-/*
- * 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.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.factory.ArtifactFactory;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.versioning.ArtifactVersion;
-import org.apache.maven.repository.legacy.metadata.ArtifactMetadataRetrievalException;
-import org.apache.maven.repository.legacy.metadata.ArtifactMetadataSource;
-import org.apache.maven.repository.legacy.metadata.MetadataResolutionRequest;
-import org.apache.maven.repository.legacy.metadata.ResolutionGroup;
-import org.codehaus.plexus.component.annotations.Component;
-import org.codehaus.plexus.component.annotations.Requirement;
-
-@Component(role = ArtifactMetadataSource.class)
-public class TestMetadataSource
- implements ArtifactMetadataSource
-{
- @Requirement
- private ArtifactFactory factory;
-
- public ResolutionGroup retrieve( Artifact artifact, ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories )
- throws ArtifactMetadataRetrievalException
- {
- Set dependencies = new HashSet();
-
- if ( "g".equals( artifact.getArtifactId() ) )
- {
- Artifact a = null;
- try
- {
- a = factory.createBuildArtifact( "org.apache.maven", "h", "1.0", "jar" );
- dependencies.add( a );
- }
- catch ( Exception e )
- {
- throw new ArtifactMetadataRetrievalException( "Error retrieving metadata", e, a );
- }
- }
-
- if ( "i".equals( artifact.getArtifactId() ) )
- {
- Artifact a = null;
- try
- {
- a = factory.createBuildArtifact( "org.apache.maven", "j", "1.0-SNAPSHOT", "jar" );
- dependencies.add( a );
- }
- catch ( Exception e )
- {
- throw new ArtifactMetadataRetrievalException( "Error retrieving metadata", e, a );
- }
- }
-
-
- return new ResolutionGroup( artifact, dependencies, remoteRepositories );
- }
-
- public List<ArtifactVersion> retrieveAvailableVersions( Artifact artifact, ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories )
- throws ArtifactMetadataRetrievalException
- {
- throw new UnsupportedOperationException( "Cannot get available versions in this test case" );
- }
-
- public List<ArtifactVersion> retrieveAvailableVersionsFromDeploymentRepository( Artifact artifact, ArtifactRepository localRepository, ArtifactRepository remoteRepository )
- throws ArtifactMetadataRetrievalException
- {
- throw new UnsupportedOperationException( "Cannot get available versions in this test case" );
- }
-
- public ResolutionGroup retrieve( MetadataResolutionRequest request )
- throws ArtifactMetadataRetrievalException
- {
- return retrieve( request.getArtifact(), request.getLocalRepository(), request.getRemoteRepositories() );
- }
-
-}