Coverage Report - org.apache.maven.surefire.booter.ProviderConfiguration
 
Classes in this File Line Coverage Branch Coverage Complexity
ProviderConfiguration
0%
0/26
0%
0/12
1.286
 
 1  
 package org.apache.maven.surefire.booter;
 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.report.ReporterConfiguration;
 23  
 import org.apache.maven.surefire.testset.DirectoryScannerParameters;
 24  
 import org.apache.maven.surefire.testset.TestArtifactInfo;
 25  
 import org.apache.maven.surefire.testset.TestRequest;
 26  
 
 27  
 import java.io.File;
 28  
 import java.util.List;
 29  
 import java.util.Properties;
 30  
 
 31  
 /**
 32  
  * Represents the surefire configuration that passes all the way into the provider
 33  
  * classloader and the provider.
 34  
  * <p/>
 35  
  *
 36  
  * @author Jason van Zyl
 37  
  * @author Emmanuel Venisse
 38  
  * @author Kristian Rosenvold
 39  
  * @version $Id$
 40  
  */
 41  
 public class ProviderConfiguration
 42  
 {
 43  
     /**
 44  
      * @noinspection UnusedDeclaration
 45  
      */
 46  
     public static final int TESTS_SUCCEEDED_EXIT_CODE = 0;
 47  
 
 48  
     public static final int TESTS_FAILED_EXIT_CODE = 255;
 49  
 
 50  
     public static final int NO_TESTS_EXIT_CODE = 254;
 51  
 
 52  
     private final DirectoryScannerParameters dirScannerParams;
 53  
 
 54  
     private final ReporterConfiguration reporterConfiguration;
 55  
 
 56  
     private final TestArtifactInfo testArtifact;
 57  
 
 58  
     private final TestRequest testSuiteDefinition;
 59  
 
 60  
     private final Properties providerProperties;
 61  
 
 62  
     private final boolean failIfNoTests;
 63  
 
 64  
     private final Object forkTestSet;
 65  
 
 66  
     public ProviderConfiguration( DirectoryScannerParameters directoryScannerParameters, boolean failIfNoTests,
 67  
                                   ReporterConfiguration reporterConfiguration, TestArtifactInfo testArtifact,
 68  
                                   TestRequest testSuiteDefinition, Properties providerProperties, Object forkTestSet )
 69  0
     {
 70  0
         this.providerProperties = providerProperties;
 71  0
         this.reporterConfiguration = reporterConfiguration;
 72  0
         this.testArtifact = testArtifact;
 73  0
         this.testSuiteDefinition = testSuiteDefinition;
 74  0
         this.dirScannerParams = directoryScannerParameters;
 75  0
         this.failIfNoTests = failIfNoTests;
 76  0
         this.forkTestSet = forkTestSet;
 77  0
     }
 78  
 
 79  
 
 80  
     public ReporterConfiguration getReporterConfiguration()
 81  
     {
 82  0
         return reporterConfiguration;
 83  
     }
 84  
 
 85  
 
 86  
     public Boolean isFailIfNoTests()
 87  
     {
 88  0
         return ( failIfNoTests ) ? Boolean.TRUE : Boolean.FALSE;
 89  
     }
 90  
 
 91  
     public File getBaseDir()
 92  
     {
 93  0
         return dirScannerParams.getTestClassesDirectory();
 94  
     }
 95  
 
 96  
 
 97  
     public DirectoryScannerParameters getDirScannerParams()
 98  
     {
 99  0
         return dirScannerParams;
 100  
     }
 101  
 
 102  
     public Object[] getDirScannerParamsArray()
 103  
     {
 104  0
         if ( dirScannerParams == null )
 105  
         {
 106  0
             return null;
 107  
         }
 108  0
         return new Object[]{ dirScannerParams.getTestClassesDirectory(), dirScannerParams.getIncludes(),
 109  
             dirScannerParams.getExcludes() };
 110  
     }
 111  
 
 112  
     public List getIncludes()
 113  
     {
 114  0
         return dirScannerParams.getIncludes();
 115  
     }
 116  
 
 117  
     public List getExcludes()
 118  
     {
 119  0
         return dirScannerParams.getExcludes();
 120  
     }
 121  
 
 122  
     public TestArtifactInfo getTestArtifact()
 123  
     {
 124  0
         return testArtifact;
 125  
     }
 126  
 
 127  
     public TestRequest getTestSuiteDefinition()
 128  
     {
 129  0
         return testSuiteDefinition;
 130  
     }
 131  
 
 132  
     public Properties getProviderProperties()
 133  
     {
 134  0
         return providerProperties;
 135  
     }
 136  
 
 137  
     public Object getTestForFork()
 138  
     {
 139  0
         return forkTestSet;
 140  
     }
 141  
 
 142  
     public String getTestForForkString()
 143  
     {
 144  0
         if ( forkTestSet instanceof File )
 145  
         {
 146  0
             return forkTestSet.toString();
 147  
         }
 148  0
         return (String) forkTestSet;
 149  
     }
 150  
 
 151  
     public boolean isSurefireForkReturnCode( int returnCode )
 152  
     {
 153  0
         return TESTS_SUCCEEDED_EXIT_CODE == returnCode ||
 154  
                NO_TESTS_EXIT_CODE == returnCode ||
 155  
             TESTS_FAILED_EXIT_CODE == returnCode;
 156  
 
 157  
     }
 158  
 
 159  
 
 160  
 }