michael-o commented on code in PR #743: URL: https://github.com/apache/maven/pull/743#discussion_r928140254
########## maven-core/src/test/java/org/apache/maven/lifecycle/internal/LifecycleModuleBuilderTest.java: ########## @@ -0,0 +1,102 @@ +package org.apache.maven.lifecycle.internal; + +/* + * 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.lang.reflect.Field; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.concurrent.atomic.AtomicReference; + +import org.apache.maven.execution.AbstractExecutionListener; +import org.apache.maven.execution.DefaultMavenExecutionRequest; +import org.apache.maven.execution.DefaultMavenExecutionResult; +import org.apache.maven.execution.MavenExecutionRequest; +import org.apache.maven.execution.MavenExecutionResult; +import org.apache.maven.execution.MavenSession; +import org.apache.maven.lifecycle.LifecycleExecutionException; +import org.apache.maven.lifecycle.internal.builder.BuilderCommon; +import org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder; +import org.apache.maven.lifecycle.internal.stub.DefaultLifecyclesStub; +import org.apache.maven.lifecycle.internal.stub.LifecycleTaskSegmentCalculatorStub; +import org.apache.maven.lifecycle.internal.stub.LoggerStub; +import org.apache.maven.lifecycle.internal.stub.MojoExecutorStub; +import org.apache.maven.lifecycle.internal.stub.ProjectDependencyGraphStub; +import org.apache.maven.plugin.MojoExecution; +import org.apache.maven.project.MavenProject; +import org.codehaus.plexus.ContainerConfiguration; +import org.codehaus.plexus.PlexusConstants; +import org.codehaus.plexus.PlexusTestCase; +import org.codehaus.plexus.logging.Logger; +import org.junit.Test; + +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertSame; + +public class LifecycleModuleBuilderTest extends PlexusTestCase +{ + @Override + protected void customizeContainerConfiguration( ContainerConfiguration configuration ) + { + configuration.setAutoWiring( true ); + configuration.setClassPathScanning( PlexusConstants.SCANNING_INDEX ); + + } + + public void testCurrentProject() throws Exception + { + List<MavenProject> currentProjects = new ArrayList<>(); + MojoExecutorStub mojoExecutor = new MojoExecutorStub() + { + @Override + public void execute( MavenSession session, List<MojoExecution> mojoExecutions, ProjectIndex projectIndex ) + throws LifecycleExecutionException + { + super.execute( session, mojoExecutions, projectIndex ); + currentProjects.add( session.getCurrentProject() ); + } + }; + + final DefaultMavenExecutionResult defaultMavenExecutionResult = new DefaultMavenExecutionResult(); + MavenExecutionRequest mavenExecutionRequest = new DefaultMavenExecutionRequest(); + mavenExecutionRequest.setExecutionListener( new AbstractExecutionListener() ); + mavenExecutionRequest.setGoals( Arrays.asList( "clean" ) ); + mavenExecutionRequest.setDegreeOfConcurrency( 1 ); Review Comment: This is the default value. Any specific reason to set it explicitly? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org