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;
}
Aggregations