1
package org.apache.maven.surefire.junitcore;
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
12
* http://www.apache.org/licenses/LICENSE-2.0
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
22
import java.util.Properties;
25
* @author Kristian Rosenvold
27
class JUnitCoreParameters
29
private final String parallel;
31
private final Boolean perCoreThreadCount;
33
private final int threadCount;
35
private final Boolean useUnlimitedThreads;
37
public static final String PARALLEL_KEY = "parallel";
39
public static final String PERCORETHREADCOUNT_KEY = "perCoreThreadCount";
41
public static final String THREADCOUNT_KEY = "threadCount";
43
public static final String USEUNLIMITEDTHREADS_KEY = "useUnlimitedThreads";
46
public JUnitCoreParameters( Properties properties )
48
this.parallel = properties.getProperty( PARALLEL_KEY, "none" ).toLowerCase();
49
this.perCoreThreadCount = Boolean.valueOf( properties.getProperty( PERCORETHREADCOUNT_KEY, "true" ) );
50
this.threadCount = Integer.valueOf( properties.getProperty( THREADCOUNT_KEY, "2" ) );
51
this.useUnlimitedThreads =
52
Boolean.valueOf( properties.getProperty( USEUNLIMITEDTHREADS_KEY, "false" ) );
55
public boolean isParallelMethod()
57
return "methods".equals( parallel );
60
public boolean isParallelClasses()
62
return "classes".equals( parallel );
65
public boolean isParallelBoth()
67
return "both".equals( parallel );
70
public Boolean isPerCoreThreadCount()
72
return perCoreThreadCount;
75
public int getThreadCount()
80
public Boolean isUseUnlimitedThreads()
82
return useUnlimitedThreads;
85
public boolean isNoThreading()
87
return !( isParallelClasses() || isParallelMethod() || isParallelBoth() );
90
public boolean isAnyParallelitySelected()
92
return !isNoThreading();
96
public String toString()
98
return "parallel='" + parallel + '\'' + ", perCoreThreadCount=" + perCoreThreadCount + ", threadCount="
99
+ threadCount + ", useUnlimitedThreads=" + useUnlimitedThreads;