Coverage Report - org.apache.maven.plugin.surefire.InPluginVMSurefireStarter
 
Classes in this File Line Coverage Branch Coverage Complexity
InPluginVMSurefireStarter
0%
0/11
N/A
1
 
 1  
 package org.apache.maven.plugin.surefire;
 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.surefire.booter.ProviderConfiguration;
 23  
 import org.apache.maven.surefire.booter.ProviderFactory;
 24  
 import org.apache.maven.surefire.booter.StartupConfiguration;
 25  
 import org.apache.maven.surefire.booter.StartupReportConfiguration;
 26  
 import org.apache.maven.surefire.booter.SurefireExecutionException;
 27  
 import org.apache.maven.surefire.suite.RunResult;
 28  
 
 29  
 /**
 30  
  * Starts the provider in the same VM as the surefire plugin.
 31  
  * <p/>
 32  
  * This part of the booter is always guaranteed to be in the
 33  
  * same vm as the tests will be run in.
 34  
  *
 35  
  * @author Jason van Zyl
 36  
  * @author Brett Porter
 37  
  * @author Emmanuel Venisse
 38  
  * @author Dan Fabulich
 39  
  * @author Kristian Rosenvold
 40  
  * @version $Id$
 41  
  */
 42  
 public class InPluginVMSurefireStarter
 43  
 {
 44  
 
 45  
     private final StartupConfiguration startupConfiguration;
 46  
 
 47  
     private final StartupReportConfiguration startupReportConfiguration;
 48  
 
 49  
     private final ProviderConfiguration providerConfiguration;
 50  
 
 51  
     public InPluginVMSurefireStarter( StartupConfiguration startupConfiguration,
 52  
                                       ProviderConfiguration providerConfiguration,
 53  
                                       StartupReportConfiguration startupReportConfiguration )
 54  0
     {
 55  0
         this.startupConfiguration = startupConfiguration;
 56  0
         this.startupReportConfiguration = startupReportConfiguration;
 57  0
         this.providerConfiguration = providerConfiguration;
 58  0
     }
 59  
 
 60  
     public RunResult runSuitesInProcess()
 61  
         throws SurefireExecutionException
 62  
     {
 63  
         // The test classloader must be constructed first to avoid issues with commons-logging until we properly
 64  
         // separate the TestNG classloader
 65  0
         startupConfiguration.writeSurefireTestClasspathProperty();
 66  0
         ClassLoader testsClassLoader = startupConfiguration.getClasspathConfiguration().createTestClassLoader();
 67  
 
 68  0
         ClassLoader surefireClassLoader =
 69  
             startupConfiguration.getClasspathConfiguration().createInprocSurefireClassLoader( testsClassLoader );
 70  
 
 71  0
         CommonReflector surefireReflector = new CommonReflector( surefireClassLoader );
 72  
 
 73  0
         final Object factory = surefireReflector.createReportingReporterFactory( startupReportConfiguration );
 74  
 
 75  0
         return ProviderFactory.invokeProvider( null, testsClassLoader, surefireClassLoader, factory,
 76  
                                                providerConfiguration, false, startupConfiguration );
 77  
     }
 78  
 
 79  
 }