Search in sources :

Example 1 with NonExistentCoreException

use of org.apache.solr.common.NonExistentCoreException in project lucene-solr by apache.

the class TestInjection method injectNonExistentCoreExceptionAfterUnload.

public static boolean injectNonExistentCoreExceptionAfterUnload(String cname) {
    if (nonExistentCoreExceptionAfterUnload != null) {
        Random rand = random();
        if (null == rand)
            return true;
        Pair<Boolean, Integer> pair = parseValue(nonExistentCoreExceptionAfterUnload);
        boolean enabled = pair.first();
        int chanceIn100 = pair.second();
        if (enabled && rand.nextInt(100) >= (100 - chanceIn100)) {
            throw new NonExistentCoreException("Core not found to unload: " + cname);
        }
    }
    return true;
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Random(java.util.Random) NonExistentCoreException(org.apache.solr.common.NonExistentCoreException)

Aggregations

Random (java.util.Random)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 NonExistentCoreException (org.apache.solr.common.NonExistentCoreException)1