use of org.forgerock.openam.sm.datalayer.impl.ldap.LdapDataLayerConfiguration 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));
}
use of org.forgerock.openam.sm.datalayer.impl.ldap.LdapDataLayerConfiguration in project OpenAM by OpenRock.
the class LdapAdapterTest method shouldPerformUpdate.
@Test
public void shouldPerformUpdate() throws Exception {
// Given
Token first = new Token("weasel", TokenType.OAUTH);
Token second = new Token("badger", TokenType.OAUTH);
Connection mockConnection = mock(Connection.class);
Result successResult = mockSuccessfulResult();
given(mockConnection.modify(any(ModifyRequest.class))).willReturn(successResult);
LdapDataLayerConfiguration config = mock(LdapDataLayerConfiguration.class);
when(config.getTokenStoreRootSuffix()).thenReturn(DN.valueOf("ou=unit-test"));
LDAPDataConversion dataConversion = new LDAPDataConversion();
LdapTokenAttributeConversion conversion = new LdapTokenAttributeConversion(dataConversion, config);
LdapAdapter adapter = new LdapAdapter(conversion, null, null);
// When
adapter.update(mockConnection, first, second);
// Then
verify(mockConnection).modify(any(ModifyRequest.class));
}
use of org.forgerock.openam.sm.datalayer.impl.ldap.LdapDataLayerConfiguration in project OpenAM by OpenRock.
the class LdapTokenAttributeConversionTest method shouldProduceDNWithTokenId.
@Test
public void shouldProduceDNWithTokenId() {
// Given
String tokenId = "badger";
LdapDataLayerConfiguration config = mock(LdapDataLayerConfiguration.class);
given(config.getTokenStoreRootSuffix()).willReturn(DN.rootDN());
LDAPDataConversion dataConversion = new LDAPDataConversion();
LdapTokenAttributeConversion conversion = new LdapTokenAttributeConversion(dataConversion, config);
// When
DN dn = conversion.generateTokenDN(tokenId);
// Then
verify(config).getTokenStoreRootSuffix();
assertTrue(dn.toString().contains(tokenId));
}
use of org.forgerock.openam.sm.datalayer.impl.ldap.LdapDataLayerConfiguration in project OpenAM by OpenRock.
the class LdapTokenAttributeConversionTest method generateTokenAttributeConversion.
private LdapTokenAttributeConversion generateTokenAttributeConversion() {
LdapDataLayerConfiguration config = new CTSDataLayerConfiguration("ou=test-case");
LDAPDataConversion dataConversion = new LDAPDataConversion();
return new LdapTokenAttributeConversion(dataConversion, config);
}
use of org.forgerock.openam.sm.datalayer.impl.ldap.LdapDataLayerConfiguration in project OpenAM by OpenRock.
the class LdapAdapterTest method shouldNoNothingIfNoModificaitonsOnUpdate.
@Test
public void shouldNoNothingIfNoModificaitonsOnUpdate() throws Exception {
// Given
String tokenId = "badger";
Token first = new Token(tokenId, TokenType.OAUTH);
Token second = new Token(tokenId, TokenType.OAUTH);
Connection mockConnection = mock(Connection.class);
LdapDataLayerConfiguration config = mock(LdapDataLayerConfiguration.class);
when(config.getTokenStoreRootSuffix()).thenReturn(DN.valueOf("ou=unit-test"));
LDAPDataConversion dataConversion = new LDAPDataConversion();
LdapTokenAttributeConversion conversion = new LdapTokenAttributeConversion(dataConversion, config);
adapter = new LdapAdapter(conversion, mockQueryVisitor, mockQueryFactory);
// When
adapter.update(mockConnection, first, second);
// Then
verify(mockConnection, never()).modify(any(ModifyRequest.class));
}
Aggregations