use of java.util.ServiceLoader in project knox by apache.
the class EncryptDecryptUriProcessorTest method testServiceLoader.
@SuppressWarnings("rawtypes")
@Test
public void testServiceLoader() throws Exception {
ServiceLoader loader = ServiceLoader.load(UrlRewriteStepProcessor.class);
Iterator iterator = loader.iterator();
assertThat("Service iterator empty.", iterator.hasNext());
while (iterator.hasNext()) {
Object object = iterator.next();
if (object instanceof EncryptUriProcessor) {
return;
}
}
fail("Failed to find " + EncryptUriProcessor.class.getName() + " via service loader.");
loader = ServiceLoader.load(UrlRewriteStepProcessor.class);
iterator = loader.iterator();
assertThat("Service iterator empty.", iterator.hasNext());
while (iterator.hasNext()) {
Object object = iterator.next();
if (object instanceof DecryptUriProcessor) {
return;
}
}
fail("Failed to find " + DecryptUriProcessor.class.getName() + " via service loader.");
}
use of java.util.ServiceLoader in project knox by apache.
the class FrontendFunctionProcessorTest 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 FrontendFunctionProcessor) {
return;
}
}
fail("Failed to find " + FrontendFunctionProcessor.class.getName() + " via service loader.");
}
use of java.util.ServiceLoader in project knox by apache.
the class HtmlImportFunctionProcessorTest 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 HtmlImportFunctionProcessor) {
return;
}
}
fail("Failed to find " + HtmlImportFunctionProcessor.class.getName() + " via service loader.");
}
use of java.util.ServiceLoader in project knox by apache.
the class HaProviderDeploymentContributorTest 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 HaProviderDeploymentContributor) {
return;
}
}
fail("Failed to find " + HaProviderDeploymentContributor.class.getName() + " via service loader.");
}
use of java.util.ServiceLoader in project knox by apache.
the class HostmapDeploymentContributorTest 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 HostmapDeploymentContributor) {
return;
}
}
fail("Failed to find " + HostmapDeploymentContributor.class.getName() + " via service loader.");
}
Aggregations