static Concurrency resolveConcurrency()

in surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/pc/ParallelComputerUtil.java [63:92]


    static Concurrency resolveConcurrency(JUnitCoreParameters params, RunnerCounter counts)
            throws TestSetFailedException {
        if (!params.isParallelismSelected()) {
            throw new TestSetFailedException("Unspecified parameter '" + JUnitCoreParameters.PARALLEL_KEY + "'.");
        }

        if (!params.isUseUnlimitedThreads() && !hasThreadCount(params) && !hasThreadCounts(params)) {
            throw new TestSetFailedException("Unspecified thread-count(s). "
                    + "See the parameters "
                    + JUnitCoreParameters.USEUNLIMITEDTHREADS_KEY + ", "
                    + JUnitCoreParameters.THREADCOUNT_KEY + ", "
                    + JUnitCoreParameters.THREADCOUNTSUITES_KEY + ", "
                    + JUnitCoreParameters.THREADCOUNTCLASSES_KEY + ", "
                    + JUnitCoreParameters.THREADCOUNTMETHODS_KEY + ".");
        }

        if (params.isUseUnlimitedThreads()) {
            return concurrencyForUnlimitedThreads(params);
        } else if (hasThreadCount(params)) {
            if (hasThreadCounts(params)) {
                return isLeafUnspecified(params)
                        ? concurrencyFromAllThreadCountsButUnspecifiedLeafCount(params, counts)
                        : concurrencyFromAllThreadCounts(params);
            } else {
                return estimateConcurrency(params, counts);
            }
        } else {
            return concurrencyFromThreadCounts(params);
        }
    }