Search in sources :

Example 1 with LdapMappingContext

use of org.springframework.data.ldap.core.mapping.LdapMappingContext in project spring-data-ldap by spring-projects.

the class PartTreeLdapRepositoryQueryTests method assertFilterAndBaseForMethod.

private void assertFilterAndBaseForMethod(Method targetMethod, String expectedFilter, String expectedBase, Object... expectedParams) {
    LdapQueryMethod queryMethod = new LdapQueryMethod(targetMethod, repositoryMetadata, factory);
    PartTreeLdapRepositoryQuery tested = new PartTreeLdapRepositoryQuery(queryMethod, entityClass, ldapTemplate, new LdapMappingContext(), new EntityInstantiators());
    LdapQuery query = tested.createQuery(new LdapParametersParameterAccessor(queryMethod, expectedParams));
    String base = query.base().toString();
    assertThat(base).isEqualTo(expectedBase);
    assertThat(query.filter().encode()).isEqualTo(expectedFilter);
}
Also used : LdapMappingContext(org.springframework.data.ldap.core.mapping.LdapMappingContext) EntityInstantiators(org.springframework.data.mapping.model.EntityInstantiators) LdapQuery(org.springframework.ldap.query.LdapQuery)

Example 2 with LdapMappingContext

use of org.springframework.data.ldap.core.mapping.LdapMappingContext in project spring-data-ldap by spring-projects.

the class LdapRepositoryFactoryBean method afterPropertiesSet.

/*
	 * (non-Javadoc)
	 * @see org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport#afterPropertiesSet()
	 */
@Override
public void afterPropertiesSet() {
    Assert.notNull(ldapOperations, "LdapOperations must be set");
    super.afterPropertiesSet();
    if (!mappingContextConfigured) {
        setMappingContext(new LdapMappingContext());
    }
}
Also used : LdapMappingContext(org.springframework.data.ldap.core.mapping.LdapMappingContext)

Example 3 with LdapMappingContext

use of org.springframework.data.ldap.core.mapping.LdapMappingContext in project spring-data-ldap by spring-projects.

the class QuerydslLdapPredicateExecutorUnitTests method before.

@BeforeEach
void before() throws Exception {
    when(ldapOperations.getObjectDirectoryMapper()).thenReturn(new DefaultObjectDirectoryMapper());
    repository = new QuerydslLdapPredicateExecutor<>(UnitTestPerson.class, new SpelAwareProxyProjectionFactory(), ldapOperations, new LdapMappingContext());
    walter = new UnitTestPerson(new LdapName("cn=walter"), "Walter", "White", Collections.emptyList(), "US", "Heisenberg", "000");
    hank = new UnitTestPerson(new LdapName("cn=hank"), "Hank", "Schrader", Collections.emptyList(), "US", "DEA", "000");
}
Also used : SpelAwareProxyProjectionFactory(org.springframework.data.projection.SpelAwareProxyProjectionFactory) DefaultObjectDirectoryMapper(org.springframework.ldap.odm.core.impl.DefaultObjectDirectoryMapper) LdapMappingContext(org.springframework.data.ldap.core.mapping.LdapMappingContext) LdapName(javax.naming.ldap.LdapName) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

LdapMappingContext (org.springframework.data.ldap.core.mapping.LdapMappingContext)3 LdapName (javax.naming.ldap.LdapName)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1 EntityInstantiators (org.springframework.data.mapping.model.EntityInstantiators)1 SpelAwareProxyProjectionFactory (org.springframework.data.projection.SpelAwareProxyProjectionFactory)1 DefaultObjectDirectoryMapper (org.springframework.ldap.odm.core.impl.DefaultObjectDirectoryMapper)1 LdapQuery (org.springframework.ldap.query.LdapQuery)1