View Javadoc
1   package org.apache.maven.plugin.surefire.booterclient;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *     http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import org.apache.maven.plugin.surefire.booterclient.lazytestprovider.OutputStreamFlushableCommandline;
23  import org.apache.maven.plugin.surefire.log.api.ConsoleLogger;
24  import org.apache.maven.surefire.booter.Classpath;
25  import org.apache.maven.surefire.booter.StartupConfiguration;
26  import org.apache.maven.surefire.booter.SurefireBooterForkException;
27  import org.apache.maven.surefire.extensions.ForkNodeFactory;
28  
29  import javax.annotation.Nonnull;
30  import javax.annotation.Nullable;
31  import java.io.File;
32  import java.util.Map;
33  import java.util.Properties;
34  
35  import static org.apache.maven.surefire.shared.utils.StringUtils.join;
36  
37  /**
38   * @author <a href="mailto:tibordigana@apache.org">Tibor Digana (tibor17)</a>
39   * @since 2.21.0.Jigsaw
40   */
41  public final class ClasspathForkConfiguration
42          extends AbstractClasspathForkConfiguration
43  {
44      @SuppressWarnings( "checkstyle:parameternumber" )
45      public ClasspathForkConfiguration( @Nonnull Classpath bootClasspath, @Nonnull File tempDirectory,
46                                         @Nullable String debugLine, @Nonnull File workingDirectory,
47                                         @Nonnull Properties modelProperties, @Nullable String argLine,
48                                         @Nonnull Map<String, String> environmentVariables,
49                                         @Nonnull String[] excludedEnvironmentVariables,
50                                         boolean debug, int forkCount,
51                                         boolean reuseForks, @Nonnull Platform pluginPlatform,
52                                         @Nonnull ConsoleLogger log,
53                                         @Nonnull ForkNodeFactory forkNodeFactory )
54      {
55          super( bootClasspath, tempDirectory, debugLine, workingDirectory, modelProperties, argLine,
56              environmentVariables, excludedEnvironmentVariables, debug, forkCount, reuseForks, pluginPlatform, log,
57              forkNodeFactory );
58      }
59  
60      @Override
61      protected void resolveClasspath( @Nonnull OutputStreamFlushableCommandline cli,
62                                       @Nonnull String booterThatHasMainMethod,
63                                       @Nonnull StartupConfiguration config,
64                                       @Nonnull File dumpLogDirectory )
65              throws SurefireBooterForkException
66      {
67          cli.addEnvironment( "CLASSPATH", join( toCompleteClasspath( config ).iterator(), File.pathSeparator ) );
68          cli.createArg().setValue( booterThatHasMainMethod );
69      }
70  }