This is an automated email from the ASF dual-hosted git repository. elharo pushed a commit to branch comment in repository https://gitbox.apache.org/repos/asf/maven.git
commit e9f8c4f72432082d4e8761c4d2786ba4e4785264 Author: Elliotte Rusty Harold <elh...@ibiblio.org> AuthorDate: Fri Mar 28 08:51:09 2025 -0400 Remove a few tbousand lines of commented and obslete code --- .../artifact/versioning/VersionRangeTest.java | 6 - .../artifact/resolver/ResolutionListener.java | 6 - .../StringSearchModelInterpolator.java | 5 - .../project/validation/ModelValidationResult.java | 10 - .../repository/legacy/LegacyRepositorySystem.java | 16 - .../repository/metadata/ArtifactMetadata.java | 22 +- .../metadata/DefaultClasspathTransformation.java | 21 -- .../metadata/DefaultGraphConflictResolver.java | 11 - .../repository/metadata/MetadataGraphVertex.java | 6 - .../settings/DefaultMavenSettingsBuilder.java | 7 - .../apache/maven/toolchain/java/JavaToolchain.java | 36 +-- .../maven/ProjectDependenciesResolverTest.java | 25 -- .../manager/DefaultProfileManagerTest.java | 32 -- .../project/artifact/MavenMetadataSourceTest.java | 176 ----------- .../inheritance/t12scm/ProjectInheritanceTest.java | 47 --- .../AbstractModelInterpolatorTest.java | 15 - .../apache/maven/model/merge/MavenMergerTest.java | 347 --------------------- .../internal/concurrent/BuildPlanLogger.java | 8 - .../internal/stub/ProjectDependencyGraphStub.java | 4 - .../org/apache/maven/plugin/PluginManagerTest.java | 97 ------ .../apache/maven/project/PomConstructionTest.java | 21 -- .../maven/project/harness/PomTestWrapper.java | 11 - .../impl/DefaultSettingsBuilderFactoryTest.java | 5 - .../maven/impl/DefaultSettingsValidatorTest.java | 161 ---------- .../impl/model/DefaultModelInterpolatorTest.java | 15 - .../profile/ConditionProfileActivatorTest.java | 19 -- .../apache/maven/impl/standalone/ApiRunner.java | 9 - .../org/apache/maven/slf4j/MavenBaseLogger.java | 32 -- 28 files changed, 2 insertions(+), 1168 deletions(-) diff --git a/compat/maven-artifact/src/test/java/org/apache/maven/artifact/versioning/VersionRangeTest.java b/compat/maven-artifact/src/test/java/org/apache/maven/artifact/versioning/VersionRangeTest.java index 426efcf537..8ccf5bcca4 100644 --- a/compat/maven-artifact/src/test/java/org/apache/maven/artifact/versioning/VersionRangeTest.java +++ b/compat/maven-artifact/src/test/java/org/apache/maven/artifact/versioning/VersionRangeTest.java @@ -720,12 +720,6 @@ public boolean enforceVersion(String requiredVersionRange, ArtifactVersion actua return vr.containsVersion(actualVersion); } - @Test - void testOrder0() { - // assertTrue( new DefaultArtifactVersion( "1.0-alpha10" ).compareTo( new DefaultArtifactVersion( "1.0-alpha1" ) - // ) > 0 ); - } - @Test void testCache() throws InvalidVersionSpecificationException { VersionRange range = VersionRange.createFromVersionSpec("[1.0,1.2]"); diff --git a/compat/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ResolutionListener.java b/compat/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ResolutionListener.java index 5015ff2807..f292039f8f 100644 --- a/compat/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ResolutionListener.java +++ b/compat/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ResolutionListener.java @@ -23,7 +23,6 @@ /** * Listens to the resolution process and handles events. - * */ @Deprecated public interface ResolutionListener { @@ -77,13 +76,8 @@ public interface ResolutionListener { @Deprecated void manageArtifact(Artifact artifact, Artifact replacement); - // TODO Use the following two instead of manageArtifact // TODO Remove ResolutionListenerDM interface - // void manageArtifactVersion( Artifact artifact, Artifact replacement ); - - // void manageArtifactScope( Artifact artifact, Artifact replacement ); - void omitForCycle(Artifact artifact); /** diff --git a/compat/maven-compat/src/main/java/org/apache/maven/project/interpolation/StringSearchModelInterpolator.java b/compat/maven-compat/src/main/java/org/apache/maven/project/interpolation/StringSearchModelInterpolator.java index d63cbec5c1..9e70e0c49c 100644 --- a/compat/maven-compat/src/main/java/org/apache/maven/project/interpolation/StringSearchModelInterpolator.java +++ b/compat/maven-compat/src/main/java/org/apache/maven/project/interpolation/StringSearchModelInterpolator.java @@ -273,11 +273,6 @@ private boolean isQualifiedForInterpolation(Field field, Class<?> fieldType) { return false; } - // if ( fieldType.isPrimitive() ) - // { - // return false; - // } - return !"parent".equals(field.getName()); } diff --git a/compat/maven-compat/src/main/java/org/apache/maven/project/validation/ModelValidationResult.java b/compat/maven-compat/src/main/java/org/apache/maven/project/validation/ModelValidationResult.java index bc305cb2a0..3a0694c9ac 100644 --- a/compat/maven-compat/src/main/java/org/apache/maven/project/validation/ModelValidationResult.java +++ b/compat/maven-compat/src/main/java/org/apache/maven/project/validation/ModelValidationResult.java @@ -63,16 +63,6 @@ public String render(String indentation) { } StringBuilder message = new StringBuilder(); - - // if ( messages.size() == 1 ) - // { - // message.append( "There was 1 validation error: " ); - // } - // else - // { - // message.append( "There was " + messages.size() + " validation errors: " + LS ); - // } - // for (int i = 0; i < messages.size(); i++) { message.append(indentation) .append('[') diff --git a/compat/maven-compat/src/main/java/org/apache/maven/repository/legacy/LegacyRepositorySystem.java b/compat/maven-compat/src/main/java/org/apache/maven/repository/legacy/LegacyRepositorySystem.java index df994b12d3..9f6191c9fb 100644 --- a/compat/maven-compat/src/main/java/org/apache/maven/repository/legacy/LegacyRepositorySystem.java +++ b/compat/maven-compat/src/main/java/org/apache/maven/repository/legacy/LegacyRepositorySystem.java @@ -331,22 +331,6 @@ public ArtifactResolutionResult resolve(ArtifactResolutionRequest request) { return artifactResolver.resolve(request); } - // public void addProxy( String protocol, String host, int port, String username, String password, - // String nonProxyHosts ) - // { - // ProxyInfo proxyInfo = new ProxyInfo(); - // proxyInfo.setHost( host ); - // proxyInfo.setType( protocol ); - // proxyInfo.setPort( port ); - // proxyInfo.setNonProxyHosts( nonProxyHosts ); - // proxyInfo.setUserName( username ); - // proxyInfo.setPassword( password ); - // - // proxies.put( protocol, proxyInfo ); - // - // wagonManager.addProxy( protocol, host, port, username, password, nonProxyHosts ); - // } - public List<ArtifactRepository> getEffectiveRepositories(List<ArtifactRepository> repositories) { if (repositories == null) { return null; diff --git a/compat/maven-compat/src/main/java/org/apache/maven/repository/metadata/ArtifactMetadata.java b/compat/maven-compat/src/main/java/org/apache/maven/repository/metadata/ArtifactMetadata.java index b0a231f3df..a808e2be8c 100644 --- a/compat/maven-compat/src/main/java/org/apache/maven/repository/metadata/ArtifactMetadata.java +++ b/compat/maven-compat/src/main/java/org/apache/maven/repository/metadata/ArtifactMetadata.java @@ -169,27 +169,7 @@ public ArtifactMetadata( error); } - public ArtifactMetadata(Artifact af) { - /* - if ( af != null ) - { - init( af ); - } - */ - } - // ------------------------------------------------------------------ - // public void init( ArtifactMetadata af ) - // { - // setGroupId( af.getGroupId() ); - // setArtifactId( af.getArtifactId() ); - // setVersion( af.getVersion() ); - // setType( af.getType() ); - // setScope( af.getScope() ); - // setClassifier( af.getClassifier() ); - // //setUri( af.getDownloadUrl() ); - // - // this.resolved = af.isResolved(); - // } + public ArtifactMetadata(Artifact af) {} @Override public String toString() { diff --git a/compat/maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultClasspathTransformation.java b/compat/maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultClasspathTransformation.java index 5a41c607d7..0a23b4b7e5 100644 --- a/compat/maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultClasspathTransformation.java +++ b/compat/maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultClasspathTransformation.java @@ -101,27 +101,6 @@ protected void visit(MetadataGraphVertex node) // , String version, String artif } cpc.add(md); - // - // TreeSet<MetadataGraphEdge> deps = new TreeSet<MetadataGraphEdge>( - // new Comparator<MetadataGraphEdge>() - // { - // public int compare( MetadataGraphEdge e1 - // , MetadataGraphEdge e2 - // ) - // { - // if( e1.getDepth() == e2.getDepth() ) - // { - // if( e2.getPomOrder() == e1.getPomOrder() ) - // return - // e1.getTarget().toString().compareTo(e2.getTarget().toString() ); - // - // return e2.getPomOrder() - e1.getPomOrder(); - // } - // - // return e2.getDepth() - e1.getDepth(); - // } - // } - // ); List<MetadataGraphEdge> exits = graph.getExcidentEdges(node); diff --git a/compat/maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolver.java b/compat/maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolver.java index 55bad67432..60dc8a593c 100644 --- a/compat/maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolver.java +++ b/compat/maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolver.java @@ -94,15 +94,8 @@ public MetadataGraph resolveConflicts(MetadataGraph graph, ArtifactScopeEnum sco if (entry.equals(v)) { // unless it's an entry point. // currently processing the entry point - it should not have any entry incident edges res.getEntry().getMd().setWhy("This is a graph entry point. No links."); - } else { - // System.out.println("--->"+v.getMd().toDomainString() - // +" has been terminated on this entry set\n-------------------\n" - // +ins - // +"\n-------------------\n" - // ); } } else { - // System.out.println("+++>"+v.getMd().toDomainString()+" still has "+edge.toString() ); // fill in domain md with actual version data ArtifactMetadata md = v.getMd(); ArtifactMetadata newMd = new ArtifactMetadata( @@ -126,10 +119,6 @@ public MetadataGraph resolveConflicts(MetadataGraph graph, ArtifactScopeEnum sco res.addEdge(sourceV, newV, edge); } } - // System.err.println("Original graph("+graph.getVertices().size()+"):\n"+graph.toString()); - // System.err.println("Cleaned("+requestedScope+") graph("+res.getVertices().size()+"):\n"+res.toString()); - // System.err.println("Linked("+requestedScope+") - // subgraph("+linkedRes.getVertices().size()+"):\n"+linkedRes.toString()); return findLinkedSubgraph(res); } catch (MetadataResolutionException e) { throw new GraphConflictResolutionException(e); diff --git a/compat/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphVertex.java b/compat/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphVertex.java index edbfae8534..aec802d7f8 100644 --- a/compat/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphVertex.java +++ b/compat/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphVertex.java @@ -168,11 +168,5 @@ public int hashCode() { } return hashString.toString().hashCode(); - - // BASE64Encoder b64 = new BASE64Encoder(); - // return b64.encode( hashString.toString().getBytes() ).hashCode(); } - - // --------------------------------------------------------------------- - // --------------------------------------------------------------------- } diff --git a/compat/maven-compat/src/main/java/org/apache/maven/settings/DefaultMavenSettingsBuilder.java b/compat/maven-compat/src/main/java/org/apache/maven/settings/DefaultMavenSettingsBuilder.java index c669fcc449..2df142e9b9 100644 --- a/compat/maven-compat/src/main/java/org/apache/maven/settings/DefaultMavenSettingsBuilder.java +++ b/compat/maven-compat/src/main/java/org/apache/maven/settings/DefaultMavenSettingsBuilder.java @@ -125,13 +125,6 @@ private File getFile(String pathPattern, String basedirSysProp, String altLocati // basedirSysProp is non regexp and basedir too path = pathPattern.replace("${" + basedirSysProp + "}", basedir); path = path.replace("\\", "/"); - // --------------------------------------------------------------------------------- - // I'm not sure if this last regexp was really intended to disallow the usage of - // network paths as user.home directory. Unfortunately it did. I removed it and - // have not detected any problems yet. - // --------------------------------------------------------------------------------- - // path = path.replaceAll( "//", "/" ); - } return new File(path).getAbsoluteFile(); } diff --git a/compat/maven-compat/src/main/java/org/apache/maven/toolchain/java/JavaToolchain.java b/compat/maven-compat/src/main/java/org/apache/maven/toolchain/java/JavaToolchain.java index 41f1da2413..6080f00f4d 100644 --- a/compat/maven-compat/src/main/java/org/apache/maven/toolchain/java/JavaToolchain.java +++ b/compat/maven-compat/src/main/java/org/apache/maven/toolchain/java/JavaToolchain.java @@ -27,38 +27,4 @@ * @deprecated Use {@link org.apache.maven.api.JavaToolchain} instead. */ @Deprecated(since = "4.0.0") -public interface JavaToolchain extends Toolchain { - // /** - // * Returns a list of {@link java.io.File}s which represents the bootstrap libraries for the - // * runtime environment. The Bootstrap libraries include libraries in JRE's - // * extension directory, if there are any. - // * - // * @return List - // */ - // List getBootstrapLibraries(); - // - // /** - // * Returns a list of {@link java.io.File}s which represent the libraries recognized by - // * default by the platform. Usually it corresponds to contents of CLASSPATH - // * environment variable. - // * - // * @return List - // */ - // List getStandardLibraries(); - // - // /** - // * Returns a {@link java.io.File}s which represent the locations of the source of the JDK, - // * or an empty collection when the location is not set or is invalid. - // * - // * @return List - // */ - // List getSourceDirectories(); - // - // /** - // * Returns a {@link java.io.File}s which represent the locations of the Javadoc for this platform, - // * or empty collection if the location is not set or invalid - // * - // * @return List - // */ - // List getJavadocDirectories(); -} +public interface JavaToolchain extends Toolchain {} diff --git a/compat/maven-compat/src/test/java/org/apache/maven/ProjectDependenciesResolverTest.java b/compat/maven-compat/src/test/java/org/apache/maven/ProjectDependenciesResolverTest.java index aad5b3c2f0..5cc242c096 100644 --- a/compat/maven-compat/src/test/java/org/apache/maven/ProjectDependenciesResolverTest.java +++ b/compat/maven-compat/src/test/java/org/apache/maven/ProjectDependenciesResolverTest.java @@ -45,31 +45,6 @@ protected String getProjectsDirectory() { return "src/test/projects/project-dependencies-resolver"; } - /* - @Test - public void testExclusionsInDependencies() - throws Exception - { - MavenSession session = createMavenSession( null ); - MavenProject project = session.getCurrentProject(); - - Exclusion exclusion = new Exclusion(); - exclusion.setGroupId( "org.apache.maven.its" ); - exclusion.setArtifactId( "a" ); - - new ProjectBuilder( project ).addDependency( "org.apache.maven.its", "b", "0.1", Artifact.SCOPE_RUNTIME, - exclusion ); - - Set<Artifact> artifactDependencies = - resolver.resolve( project, Collections.singleton( Artifact.SCOPE_COMPILE ), session ); - assertEquals( 0, artifactDependencies.size() ); - - artifactDependencies = resolver.resolve( project, Collections.singleton( Artifact.SCOPE_RUNTIME ), session ); - assertEquals( 1, artifactDependencies.size() ); - assertEquals( "b", artifactDependencies.iterator().next().getArtifactId() ); - } - */ - @Test void testSystemScopeDependencies() throws Exception { MavenSession session = createMavenSession(null); diff --git a/compat/maven-compat/src/test/java/org/apache/maven/profiles/manager/DefaultProfileManagerTest.java b/compat/maven-compat/src/test/java/org/apache/maven/profiles/manager/DefaultProfileManagerTest.java index 68a1d16d68..d0d798b7e0 100644 --- a/compat/maven-compat/src/test/java/org/apache/maven/profiles/manager/DefaultProfileManagerTest.java +++ b/compat/maven-compat/src/test/java/org/apache/maven/profiles/manager/DefaultProfileManagerTest.java @@ -30,7 +30,6 @@ import org.apache.maven.profiles.ProfileManager; import org.codehaus.plexus.PlexusContainer; import org.codehaus.plexus.testing.PlexusTest; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -200,35 +199,4 @@ void testShouldOverrideAndDeactivateActiveProfile() throws Exception { assertNotNull(active); assertEquals(0, active.size()); } - - @Test - @Disabled - void testOsActivationProfile() throws Exception { - /* - Profile osActivated = new Profile(); - osActivated.setId( "os-profile" ); - - Activation osActivation = new Activation(); - - ActivationOS activationOS = new ActivationOS(); - - activationOS.setName( "!dddd" ); - - osActivation.setOs( activationOS ); - - osActivated.setActivation( osActivation ); - - Properties props = System.getProperties(); - ProfileActivationContext ctx = new ProfileActivationContext( props, false ); - - ProfileManager profileManager = new DefaultProfileManager( getContainer(), props ); - - profileManager.addProfile( osActivated ); - - List active = profileManager.getActiveProfiles( null ); - - assertNotNull( active ); - assertEquals( 1, active.size() ); - */ - } } diff --git a/compat/maven-compat/src/test/java/org/apache/maven/project/artifact/MavenMetadataSourceTest.java b/compat/maven-compat/src/test/java/org/apache/maven/project/artifact/MavenMetadataSourceTest.java deleted file mode 100644 index bb6d4a2583..0000000000 --- a/compat/maven-compat/src/test/java/org/apache/maven/project/artifact/MavenMetadataSourceTest.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * 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. - */ -package org.apache.maven.project.artifact; - -import javax.inject.Inject; - -import org.apache.maven.repository.RepositorySystem; -import org.codehaus.plexus.PlexusContainer; -import org.codehaus.plexus.testing.PlexusTest; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; - -@PlexusTest -@Deprecated -class MavenMetadataSourceTest { - @Inject - private RepositorySystem repositorySystem; - - @Inject - PlexusContainer container; - - @Test - @Disabled - void testShouldNotCarryExclusionsOverFromDependencyToDependency() throws Exception { - /* - Dependency dep1 = new Dependency(); - dep1.setGroupId( "test" ); - dep1.setArtifactId( "test-artifact" ); - dep1.setVersion( "1" ); - dep1.setType( "jar" ); - - Exclusion exc = new Exclusion(); - exc.setGroupId( "test" ); - exc.setArtifactId( "test-artifact3" ); - - dep1.addExclusion( exc ); - - Dependency dep2 = new Dependency(); - dep2.setGroupId( "test" ); - dep2.setArtifactId( "test-artifact2" ); - dep2.setVersion( "1" ); - dep2.setType( "jar" ); - - List<Dependency> deps = new ArrayList<>(); - deps.add( dep1 ); - deps.add( dep2 ); - - ArtifactFactory factory = container.lookup( ArtifactFactory.class ); - - ArtifactFilter dependencyFilter = new ScopeArtifactFilter( Artifact.SCOPE_COMPILE ); - - MavenProject project = new MavenProject( new Model() ); - - Set<Artifact> result = project.createArtifacts( dependencyFilter ); - - for (Iterator<Artifact> it = result.iterator(); it.hasNext(); ) - { - Artifact artifact = it.next(); - - if ( "test-artifact2".equals( artifact.getArtifactId() ) ) - { - ArtifactFilter filter = artifact.getDependencyFilter(); - - assertSame( dependencyFilter, filter ); - } - } - */ - } - - @Test - @Disabled("TODO restore these if it makes sense") - void testShouldUseCompileScopeIfDependencyScopeEmpty() throws Exception { - /* - String groupId = "org.apache.maven"; - String artifactId = "maven-model"; - - Dependency dep = new Dependency(); - - dep.setGroupId( groupId ); - dep.setArtifactId( artifactId ); - dep.setVersion( "2.0-alpha-3" ); - - Model model = new Model(); - - model.addDependency( dep ); - - MavenProject project = new MavenProject( model, repositorySystem ); - - project.setArtifacts( project.createArtifacts( null ) ); - - String key = ArtifactUtils.versionlessKey( groupId, artifactId ); - - Map artifactMap = project.getArtifactMap(); - - assertNotNull( artifactMap, "artifact-map should not be null." ); - assertEquals( 1, artifactMap.size(), "artifact-map should contain 1 element." ); - - Artifact artifact = (Artifact) artifactMap.get( key ); - - assertNotNull( artifact, "dependency artifact not found in map." ); - assertEquals( Artifact.SCOPE_COMPILE, artifact.getScope(), "dependency artifact has wrong scope." ); - - //check for back-propagation of default scope. - assertEquals( Artifact.SCOPE_COMPILE, dep.getScope(), "default scope NOT back-propagated to dependency." ); - */ - } - - @Test - @Disabled - void testShouldUseInjectedTestScopeFromDependencyManagement() throws Exception { - /* - String groupId = "org.apache.maven"; - String artifactId = "maven-model"; - - Dependency dep = new Dependency(); - - dep.setGroupId( groupId ); - dep.setArtifactId( artifactId ); - dep.setVersion( "2.0-alpha-3" ); - - Model model = new Model(); - - model.addDependency( dep ); - - Dependency mgd = new Dependency(); - mgd.setGroupId( groupId ); - mgd.setArtifactId( artifactId ); - mgd.setScope( Artifact.SCOPE_TEST ); - - DependencyManagement depMgmt = new DependencyManagement(); - - depMgmt.addDependency( mgd ); - - model.setDependencyManagement( depMgmt ); - - MavenProject project = new MavenProject( model, repositorySystem ); - - TestModelDefaultsInjector injector = new TestModelDefaultsInjector(); - - injector.injectDefaults( model ); - - project.setArtifacts( project.createArtifacts( null ) ); - - String key = ArtifactUtils.versionlessKey( groupId, artifactId ); - - Map artifactMap = project.getArtifactMap(); - - assertNotNull( artifactMap, "artifact-map should not be null." ); - assertEquals( 1, artifactMap.size(), "artifact-map should contain 1 element." ); - - Artifact artifact = (Artifact) artifactMap.get( key ); - - assertNotNull( artifact, "dependency artifact not found in map." ); - assertEquals( "dependency artifact has wrong scope.", Artifact.SCOPE_TEST, artifact.getScope() ); - - //check for back-propagation of default scope. - assertEquals( "default scope NOT back-propagated to dependency.", Artifact.SCOPE_TEST, dep.getScope() ); - */ - } -} diff --git a/compat/maven-compat/src/test/java/org/apache/maven/project/inheritance/t12scm/ProjectInheritanceTest.java b/compat/maven-compat/src/test/java/org/apache/maven/project/inheritance/t12scm/ProjectInheritanceTest.java index b519533f43..61c0c1fb0f 100644 --- a/compat/maven-compat/src/test/java/org/apache/maven/project/inheritance/t12scm/ProjectInheritanceTest.java +++ b/compat/maven-compat/src/test/java/org/apache/maven/project/inheritance/t12scm/ProjectInheritanceTest.java @@ -28,7 +28,6 @@ /** * Verifies SCM inheritance uses modules statement from parent. - * */ @Deprecated class ProjectInheritanceTest extends AbstractProjectInheritanceTestCase { @@ -55,18 +54,6 @@ void testScmInfoCalculatedCorrectlyOnParentAndChildRead() throws Exception { MavenProject project0 = getProject(pom0); MavenProject project1 = getProject(pom1); - System.out.println("\n\n"); - System.out.println("Parent SCM URL is: " + project0.getScm().getUrl()); - System.out.println("Child SCM URL is: " + project1.getScm().getUrl()); - System.out.println(); - System.out.println("Parent SCM connection is: " + project0.getScm().getConnection()); - System.out.println("Child SCM connection is: " + project1.getScm().getConnection()); - System.out.println(); - System.out.println( - "Parent SCM developer connection is: " + project0.getScm().getDeveloperConnection()); - System.out.println( - "Child SCM developer connection is: " + project1.getScm().getDeveloperConnection()); - assertEquals(project1.getScm().getUrl(), project0.getScm().getUrl() + "/modules/p1"); assertEquals(project1.getScm().getConnection(), project0.getScm().getConnection() + "/modules/p1"); assertEquals( @@ -82,42 +69,8 @@ void testScmInfoCalculatedCorrectlyOnChildOnlyRead() throws Exception { // load the child project, which inherits from p0... MavenProject project1 = getProject(pom1); - System.out.println("\n\n"); - System.out.println("Child SCM URL is: " + project1.getScm().getUrl()); - System.out.println("Child SCM connection is: " + project1.getScm().getConnection()); - System.out.println( - "Child SCM developer connection is: " + project1.getScm().getDeveloperConnection()); - assertEquals("http://host/viewer?path=/p0/modules/p1", project1.getScm().getUrl()); assertEquals("scm:svn:http://host/p0/modules/p1", project1.getScm().getConnection()); assertEquals("scm:svn:https://host/p0/modules/p1", project1.getScm().getDeveloperConnection()); } - - // public void testScmInfoCalculatedCorrectlyOnChildReadFromLocalRepository() - // throws Exception - // { - // File localRepo = getLocalRepositoryPath(); - // - // ArtifactFactory factory = (ArtifactFactory) lookup( ArtifactFactory.class ); - // Artifact artifact = factory.createProjectArtifact( "maven", "p1", "1.0" ); - // - // ArtifactRepositoryFactory repoFactory = (ArtifactRepositoryFactory) lookup( - // ArtifactRepositoryFactory.class ); - // ArtifactRepository localArtifactRepo = repoFactory.createLocalRepository( localRepo ); - // - // MavenProject project1 = getProjectBuilder().buildFromRepository( artifact, Collections.EMPTY_LIST, - // localArtifactRepo ); - // - // System.out.println( "\n\n" ); - // System.out.println( "Child SCM URL is: " + project1.getScm().getUrl() ); - // System.out.println( "Child SCM connection is: " + project1.getScm().getConnection() ); - // System.out.println( "Child SCM developer connection is: " - // + project1.getScm().getDeveloperConnection() ); - // - // assertEquals( project1.getScm().getUrl(), "http://host/viewer?path=/p0/modules/p1" ); - // assertEquals( project1.getScm().getConnection(), "scm:svn:http://host/p0/modules/p1" ); - // assertEquals( project1.getScm().getDeveloperConnection(), - // "scm:svn:https://host/p0/modules/p1" ); - // } - } diff --git a/compat/maven-model-builder/src/test/java/org/apache/maven/model/interpolation/AbstractModelInterpolatorTest.java b/compat/maven-model-builder/src/test/java/org/apache/maven/model/interpolation/AbstractModelInterpolatorTest.java index 12d6474961..6d0fa698f1 100644 --- a/compat/maven-model-builder/src/test/java/org/apache/maven/model/interpolation/AbstractModelInterpolatorTest.java +++ b/compat/maven-model-builder/src/test/java/org/apache/maven/model/interpolation/AbstractModelInterpolatorTest.java @@ -232,21 +232,6 @@ public void testShouldNotInterpolateDependencyVersionWithInvalidReference() thro .build())) .build()); - /* - // This is the desired behaviour, however there are too many crappy poms in the repo and an issue with the - // timing of executing the interpolation - - try - { - new RegexBasedModelInterpolator().interpolate( model, context ); - fail( "Should have failed to interpolate with invalid reference" ); - } - catch ( ModelInterpolationException expected ) - { - assertTrue( true ); - } - */ - ModelInterpolator interpolator = createInterpolator(); final SimpleProblemCollector collector = new SimpleProblemCollector(); diff --git a/compat/maven-model/src/test/java/org/apache/maven/model/merge/MavenMergerTest.java b/compat/maven-model/src/test/java/org/apache/maven/model/merge/MavenMergerTest.java index dca39aad53..92c8c55122 100644 --- a/compat/maven-model/src/test/java/org/apache/maven/model/merge/MavenMergerTest.java +++ b/compat/maven-model/src/test/java/org/apache/maven/model/merge/MavenMergerTest.java @@ -32,8 +32,6 @@ /** * MavenMerger is based on same instances, subclasses should override KeyComputer per type - * - * */ class MavenMergerTest { private MavenMerger mavenMerger = new MavenMerger(); @@ -85,349 +83,4 @@ void mergeSameDependencies() { assertThat(merged.getDependencies(), contains(dependency)); } - - /* - @Test - public void mergeDescription() - { - Model target = new Model(); - target.setDescription( "TARGET" ); - - Model source = new Model(); - source.setDescription( "SOURCE" ); - - modelMerger.merge( target, source, true, null ); - assertThat( target.getDescription(), is( "SOURCE" ) ); - - target.setDescription( "TARGET" ); - modelMerger.merge( target, source, false, null ); - assertThat( target.getDescription(), is( "TARGET" ) ); - } - - @Test - public void mergeSameDevelopers() - { - Developer developer = new Developer(); - developer.setId( "devid" ); - - Model target = new Model(); - target.setDevelopers( Arrays.asList( developer ) ); - - Model source = new Model(); - source.setDevelopers( Arrays.asList( developer ) ); - - modelMerger.merge( target, source, true, null ); - - assertThat( target.getDevelopers(), contains( developer ) ); - } - - @Test - public void mergeSameExcludes() - { - PatternSet target = new PatternSet(); - target.setExcludes( Arrays.asList( "first", "second", "third" ) ); - PatternSet source = new PatternSet(); - source.setExcludes( Arrays.asList( "first", "second", "third" ) ); - - modelMerger.mergePatternSet_Excludes( target, source, true, null ); - - assertThat( target.getExcludes(), contains( "first", "second", "third" ) ); - } - - @Test - public void mergeSameFilters() - { - Build target = new Build(); - target.setFilters( Arrays.asList( "first", "second", "third" ) ); - Build source = new Build(); - source.setFilters( Arrays.asList( "first", "second", "third" ) ); - - modelMerger.mergeBuild( target, source, true, null ); - - assertThat( target.getFilters(), contains( "first", "second", "third" ) ); - } - - @Test - public void mergeSameGoals() - { - PluginExecution target = new PluginExecution(); - target.setGoals( Arrays.asList( "first", "second", "third" ) ); - PluginExecution source = new PluginExecution(); - source.setGoals( Arrays.asList( "first", "second", "third" ) ); - - modelMerger.mergePluginExecution( target, source, true, null ); - - assertThat( target.getGoals(), contains( "first", "second", "third" ) ); - } - - @Test - public void mergeGroupId() - { - Model target = new Model(); - target.setGroupId( "TARGET" ); - - Model source = new Model(); - source.setGroupId( "SOURCE" ); - - modelMerger.merge( target, source, true, null ); - assertThat( target.getGroupId(), is( "SOURCE" ) ); - - target.setGroupId( "TARGET" ); - modelMerger.merge( target, source, false, null ); - assertThat( target.getGroupId(), is( "TARGET" ) ); - } - - @Test - public void mergeInceptionYear() - { - Model target = new Model(); - target.setInceptionYear( "TARGET" ); - - Model source = new Model(); - source.setInceptionYear( "SOURCE" ); - - modelMerger.merge( target, source, true, null ); - assertThat( target.getInceptionYear(), is( "SOURCE" ) ); - - target.setInceptionYear( "TARGET" ); - modelMerger.merge( target, source, false, null ); - assertThat( target.getInceptionYear(), is( "TARGET" ) ); - } - - @Test - public void mergeSameIncludes() - { - PatternSet target = new PatternSet(); - target.setIncludes( Arrays.asList( "first", "second", "third" ) ); - PatternSet source = new PatternSet(); - source.setIncludes( Arrays.asList( "first", "second", "third" ) ); - - modelMerger.mergePatternSet_Includes( target, source, true, null ); - - assertThat( target.getIncludes(), contains( "first", "second", "third" ) ); - } - - @Test - public void mergeSameMailingLists() - { - MailingList mailingList = new MailingList(); - mailingList.setName( "name" ); - - Model target = new Model(); - target.setMailingLists( Arrays.asList( mailingList ) ); - - Model source = new Model(); - source.setMailingLists( Arrays.asList( mailingList ) ); - - modelMerger.merge( target, source, true, null ); - - assertThat( target.getMailingLists(), contains( mailingList ) ); - } - - @Test - public void mergeModelVersion() - { - Model target = new Model(); - target.setModelVersion( "TARGET" ); - - Model source = new Model(); - source.setModelVersion( "SOURCE" ); - - modelMerger.merge( target, source, true, null ); - assertThat( target.getModelVersion(), is( "SOURCE" ) ); - - target.setModelVersion( "TARGET" );; - modelMerger.merge( target, source, false, null ); - assertThat( target.getModelVersion(), is( "TARGET" ) ); - } - - @Test - public void mergeSameModules() - { - Model target = new Model(); - target.setModules( Arrays.asList( "first", "second", "third" ) ); - Model source = new Model(); - source.setModules( Arrays.asList( "first", "second", "third" ) ); - - modelMerger.merge( target, source, true, null ); - - assertThat( target.getModules(), contains( "first", "second", "third" ) ); - } - - @Test - public void mergeName() - { - Model target = new Model(); - target.setName( "TARGET" ); - - Model source = new Model(); - source.setName( "SOURCE" ); - - modelMerger.merge( target, source, true, null ); - assertThat( target.getName(), is( "SOURCE" ) ); - - target.setName( "TARGET" );; - modelMerger.merge( target, source, false, null ); - assertThat( target.getName(), is( "TARGET" ) ); - } - - @Test - public void mergeSameOtherArchives() - { - MailingList target = new MailingList(); - target.setOtherArchives( Arrays.asList( "first", "second", "third" ) ); - MailingList source = new MailingList(); - source.setOtherArchives( Arrays.asList( "first", "second", "third" ) ); - - modelMerger.mergeMailingList( target, source, true, null ); - - assertThat( target.getOtherArchives(), contains( "first", "second", "third" ) ); - } - - @Test - public void mergePackaging() - { - Model target = new Model(); - target.setPackaging( "TARGET" ); - - Model source = new Model(); - source.setPackaging( "SOURCE" ); - - modelMerger.merge( target, source, true, null ); - assertThat( target.getPackaging(), is( "SOURCE" ) ); - - target.setPackaging( "TARGET" );; - modelMerger.merge( target, source, false, null ); - assertThat( target.getPackaging(), is( "TARGET" ) ); - } - - @Test - public void mergeSamePluginRepositories() - { - Repository repository = new Repository(); - repository.setId( "repository" ); - - Model target = new Model(); - target.setPluginRepositories( Arrays.asList( repository ) ); - - Model source = new Model(); - source.setPluginRepositories( Arrays.asList( repository ) ); - - modelMerger.merge( target, source, true, null ); - - assertThat( target.getPluginRepositories(), contains( repository ) ); - } - - @Test - public void mergeSameProfiles() - { - Profile profile = new Profile(); - profile.setId( "profile" ); - - Model target = new Model(); - target.setProfiles( Arrays.asList( profile ) ); - - Model source = new Model(); - source.setProfiles( Arrays.asList( profile ) ); - - modelMerger.merge( target, source, true, null ); - - assertThat( target.getProfiles(), contains( profile ) ); - } - - @Test - public void mergeSameReports() - { - ReportSet target = new ReportSet(); - target.setReports( Arrays.asList( "first", "second", "third" ) ); - ReportSet source = new ReportSet(); - source.setReports( Arrays.asList( "first", "second", "third" ) ); - - modelMerger.mergeReportSet( target, source, true, null ); - - assertThat( target.getReports(), contains( "first", "second", "third" ) ); - } - - @Test - public void mergeSameRepositories() - { - Repository repository = new Repository(); - repository.setId( "repository" ); - - Model target = new Model(); - target.setRepositories( Arrays.asList( repository ) ); - - Model source = new Model(); - source.setRepositories( Arrays.asList( repository ) ); - - modelMerger.merge( target, source, true, null ); - - assertThat( target.getRepositories(), contains( repository ) ); - } - - @Test - public void mergeSameRoles() - { - Contributor target = new Contributor(); - target.setRoles( Arrays.asList( "first", "second", "third" ) ); - Contributor source = new Contributor(); - source.setRoles( Arrays.asList( "first", "second", "third" ) ); - - modelMerger.mergeContributor_Roles( target, source, true, null ); - - assertThat( target.getRoles(), contains( "first", "second", "third" ) ); - } - - @Test - public void mergeUrl() - { - Model target = new Model(); - target.setUrl( "TARGET" );; - - Model source = new Model(); - source.setUrl( "SOURCE" ); - - modelMerger.merge( target, source, true, null ); - assertThat( target.getUrl(), is( "SOURCE" ) ); - - target.setUrl( "TARGET" );; - modelMerger.merge( target, source, false, null ); - assertThat( target.getUrl(), is( "TARGET" ) ); - } - - @Test - public void mergeVersion() - { - Model target = new Model(); - target.setVersion( "TARGET" );; - - Model source = new Model(); - source.setVersion( "SOURCE" ); - - modelMerger.merge( target, source, true, null ); - assertThat( target.getVersion(), is( "SOURCE" ) ); - - target.setVersion( "TARGET" );; - modelMerger.merge( target, source, false, null ); - assertThat( target.getVersion(), is( "TARGET" ) ); - } - - @Test - public void testMergedModelSerialization() throws Exception { - Model target = new Model(); - Model source = new Model(); - target.setLicenses(new ArrayList<License>()); - License lic1 = new License(); - License lic2 = new License(); - target.getLicenses().add(lic1); - source.setLicenses(new ArrayList<License>()); - source.getLicenses().add(lic2); - - new MavenMerger().mergeModel(target, source, false, null); - - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - ObjectOutputStream oos = new ObjectOutputStream(baos); - oos.writeObject(target); - } - */ } diff --git a/impl/maven-core/src/main/java/org/apache/maven/lifecycle/internal/concurrent/BuildPlanLogger.java b/impl/maven-core/src/main/java/org/apache/maven/lifecycle/internal/concurrent/BuildPlanLogger.java index 85bbe00e64..a326bab694 100644 --- a/impl/maven-core/src/main/java/org/apache/maven/lifecycle/internal/concurrent/BuildPlanLogger.java +++ b/impl/maven-core/src/main/java/org/apache/maven/lifecycle/internal/concurrent/BuildPlanLogger.java @@ -86,14 +86,6 @@ public void writePlan(Consumer<String> writer, BuildPlan plan, MavenProject proj .map(n -> phase(project, n, plan.duplicateIds())) .collect(Collectors.joining(", "))); } - /* - if (!node.successors.isEmpty()) { - writer.accept("\tSuccessors: " - + node.successors.stream() - .map(n -> phase(currentProject, n, duplicateIds)) - .collect(Collectors.joining(", "))); - } - */ step.mojos.values().stream() .flatMap(m -> m.values().stream()) .forEach(mojo -> mojo(writer, mojo)); diff --git a/impl/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/ProjectDependencyGraphStub.java b/impl/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/ProjectDependencyGraphStub.java index d8624e2c4c..f9a80b8659 100644 --- a/impl/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/ProjectDependencyGraphStub.java +++ b/impl/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/ProjectDependencyGraphStub.java @@ -176,10 +176,6 @@ public List<MavenProject> getDownstreamProjects(MavenProject project, boolean tr } public List<MavenProject> getUpstreamProjects(MavenProject project, boolean transitive) { - /* if ( transitive ) - { - throw new RuntimeException( "Not implemented yet" ); - }*/ List<MavenProject> result = new ArrayList<>(); final List<Dependency> dependencies = getDependencies(); for (Dependency dependency : dependencies) { diff --git a/impl/maven-core/src/test/java/org/apache/maven/plugin/PluginManagerTest.java b/impl/maven-core/src/test/java/org/apache/maven/plugin/PluginManagerTest.java index 7020e40d25..f162134725 100644 --- a/impl/maven-core/src/test/java/org/apache/maven/plugin/PluginManagerTest.java +++ b/impl/maven-core/src/test/java/org/apache/maven/plugin/PluginManagerTest.java @@ -85,103 +85,6 @@ void testMojoDescriptorRetrieval() throws Exception { assertEquals("0.1", pluginDescriptor.getVersion()); } - // ----------------------------------------------------------------------------------------------- - // Tests which exercise the lifecycle executor when it is dealing with individual goals. - // ----------------------------------------------------------------------------------------------- - - // TODO These two tests display a lack of symmetry with respect to the input which is a free form string and the - // mojo descriptor which comes back. All the free form parsing needs to be done somewhere else, this is - // really the function of the CLI, and then the pre-processing of that output still needs to be fed into - // a hinting process which helps flesh out the full specification of the plugin. The plugin manager should - // only deal in concrete terms -- all version finding mumbo jumbo is a customization to base functionality - // the plugin manager provides. - - @Test - void testRemoteResourcesPlugin() throws Exception { - // TODO turn an equivalent back on when the RR plugin is released. - - /* - - This will not work until the RR plugin is released to get rid of the binding to the reporting exception which is a mistake. - - This happens after removing the reporting API from the core: - - java.lang.NoClassDefFoundError: org/apache/maven/reporting/MavenReportException - - MavenSession session = createMavenSession( getProject( "project-with-inheritance" ) ); - String goal = "process"; - - Plugin plugin = new Plugin(); - plugin.setGroupId( "org.apache.maven.plugins" ); - plugin.setArtifactId( "maven-remote-resources-plugin" ); - plugin.setVersion( "1.0-beta-2" ); - - MojoDescriptor mojoDescriptor = pluginManager.getMojoDescriptor( plugin, goal, session.getCurrentProject(), session.getLocalRepository() ); - assertPluginDescriptor( mojoDescriptor, "org.apache.maven.plugins", "maven-remote-resources-plugin", "1.0-beta-2" ); - MojoExecution mojoExecution = new MojoExecution( mojoDescriptor ); - pluginManager.executeMojo( session, mojoExecution ); - */ - } - - // TODO this will be the basis of the customizable lifecycle execution so need to figure this out quickly. - public void testSurefirePlugin() throws Exception { - /* - MavenSession session = createMavenSession( getProject( "project-with-inheritance" ) ); - String goal = "test"; - - Plugin plugin = new Plugin(); - plugin.setGroupId( "org.apache.maven.plugins" ); - plugin.setArtifactId( "maven-surefire-plugin" ); - plugin.setVersion( "2.4.2" ); - - // The project has already been fully interpolated so getting the raw mojoDescriptor is not going to have the processes configuration. - MojoDescriptor mojoDescriptor = pluginManager.getMojoDescriptor( plugin, goal, session.getLocalRepository(), session.getCurrentProject().getPluginArtifactRepositories() ); - assertPluginDescriptor( mojoDescriptor, "org.apache.maven.plugins", "maven-surefire-plugin", "2.4.2" ); - - System.out.println( session.getCurrentProject().getBuild().getPluginsAsMap() ); - - Xpp3Dom configuration = (Xpp3Dom) session.getCurrentProject().getBuild().getPluginsAsMap().get( plugin.getKey() ).getExecutions().get( 0 ).getConfiguration(); - MojoExecution mojoExecution = new MojoExecution( mojoDescriptor, configuration ); - pluginManager.executeMojo( session, mojoExecution ); - */ - } - - @Test - void testMojoConfigurationIsMergedCorrectly() throws Exception {} - - /** - * The case where the user wants to specify an alternate version of the underlying tool. Common case - * is in the Antlr plugin which comes bundled with a version of Antlr but the user often times needs - * to use a specific version. We need to make sure the version that they specify takes precedence. - */ - @Test - void testMojoWhereInternallyStatedDependencyIsOverriddenByProject() throws Exception {} - - /** - * The case where you have a plugin in the current build that you want to be used on projects in - * the current build. - */ - @Test - void testMojoThatIsPresentInTheCurrentBuild() throws Exception {} - - /** - * This is the case where the Mojo wants to execute on every project and then do something at the end - * with the results of each project. - */ - @Test - void testAggregatorMojo() throws Exception {} - - /** - * This is the case where a Mojo needs the lifecycle run to a certain phase before it can do - * anything useful. - */ - @Test - void testMojoThatRequiresExecutionToAGivenPhaseBeforeExecutingItself() throws Exception {} - - // test that mojo which does not require dependency resolution trigger no downloading of dependencies - - // test interpolation of basedir values in mojo configuration - // test a build where projects use different versions of the same plugin @Test diff --git a/impl/maven-core/src/test/java/org/apache/maven/project/PomConstructionTest.java b/impl/maven-core/src/test/java/org/apache/maven/project/PomConstructionTest.java index 8d87bf95bf..4fe089e6ce 100644 --- a/impl/maven-core/src/test/java/org/apache/maven/project/PomConstructionTest.java +++ b/impl/maven-core/src/test/java/org/apache/maven/project/PomConstructionTest.java @@ -448,20 +448,6 @@ void testParentInterpolation() throws Exception { assertEquals("1.3.0-SNAPSHOT", pom.getValue("build/plugins[1]/version")); } - /* - public void testMaven() - throws Exception - { - PomTestWrapper pom = buildPomFromMavenProject( "maven-build/sub/pom.xml", null ); - - for( String s: pom.getMavenProject().getTestClasspathElements() ) - { - System.out.println( s ); - } - - } - */ - /* MNG-3567*/ @Test void testPluginManagementInherited() throws Exception { @@ -533,13 +519,6 @@ void testExecutionConfiguration() throws Exception { "src/main/mdo/security.xml", (pom.getValue("build/plugins[1]/executions[2]/configuration[1]/model"))); } - /* - public void testPluginConfigDuplicate() - throws Exception - { - PomTestWrapper pom = buildPom( "plugin-config-duplicate/dup" ); - } - */ @Test void testSingleConfigurationInheritance() throws Exception { PomTestWrapper pom = buildPom("single-configuration-inheritance"); diff --git a/impl/maven-core/src/test/java/org/apache/maven/project/harness/PomTestWrapper.java b/impl/maven-core/src/test/java/org/apache/maven/project/harness/PomTestWrapper.java index e34071af2d..8d75e1644c 100644 --- a/impl/maven-core/src/test/java/org/apache/maven/project/harness/PomTestWrapper.java +++ b/impl/maven-core/src/test/java/org/apache/maven/project/harness/PomTestWrapper.java @@ -62,17 +62,6 @@ public void setValueOnModel(String expression, Object value) { context.setValue(expression, value); } - /* - public int containerCountForUri( String uri ) - throws IOException - { - Validate.notEmpty( uri, "uri can neither be null nor empty " ); - ModelDataSource source = new DefaultModelDataSource(); - source.init( domainModel.getModelProperties(), null ); - return source.queryFor( uri ).size(); - } - */ - public Iterator<?> getIteratorForXPathExpression(String expression) { return context.iterate(expression); } diff --git a/impl/maven-impl/src/test/java/org/apache/maven/impl/DefaultSettingsBuilderFactoryTest.java b/impl/maven-impl/src/test/java/org/apache/maven/impl/DefaultSettingsBuilderFactoryTest.java index 3e372f3a8c..5419b27d62 100644 --- a/impl/maven-impl/src/test/java/org/apache/maven/impl/DefaultSettingsBuilderFactoryTest.java +++ b/impl/maven-impl/src/test/java/org/apache/maven/impl/DefaultSettingsBuilderFactoryTest.java @@ -48,11 +48,6 @@ class DefaultSettingsBuilderFactoryTest { @BeforeEach void setup() { - // Map<String, String> map = System.getProperties().entrySet().stream() - // .collect(Collectors.toMap( - // e -> e.getKey().toString(), e -> e.getValue().toString())); - // lenient().when(session.getSystemProperties()).thenReturn(map); - // lenient().when(session.getUserProperties()).thenReturn(Collections.emptyMap()); Mockito.lenient() .when(session.getService(SettingsXmlFactory.class)) .thenReturn(new DefaultSettingsXmlFactory()); diff --git a/impl/maven-impl/src/test/java/org/apache/maven/impl/DefaultSettingsValidatorTest.java b/impl/maven-impl/src/test/java/org/apache/maven/impl/DefaultSettingsValidatorTest.java index a1b5028806..f604fe6bb3 100644 --- a/impl/maven-impl/src/test/java/org/apache/maven/impl/DefaultSettingsValidatorTest.java +++ b/impl/maven-impl/src/test/java/org/apache/maven/impl/DefaultSettingsValidatorTest.java @@ -28,15 +28,11 @@ import org.apache.maven.api.settings.Repository; import org.apache.maven.api.settings.Settings; import org.apache.maven.impl.model.DefaultInterpolator; -import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; -/** - */ class DefaultSettingsValidatorTest { private SettingsBuilder validator; @@ -46,15 +42,6 @@ void setUp() throws Exception { validator = new DefaultSettingsBuilder(new DefaultSettingsXmlFactory(), new DefaultInterpolator(), Map.of()); } - @AfterEach - void tearDown() throws Exception { - validator = null; - } - - private void assertContains(String msg, String substring) { - assertTrue(msg.contains(substring), "\"" + substring + "\" was not found in: " + msg); - } - @Test void testValidate() { Profile prof = Profile.newBuilder().id("xxx").build(); @@ -83,152 +70,4 @@ void testValidate() { problems = validator.validate(model2); assertEquals(0, problems.totalProblemsReported()); } - - /* - @Test - void testValidateMirror() throws Exception { - Settings settings = new Settings(); - Mirror mirror = new Mirror(); - mirror.setId("local"); - settings.addMirror(mirror); - mirror = new Mirror(); - mirror.setId("illegal\\:/chars"); - mirror.setUrl("http://void"); - mirror.setMirrorOf("void"); - settings.addMirror(mirror); - - SimpleProblemCollector problems = new SimpleProblemCollector(); - validator.validate(settings, problems); - assertEquals(4, problems.messages.size()); - assertContains(problems.messages.get(0), "'mirrors.mirror.id' must not be 'local'"); - assertContains(problems.messages.get(1), "'mirrors.mirror.url' for local is missing"); - assertContains(problems.messages.get(2), "'mirrors.mirror.mirrorOf' for local is missing"); - assertContains(problems.messages.get(3), "'mirrors.mirror.id' must not contain any of these characters"); - } - - @Test - void testValidateRepository() throws Exception { - Profile profile = new Profile(); - Repository repo = new Repository(); - repo.setId("local"); - profile.addRepository(repo); - repo = new Repository(); - repo.setId("illegal\\:/chars"); - repo.setUrl("http://void"); - profile.addRepository(repo); - Settings settings = new Settings(); - settings.addProfile(profile); - - SimpleProblemCollector problems = new SimpleProblemCollector(); - validator.validate(settings, problems); - assertEquals(3, problems.messages.size()); - assertContains( - problems.messages.get(0), "'profiles.profile[default].repositories.repository.id' must not be 'local'"); - assertContains( - problems.messages.get(1), - "'profiles.profile[default].repositories.repository.url' for local is missing"); - assertContains( - problems.messages.get(2), - "'profiles.profile[default].repositories.repository.id' must not contain any of these characters"); - } - - @Test - void testValidateUniqueServerId() throws Exception { - Settings settings = new Settings(); - Server server1 = new Server(); - server1.setId("test"); - settings.addServer(server1); - Server server2 = new Server(); - server2.setId("test"); - settings.addServer(server2); - - SimpleProblemCollector problems = new SimpleProblemCollector(); - validator.validate(settings, problems); - assertEquals(1, problems.messages.size()); - assertContains( - problems.messages.get(0), "'servers.server.id' must be unique but found duplicate server with id test"); - } - - @Test - void testValidateUniqueProfileId() throws Exception { - Settings settings = new Settings(); - Profile profile1 = new Profile(); - profile1.setId("test"); - settings.addProfile(profile1); - Profile profile2 = new Profile(); - profile2.setId("test"); - settings.addProfile(profile2); - - SimpleProblemCollector problems = new SimpleProblemCollector(); - validator.validate(settings, problems); - assertEquals(1, problems.messages.size()); - assertContains( - problems.messages.get(0), - "'profiles.profile.id' must be unique but found duplicate profile with id test"); - } - - @Test - void testValidateUniqueRepositoryId() throws Exception { - Settings settings = new Settings(); - Profile profile = new Profile(); - profile.setId("pro"); - settings.addProfile(profile); - Repository repo1 = new Repository(); - repo1.setUrl("http://apache.org/"); - repo1.setId("test"); - profile.addRepository(repo1); - Repository repo2 = new Repository(); - repo2.setUrl("http://apache.org/"); - repo2.setId("test"); - profile.addRepository(repo2); - - SimpleProblemCollector problems = new SimpleProblemCollector(); - validator.validate(settings, problems); - assertEquals(1, problems.messages.size()); - assertContains( - problems.messages.get(0), - "'profiles.profile[pro].repositories.repository.id' must be unique" - + " but found duplicate repository with id test"); - } - - @Test - void testValidateUniqueProxyId() throws Exception { - Settings settings = new Settings(); - Proxy proxy = new Proxy(); - String id = "foo"; - proxy.setId(id); - proxy.setHost("www.example.com"); - settings.addProxy(proxy); - settings.addProxy(proxy); - - SimpleProblemCollector problems = new SimpleProblemCollector(); - validator.validate(settings, problems); - assertEquals(1, problems.messages.size()); - assertContains( - problems.messages.get(0), - "'proxies.proxy.id' must be unique" + " but found duplicate proxy with id " + id); - } - - @Test - void testValidateProxy() throws Exception { - Settings settings = new Settings(); - Proxy proxy1 = new Proxy(); - settings.addProxy(proxy1); - - SimpleProblemCollector problems = new SimpleProblemCollector(); - validator.validate(settings, problems); - assertEquals(1, problems.messages.size()); - assertContains(problems.messages.get(0), "'proxies.proxy.host' for default is missing"); - } - - private static class SimpleProblemCollector implements SettingsProblemCollector { - - public List<String> messages = new ArrayList<>(); - - public void add(Severity severity, String message, int line, int column, Exception cause) { - messages.add(message); - } - } - - */ } diff --git a/impl/maven-impl/src/test/java/org/apache/maven/impl/model/DefaultModelInterpolatorTest.java b/impl/maven-impl/src/test/java/org/apache/maven/impl/model/DefaultModelInterpolatorTest.java index 4d9d5ff04d..7afe7a82e2 100644 --- a/impl/maven-impl/src/test/java/org/apache/maven/impl/model/DefaultModelInterpolatorTest.java +++ b/impl/maven-impl/src/test/java/org/apache/maven/impl/model/DefaultModelInterpolatorTest.java @@ -244,21 +244,6 @@ public void testShouldNotInterpolateDependencyVersionWithInvalidReference() thro Dependency.newBuilder().version("${something}").build())) .build(); - /* - // This is the desired behaviour, however there are too many crappy poms in the repo and an issue with the - // timing of executing the interpolation - - try - { - new RegexBasedModelInterpolator().interpolate( model, context ); - fail( "Should have failed to interpolate with invalid reference" ); - } - catch ( ModelInterpolationException expected ) - { - assertTrue( true ); - } - */ - final SimpleProblemCollector collector = new SimpleProblemCollector(); Model out = interpolator.interpolateModel( model, Paths.get("."), createModelBuildingRequest(context).build(), collector); diff --git a/impl/maven-impl/src/test/java/org/apache/maven/impl/model/profile/ConditionProfileActivatorTest.java b/impl/maven-impl/src/test/java/org/apache/maven/impl/model/profile/ConditionProfileActivatorTest.java index d6ba4d79ff..5d371c2fc3 100644 --- a/impl/maven-impl/src/test/java/org/apache/maven/impl/model/profile/ConditionProfileActivatorTest.java +++ b/impl/maven-impl/src/test/java/org/apache/maven/impl/model/profile/ConditionProfileActivatorTest.java @@ -273,25 +273,6 @@ void testOsNegatedArch() { assertActivation(true, profile, newContext(null, newOsProperties("windows", "6.5.0-1014-aws", "aarch64"))); } - /* - @Test - void testOsFamily() { - Profile profile = newProfile(ActivationOS.newBuilder().family("windows")); - - assertActivation(false, profile, newContext(null, newOsProperties("linux", "6.5.0-1014-aws", "amd64"))); - assertActivation(true, profile, newContext(null, newOsProperties("windows", "6.5.0-1014-aws", "aarch64"))); - } - - @Test - void testOsNegatedFamily() { - Profile profile = newProfile(ActivationOS.newBuilder().family("!windows")); - - assertActivation(true, profile, newContext(null, newOsProperties("linux", "6.5.0-1014-aws", "amd64"))); - assertActivation(false, profile, newContext(null, newOsProperties("windows", "6.5.0-1014-aws", "aarch64"))); - } - - */ - @Test void testOsAllConditions() { Profile profile = diff --git a/impl/maven-impl/src/test/java/org/apache/maven/impl/standalone/ApiRunner.java b/impl/maven-impl/src/test/java/org/apache/maven/impl/standalone/ApiRunner.java index 816365108d..9e7fbe9c38 100644 --- a/impl/maven-impl/src/test/java/org/apache/maven/impl/standalone/ApiRunner.java +++ b/impl/maven-impl/src/test/java/org/apache/maven/impl/standalone/ApiRunner.java @@ -330,15 +330,6 @@ static Session newSession(RepositorySystem system, Lookup lookup, @Nullable Loca // TODO: remove that when this go more public properties.put("user.home", "target"); - // SettingsDecrypter settingsDecrypter = - // (SettingsDecrypter)Objects.requireNonNull(this.createSettingsDecrypter(preBoot)); - // new DefaultProfileSelector(List.of( - // new JdkVersionProfileActivator(), - // new PropertyProfileActivator(), - // new OperatingSystemProfileActivator(), - // new FileProfileActivator(new ProfileActivationFilePathInterpolator( - // new DefaultPathTranslator(), new DefaultRootLocator())))); - Path userHome = Paths.get(properties.get("user.home")); Path mavenUserHome = userHome.resolve(".m2"); Path mavenSystemHome = properties.containsKey("maven.home") diff --git a/impl/maven-logging/src/main/java/org/apache/maven/slf4j/MavenBaseLogger.java b/impl/maven-logging/src/main/java/org/apache/maven/slf4j/MavenBaseLogger.java index 4b8edb6227..11070b834b 100644 --- a/impl/maven-logging/src/main/java/org/apache/maven/slf4j/MavenBaseLogger.java +++ b/impl/maven-logging/src/main/java/org/apache/maven/slf4j/MavenBaseLogger.java @@ -243,38 +243,6 @@ protected String computeShortName() { return name.substring(name.lastIndexOf(".") + 1); } - // /** - // * For formatted messages, first substitute arguments and then log. - // * - // * @param level - // * @param format - // * @param arg1 - // * @param arg2 - // */ - // private void formatAndLog(int level, String format, Object arg1, Object arg2) { - // if (!isLevelEnabled(level)) { - // return; - // } - // FormattingTuple tp = MessageFormatter.format(format, arg1, arg2); - // log(level, tp.getMessage(), tp.getThrowable()); - // } - - // /** - // * For formatted messages, first substitute arguments and then log. - // * - // * @param level - // * @param format - // * @param arguments - // * a list of 3 ore more arguments - // */ - // private void formatAndLog(int level, String format, Object... arguments) { - // if (!isLevelEnabled(level)) { - // return; - // } - // FormattingTuple tp = MessageFormatter.arrayFormat(format, arguments); - // log(level, tp.getMessage(), tp.getThrowable()); - // } - /** * Is the given log level currently enabled? *