use of org.forgerock.openam.sm.datalayer.api.ConnectionType in project OpenAM by OpenRock.
the class DataLayerGuiceModule method configure.
@Override
protected void configure() {
bind(TokenIdGenerator.class).to(ThreadSafeTokenIdGenerator.class);
install(new FactoryModuleBuilder().implement(JavaBeanAdapter.class, JavaBeanAdapter.class).build(JavaBeanAdapterFactory.class));
Key<Map<ConnectionType, LdapDataLayerConfiguration>> connectionMapKey = Key.get(new TypeLiteral<Map<ConnectionType, LdapDataLayerConfiguration>>() {
});
binder().bind(connectionMapKey).toProvider(ConfigurationMapProvider.class).in(Singleton.class);
for (ConnectionType connectionType : ConnectionType.values()) {
if (connectionType != ConnectionType.UMA_LABELS) {
try {
DataLayerConnectionModule module = connectionType.getConfigurationClass().newInstance();
module.setConnectionType(connectionType);
binder().install(module);
} catch (Exception e) {
throw new IllegalStateException("Could not initialise connection module for " + connectionType, e);
}
}
}
}
use of org.forgerock.openam.sm.datalayer.api.ConnectionType in project OpenAM by OpenRock.
the class CTSQueueConfigurationTest method setup.
@BeforeMethod
public void setup() throws InvalidConfigurationException {
mockConfigFactory = mock(ConnectionConfigFactory.class);
mockConfig = mock(ConnectionConfig.class);
given(mockConfigFactory.getConfig(any(ConnectionType.class))).willReturn(mockConfig);
LdapDataLayerConfiguration dataLayerConfiguration = mock(LdapDataLayerConfiguration.class);
given(dataLayerConfiguration.getStoreMode()).willReturn(StoreMode.DEFAULT);
Map<ConnectionType, LdapDataLayerConfiguration> configMap = mock(Map.class);
given(configMap.get(anyObject())).willReturn(dataLayerConfiguration);
config = new CTSQueueConfiguration(mockConfigFactory, mock(Debug.class));
}
Aggregations