use of java.util.ServiceLoader in project knox by apache.
the class FrontendFunctionDescriptorTest method testServiceLoader.
@SuppressWarnings("rawtypes")
@Test
public void testServiceLoader() throws Exception {
ServiceLoader loader = ServiceLoader.load(UrlRewriteFunctionDescriptor.class);
Iterator iterator = loader.iterator();
assertThat("Service iterator empty.", iterator.hasNext());
while (iterator.hasNext()) {
Object object = iterator.next();
if (object instanceof FrontendFunctionDescriptor) {
return;
}
}
fail("Failed to find " + FrontendFunctionDescriptor.class.getName() + " via service loader.");
}
use of java.util.ServiceLoader in project knox by apache.
the class Log4jMessageLoggerFactoryTest method testServiceLoader.
@Test
public void testServiceLoader() throws Exception {
ServiceLoader loader = ServiceLoader.load(MessageLoggerFactory.class);
Iterator iterator = loader.iterator();
assertThat("Service iterator empty.", iterator.hasNext());
while (iterator.hasNext()) {
Object object = iterator.next();
if (object instanceof Log4jMessageLoggerFactory) {
return;
}
}
fail("Failed to find " + Log4jMessageLoggerFactory.class.getName() + " via service loader.");
}
use of java.util.ServiceLoader in project knox by apache.
the class Sl4jMessageLoggerFactoryTest method testServiceLoader.
@Test
public void testServiceLoader() throws Exception {
ServiceLoader loader = ServiceLoader.load(MessageLoggerFactory.class);
Iterator iterator = loader.iterator();
assertThat("Service iterator empty.", iterator.hasNext());
while (iterator.hasNext()) {
Object object = iterator.next();
if (object instanceof Sl4jMessageLoggerFactory) {
return;
}
}
fail("Failed to find " + Sl4jMessageLoggerFactory.class.getName() + " via service loader.");
}
use of java.util.ServiceLoader in project knox by apache.
the class HtmlPostfixProcessorTest method testServiceLoader.
@SuppressWarnings("rawtypes")
@Test
public void testServiceLoader() throws Exception {
ServiceLoader loader = ServiceLoader.load(UrlRewriteFunctionProcessor.class);
Iterator iterator = loader.iterator();
assertThat("Service iterator empty.", iterator.hasNext());
while (iterator.hasNext()) {
Object object = iterator.next();
if (object instanceof HtmlPostfixProcessor) {
return;
}
}
fail("Failed to find " + HtmlPostfixProcessor.class.getName() + " via service loader.");
}
use of java.util.ServiceLoader in project knox by apache.
the class AnonymousAuthDeploymentContributorTest method testServiceLoader.
@Test
public void testServiceLoader() throws Exception {
ServiceLoader loader = ServiceLoader.load(ProviderDeploymentContributor.class);
Iterator iterator = loader.iterator();
assertThat("Service iterator empty.", iterator.hasNext());
while (iterator.hasNext()) {
Object object = iterator.next();
if (object instanceof AnonymousAuthDeploymentContributor) {
return;
}
}
fail("Failed to find " + AnonymousAuthDeploymentContributor.class.getName() + " via service loader.");
}
Aggregations