use of org.apache.knox.gateway.config.spi.ConfigurationAdapterDescriptor in project knox by apache.
the class ConfigurationAdapterFactory method loadAdapters.
private static void loadAdapters() {
Map<Class<?>, Class<? extends ConfigurationAdapter>> all = new HashMap<>();
ServiceLoader<ConfigurationAdapterDescriptor> loader = ServiceLoader.load(ConfigurationAdapterDescriptor.class);
if (loader != null) {
Iterator<ConfigurationAdapterDescriptor> i = loader.iterator();
if (i != null) {
while (i.hasNext()) {
ConfigurationAdapterDescriptor descriptor = i.next();
Map<Class<?>, Class<? extends ConfigurationAdapter>> add = descriptor.providedConfigurationAdapters();
if (add != null) {
all.putAll(add);
}
}
}
}
ADAPTERS = Collections.unmodifiableMap(all);
}
use of org.apache.knox.gateway.config.spi.ConfigurationAdapterDescriptor in project knox by apache.
the class BeanConfigurationAdapterDescriptorTest method testDescriptor.
@Test
public void testDescriptor() {
ConfigurationAdapterDescriptor descriptor = new BeanConfigurationAdapterDescriptor();
Map<Class<?>, Class<? extends ConfigurationAdapter>> map = descriptor.providedConfigurationAdapters();
assertThat(map, hasKey((Class) Object.class));
Class<? extends ConfigurationAdapter> type = map.get(Object.class);
assertThat("Descriptor didn't return " + BeanConfigurationAdapter.class.getName(), type == BeanConfigurationAdapter.class);
}
Aggregations