use of java.util.ServiceLoader in project knox by apache.
the class ShiroDeploymentContributorTest 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 ShiroDeploymentContributor) {
return;
}
}
fail("Failed to find " + ShiroDeploymentContributor.class.getName() + " via service loader.");
}
use of java.util.ServiceLoader in project knox by apache.
the class UsernameFunctionProcessorTest method testServiceLoader.
@Test
public void testServiceLoader() throws Exception {
ServiceLoader loader = ServiceLoader.load(UrlRewriteFunctionProcessor.class);
for (Object object : loader) {
if (object instanceof UsernameFunctionProcessor) {
return;
}
}
fail("Failed to find UsernameFunctionProcessor via service loader.");
}
use of java.util.ServiceLoader in project knox by apache.
the class UsernameFunctionDescriptorTest method testServiceLoader.
@Test
public void testServiceLoader() throws Exception {
ServiceLoader loader = ServiceLoader.load(UrlRewriteFunctionDescriptor.class);
for (Object object : loader) {
if (object instanceof UsernameFunctionDescriptor) {
return;
}
}
fail("Failed to find UsernameFunctionDescriptor via service loader.");
}
Aggregations