use of java.util.ServiceLoader in project knox by apache.
the class ServicePathFunctionProcessorTest method testServiceLoader.
@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 ServicePathFunctionProcessor) {
return;
}
}
fail("Failed to find " + ServicePathFunctionProcessor.class.getName() + " via service loader.");
}
use of java.util.ServiceLoader in project knox by apache.
the class ServicePortFunctionProcessorTest method testServiceLoader.
@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 ServicePortFunctionProcessor) {
return;
}
}
fail("Failed to find " + ServicePortFunctionProcessor.class.getName() + " via service loader.");
}
use of java.util.ServiceLoader in project knox by apache.
the class ServiceSchemeFunctionProcessorTest method testServiceLoader.
@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 ServiceSchemeFunctionProcessor) {
return;
}
}
fail("Failed to find " + ServiceSchemeFunctionProcessor.class.getName() + " via service loader.");
}
use of java.util.ServiceLoader in project knox by apache.
the class ServiceUrlFunctionProcessorTest method testServiceLoader.
@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 ServiceUrlFunctionProcessor) {
return;
}
}
fail("Failed to find " + ServiceUrlFunctionProcessor.class.getName() + " via service loader.");
}
use of java.util.ServiceLoader in project knox by apache.
the class ServicePathFunctionDescriptorTest method testServiceLoader.
@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 ServicePathFunctionDescriptor) {
return;
}
}
fail("Failed to find " + ServicePathFunctionDescriptor.class.getName() + " via service loader.");
}
Aggregations