From 159dfd1fcbfb4ae0828955b9962262b40a9823d7 Mon Sep 17 00:00:00 2001
From: Josh Cummings
Date: Thu, 15 Aug 2024 11:22:29 -0600
Subject: [PATCH] Fix Formatting
---
.../ldap/aot/hint/LdapCoreRuntimeHints.java | 58 ++--
.../ldap/config/ContextSourceParser.java | 9 +-
.../config/DefaultRenamingStrategyParser.java | 7 +-
.../ldap/config/TransactionManagerParser.java | 4 +-
.../ldap/core/DefaultLdapClient.java | 8 +-
.../springframework/ldap/core/LdapRdn.java | 2 +-
.../ldap/core/LdapTemplate.java | 11 +-
.../BaseLdapPathBeanPostProcessor.java | 2 +-
.../DefaultIncrementalAttributesMapper.java | 2 +-
.../ldap/odm/annotations/DnAttribute.java | 1 +
.../ldap/odm/annotations/Id.java | 1 -
.../ldap/odm/annotations/Transient.java | 1 -
.../impl/DefaultObjectDirectoryMapper.java | 2 +-
.../ldap/odm/core/impl/ObjectMetaData.java | 4 +-
.../DirContextPoolableObjectFactory.java | 2 +-
.../DirContextPooledObjectFactory.java | 2 +-
.../ldap/query/DefaultContainerCriteria.java | 10 +-
...SourceAndDataSourceTransactionManager.java | 4 +-
...tSourceAndHibernateTransactionManager.java | 4 +-
...ctionAwareDirContextInvocationHandler.java | 2 +-
...ompensatingTransactionManagerDelegate.java | 2 +-
.../support/CompensatingTransactionUtils.java | 4 +-
.../ldap/NamingExceptionTests.java | 6 +-
.../aot/hint/LdapCoreRuntimeHintsTests.java | 80 +++--
.../LdapTemplateNamespaceHandlerTests.java | 14 +-
...equestControlDirContextProcessorTests.java | 2 +-
...tingNameClassPairCallbackHandlerTests.java | 2 +-
.../ldap/core/DefaultLdapClientListTests.java | 8 +-
.../core/DefaultLdapClientLookupTests.java | 6 +-
.../ldap/core/DefaultLdapClientTests.java | 94 ++++--
.../ldap/core/LdapTemplateTests.java | 42 ++-
.../BaseLdapPathBeanPostProcessorTests.java | 2 +-
.../core/support/LdapContextSourceTests.java | 6 +-
.../ldap/filter/AndFilterTests.java | 5 +-
.../ldap/filter/OrFilterTests.java | 5 +-
.../DefaultObjectDirectoryMapperTests.java | 13 +-
.../ldap/pool/DelegatingContextTests.java | 2 +-
.../DirContextPoolableObjectFactoryTests.java | 2 +-
.../DefaultDirContextValidatorTests.java | 8 +-
.../ldap/pool2/DelegatingContextTests.java | 2 +-
.../DirContextPooledObjectFactoryTests.java | 2 +-
.../ldap/query/LdapQueryBuilderTests.java | 25 +-
.../ldap/support/LdapNameBuilderTests.java | 6 +-
.../ldap/support/LdapUtilsTests.java | 128 +++----
.../BindOperationRecorderTests.java | 4 +-
...odifyAttributesOperationRecorderTests.java | 4 +-
.../RebindOperationRecorderTests.java | 2 +-
.../RenameOperationRecorderTests.java | 2 +-
.../ContextSourceTransactionManagerTests.java | 6 +-
...atingTransactionOperationManagerTests.java | 2 +-
.../ldap/ldif/parser/LdifParser.java | 119 +++----
...DefaultAttributeValidationPolicyTests.java | 43 +--
.../ldap/odm/tools/SchemaReader.java | 34 +-
.../ldap/odm/tools/SchemaToJava.java | 6 +-
.../ldap/odm/tools/SchemaViewer.java | 5 +-
.../ldap/odm/test/ConverterFactoryTests.java | 2 +-
.../ldap/odm/test/ConverterManagerTests.java | 4 +-
.../ldap/odm/test/LdapTests.java | 4 +-
.../ldap/odm/test/SchemaToJavaTests.java | 2 +-
.../odm/test/utils/CompilerInterface.java | 2 +-
...stViewControlDirContextProcessorTests.java | 24 +-
...stractEc2InstanceLaunchingFactoryBean.java | 2 +-
.../ad/IncrementalAttributeMapperITests.java | 2 +-
...DefaultLdapClientAuthenticationITests.java | 22 +-
.../DefaultLdapClientBindUnbindITests.java | 2 +-
.../itest/DefaultLdapClientListITests.java | 2 +-
.../itest/DefaultLdapClientLookupITests.java | 21 +-
...DefaultLdapClientLookupMultiRdnITests.java | 5 +-
...efaultLdapClientRecursiveDeleteITests.java | 4 +-
.../DefaultLdapClientSearchResultITests.java | 319 ++++++++++++------
.../LdapTemplateAuthenticationITests.java | 8 +-
.../LdapTemplateLookupMultiRdnITests.java | 4 +-
.../itest/LdapTemplateNoBaseSuffixITests.java | 2 +-
.../itest/LdapTemplateSearchResultITests.java | 153 ++++++---
...lateSearchResultNamespaceConfigITests.java | 153 ++++++---
.../control/SupportedControlsITests.java | 2 +-
.../core/simple/SimpleLdapTemplateITests.java | 2 +-
...rceTransactionManagerIntegrationTests.java | 4 +-
...sactionManagerLdap179IntegrationTests.java | 2 +-
...urceTransactionManagerNamespaceITests.java | 4 +-
...ateTransactionManagerIntegrationTests.java | 2 +-
...sactionManagerLdap179IntegrationTests.java | 2 +-
...nateTransactionManagerNamespaceITests.java | 2 +-
...dapTemplateOdmWithDnAnnotationsITests.java | 14 +-
...pTemplateOdmWithNoDnAnnotationsITests.java | 8 +-
85 files changed, 964 insertions(+), 644 deletions(-)
diff --git a/core/src/main/java/org/springframework/ldap/aot/hint/LdapCoreRuntimeHints.java b/core/src/main/java/org/springframework/ldap/aot/hint/LdapCoreRuntimeHints.java
index 6844176d..130bf2ca 100644
--- a/core/src/main/java/org/springframework/ldap/aot/hint/LdapCoreRuntimeHints.java
+++ b/core/src/main/java/org/springframework/ldap/aot/hint/LdapCoreRuntimeHints.java
@@ -38,38 +38,50 @@ class LdapCoreRuntimeHints implements RuntimeHintsRegistrar {
@Override
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
- hints.reflection().registerType(TypeReference.of("com.sun.jndi.ldap.LdapCtxFactory"),
- (builder) -> builder.withMembers(MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS));
- hints.reflection().registerType(AbstractContextSource.class, (builder) -> builder
+ hints.reflection()
+ .registerType(TypeReference.of("com.sun.jndi.ldap.LdapCtxFactory"),
+ (builder) -> builder.withMembers(MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS));
+ hints.reflection()
+ .registerType(AbstractContextSource.class, (builder) -> builder
.withMembers(MemberCategory.INTROSPECT_DECLARED_METHODS, MemberCategory.DECLARED_FIELDS));
- hints.reflection().registerType(DefaultDirObjectFactory.class,
- (builder) -> builder.withMembers(MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS));
- hints.reflection().registerTypeIfPresent(classLoader, "javax.naming.ldap.PagedResultsControl",
- (builder) -> builder.onReachableType(PagedResultsDirContextProcessor.class)
+ hints.reflection()
+ .registerType(DefaultDirObjectFactory.class,
+ (builder) -> builder.withMembers(MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS));
+ hints.reflection()
+ .registerTypeIfPresent(classLoader, "javax.naming.ldap.PagedResultsControl",
+ (builder) -> builder.onReachableType(PagedResultsDirContextProcessor.class)
.withMembers(MemberCategory.INVOKE_PUBLIC_METHODS, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS));
- hints.reflection().registerTypeIfPresent(classLoader, "com.sun.jndi.ldap.ctl.PagedResultsControl",
- (builder) -> builder.onReachableType(PagedResultsDirContextProcessor.class)
+ hints.reflection()
+ .registerTypeIfPresent(classLoader, "com.sun.jndi.ldap.ctl.PagedResultsControl",
+ (builder) -> builder.onReachableType(PagedResultsDirContextProcessor.class)
.withMembers(MemberCategory.INVOKE_PUBLIC_METHODS, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS));
- hints.reflection().registerTypeIfPresent(classLoader, "javax.naming.ldap.PagedResultsResponseControl",
- (builder) -> builder.onReachableType(PagedResultsDirContextProcessor.class)
+ hints.reflection()
+ .registerTypeIfPresent(classLoader, "javax.naming.ldap.PagedResultsResponseControl",
+ (builder) -> builder.onReachableType(PagedResultsDirContextProcessor.class)
.withMembers(MemberCategory.INVOKE_PUBLIC_METHODS, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS));
- hints.reflection().registerTypeIfPresent(classLoader, "com.sun.jndi.ldap.ctl.PagedResultsResponseControl",
- (builder) -> builder.onReachableType(PagedResultsDirContextProcessor.class)
+ hints.reflection()
+ .registerTypeIfPresent(classLoader, "com.sun.jndi.ldap.ctl.PagedResultsResponseControl",
+ (builder) -> builder.onReachableType(PagedResultsDirContextProcessor.class)
.withMembers(MemberCategory.INVOKE_PUBLIC_METHODS, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS));
- hints.reflection().registerTypeIfPresent(classLoader, "javax.naming.ldap.SortControl",
- (builder) -> builder.onReachableType(SortControlDirContextProcessor.class)
+ hints.reflection()
+ .registerTypeIfPresent(classLoader, "javax.naming.ldap.SortControl",
+ (builder) -> builder.onReachableType(SortControlDirContextProcessor.class)
.withMembers(MemberCategory.INVOKE_PUBLIC_METHODS, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS));
- hints.reflection().registerTypeIfPresent(classLoader, "com.sun.jndi.ldap.ctl.SortControl",
- (builder) -> builder.onReachableType(SortControlDirContextProcessor.class)
+ hints.reflection()
+ .registerTypeIfPresent(classLoader, "com.sun.jndi.ldap.ctl.SortControl",
+ (builder) -> builder.onReachableType(SortControlDirContextProcessor.class)
.withMembers(MemberCategory.INVOKE_PUBLIC_METHODS, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS));
- hints.reflection().registerTypeIfPresent(classLoader, "javax.naming.ldap.SortResponseControl",
- (builder) -> builder.onReachableType(SortControlDirContextProcessor.class)
+ hints.reflection()
+ .registerTypeIfPresent(classLoader, "javax.naming.ldap.SortResponseControl",
+ (builder) -> builder.onReachableType(SortControlDirContextProcessor.class)
.withMembers(MemberCategory.INVOKE_PUBLIC_METHODS, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS));
- hints.reflection().registerTypeIfPresent(classLoader, "com.sun.jndi.ldap.ctl.SortResponseControl",
- (builder) -> builder.onReachableType(SortControlDirContextProcessor.class)
+ hints.reflection()
+ .registerTypeIfPresent(classLoader, "com.sun.jndi.ldap.ctl.SortResponseControl",
+ (builder) -> builder.onReachableType(SortControlDirContextProcessor.class)
.withMembers(MemberCategory.INVOKE_PUBLIC_METHODS, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS));
- hints.reflection().registerType(TypeReference.of("javax.net.ssl.SSLSocketFactory"),
- (builder) -> builder.withMethod("getDefault", Collections.emptyList(), ExecutableMode.INVOKE)
+ hints.reflection()
+ .registerType(TypeReference.of("javax.net.ssl.SSLSocketFactory"),
+ (builder) -> builder.withMethod("getDefault", Collections.emptyList(), ExecutableMode.INVOKE)
.onReachableType(TypeReference.of("com.sun.jndi.ldap.Connection")));
}
diff --git a/core/src/main/java/org/springframework/ldap/config/ContextSourceParser.java b/core/src/main/java/org/springframework/ldap/config/ContextSourceParser.java
index 73c8d3b4..3510388b 100644
--- a/core/src/main/java/org/springframework/ldap/config/ContextSourceParser.java
+++ b/core/src/main/java/org/springframework/ldap/config/ContextSourceParser.java
@@ -177,7 +177,8 @@ public class ContextSourceParser implements BeanDefinitionParser {
builder.addPropertyValue("password", password);
BeanDefinitionBuilder urlsBuilder = BeanDefinitionBuilder.rootBeanDefinition(UrlsFactory.class)
- .setFactoryMethod("urls").addConstructorArgValue(url);
+ .setFactoryMethod("urls")
+ .addConstructorArgValue(url);
builder.addPropertyValue("urls", urlsBuilder.getBeanDefinition());
builder.addPropertyValue("base", ParserUtils.getString(element, ATT_BASE, ""));
@@ -215,7 +216,7 @@ public class ContextSourceParser implements BeanDefinitionParser {
BeanDefinition actualContextSourceDefinition = targetContextSourceDefinition;
if (!anonymousReadOnly) {
BeanDefinitionBuilder proxyBuilder = BeanDefinitionBuilder
- .rootBeanDefinition(TransactionAwareContextSourceProxy.class);
+ .rootBeanDefinition(TransactionAwareContextSourceProxy.class);
proxyBuilder.addConstructorArgValue(targetContextSourceDefinition);
actualContextSourceDefinition = proxyBuilder.getBeanDefinition();
}
@@ -306,7 +307,7 @@ public class ContextSourceParser implements BeanDefinitionParser {
builder.addPropertyValue("testWhileIdle", testWhileIdle);
BeanDefinitionBuilder validatorBuilder = BeanDefinitionBuilder
- .rootBeanDefinition(DefaultDirContextValidator.class);
+ .rootBeanDefinition(DefaultDirContextValidator.class);
validatorBuilder.addPropertyValue("base", ParserUtils.getString(element, ATT_VALIDATION_QUERY_BASE, ""));
validatorBuilder.addPropertyValue("filter",
ParserUtils.getString(element, ATT_VALIDATION_QUERY_FILTER, DefaultDirContextValidator.DEFAULT_FILTER));
@@ -342,7 +343,7 @@ public class ContextSourceParser implements BeanDefinitionParser {
private void populatePoolValidationProperties(BeanDefinitionBuilder builder, Element element) {
BeanDefinitionBuilder validatorBuilder = BeanDefinitionBuilder
- .rootBeanDefinition(org.springframework.ldap.pool2.validation.DefaultDirContextValidator.class);
+ .rootBeanDefinition(org.springframework.ldap.pool2.validation.DefaultDirContextValidator.class);
validatorBuilder.addPropertyValue("base", ParserUtils.getString(element, ATT_VALIDATION_QUERY_BASE, ""));
validatorBuilder.addPropertyValue("filter", ParserUtils.getString(element, ATT_VALIDATION_QUERY_FILTER,
org.springframework.ldap.pool2.validation.DefaultDirContextValidator.DEFAULT_FILTER));
diff --git a/core/src/main/java/org/springframework/ldap/config/DefaultRenamingStrategyParser.java b/core/src/main/java/org/springframework/ldap/config/DefaultRenamingStrategyParser.java
index 87d7d91f..7af4dffe 100644
--- a/core/src/main/java/org/springframework/ldap/config/DefaultRenamingStrategyParser.java
+++ b/core/src/main/java/org/springframework/ldap/config/DefaultRenamingStrategyParser.java
@@ -35,14 +35,15 @@ public class DefaultRenamingStrategyParser implements BeanDefinitionParser {
@Override
public BeanDefinition parse(Element element, ParserContext parserContext) {
BeanDefinitionBuilder builder = BeanDefinitionBuilder
- .rootBeanDefinition(DefaultTempEntryRenamingStrategy.class);
+ .rootBeanDefinition(DefaultTempEntryRenamingStrategy.class);
builder.addPropertyValue("tempSuffix",
ParserUtils.getString(element, ATT_TEMP_SUFFIX, DefaultTempEntryRenamingStrategy.DEFAULT_TEMP_SUFFIX));
AbstractBeanDefinition beanDefinition = builder.getBeanDefinition();
- parserContext.getContainingBeanDefinition().getPropertyValues().addPropertyValue("renamingStrategy",
- beanDefinition);
+ parserContext.getContainingBeanDefinition()
+ .getPropertyValues()
+ .addPropertyValue("renamingStrategy", beanDefinition);
return beanDefinition;
}
diff --git a/core/src/main/java/org/springframework/ldap/config/TransactionManagerParser.java b/core/src/main/java/org/springframework/ldap/config/TransactionManagerParser.java
index 18b4b870..550a2904 100644
--- a/core/src/main/java/org/springframework/ldap/config/TransactionManagerParser.java
+++ b/core/src/main/java/org/springframework/ldap/config/TransactionManagerParser.java
@@ -101,7 +101,7 @@ public class TransactionManagerParser implements BeanDefinitionParser {
private BeanDefinition parseDifferentSubtreeRenamingStrategy(Element element) {
BeanDefinitionBuilder builder = BeanDefinitionBuilder
- .rootBeanDefinition(DifferentSubtreeTempEntryRenamingStrategy.class);
+ .rootBeanDefinition(DifferentSubtreeTempEntryRenamingStrategy.class);
String subtreeNode = element.getAttribute(ATT_SUBTREE_NODE);
Assert.hasText(subtreeNode, ATT_SUBTREE_NODE + " must be specified");
@@ -113,7 +113,7 @@ public class TransactionManagerParser implements BeanDefinitionParser {
public BeanDefinition parseDefaultRenamingStrategy(Element element) {
BeanDefinitionBuilder builder = BeanDefinitionBuilder
- .rootBeanDefinition(DefaultTempEntryRenamingStrategy.class);
+ .rootBeanDefinition(DefaultTempEntryRenamingStrategy.class);
builder.addPropertyValue("tempSuffix",
ParserUtils.getString(element, ATT_TEMP_SUFFIX, DefaultTempEntryRenamingStrategy.DEFAULT_TEMP_SUFFIX));
diff --git a/core/src/main/java/org/springframework/ldap/core/DefaultLdapClient.java b/core/src/main/java/org/springframework/ldap/core/DefaultLdapClient.java
index b620e018..1f8cd0b7 100644
--- a/core/src/main/java/org/springframework/ldap/core/DefaultLdapClient.java
+++ b/core/src/main/java/org/springframework/ldap/core/DefaultLdapClient.java
@@ -318,8 +318,10 @@ class DefaultLdapClient implements LdapClient {
Enumeration enumeration = enumeration(results);
Function super S, T> function = mapper.wrap(this.namingExceptionHandler);
return StreamSupport
- .stream(Spliterators.spliteratorUnknownSize(enumeration.asIterator(), Spliterator.ORDERED), false)
- .map(function::apply).filter(Objects::nonNull).onClose(() -> closeNamingEnumeration(results));
+ .stream(Spliterators.spliteratorUnknownSize(enumeration.asIterator(), Spliterator.ORDERED), false)
+ .map(function::apply)
+ .filter(Objects::nonNull)
+ .onClose(() -> closeNamingEnumeration(results));
}
private void closeContext(DirContext ctx) {
@@ -467,7 +469,7 @@ class DefaultLdapClient implements LdapClient {
try {
String password = (this.password != null) ? new String(this.password) : null;
ctx = DefaultLdapClient.this.contextSource
- .getContext(identification.get(0).getAbsoluteName().toString(), password);
+ .getContext(identification.get(0).getAbsoluteName().toString(), password);
return mapper.mapWithContext(ctx, identification.get(0));
}
finally {
diff --git a/core/src/main/java/org/springframework/ldap/core/LdapRdn.java b/core/src/main/java/org/springframework/ldap/core/LdapRdn.java
index 1256b98b..d6dd3b28 100644
--- a/core/src/main/java/org/springframework/ldap/core/LdapRdn.java
+++ b/core/src/main/java/org/springframework/ldap/core/LdapRdn.java
@@ -287,7 +287,7 @@ public class LdapRdn implements Serializable, Comparable {
mapWithImmutableRdns.put(rdnComponent.getKey(), rdnComponent.immutableLdapRdnComponent());
}
Map unmodifiableMapOfImmutableRdns = Collections
- .unmodifiableMap(mapWithImmutableRdns);
+ .unmodifiableMap(mapWithImmutableRdns);
LdapRdn immutableRdn = new LdapRdn();
immutableRdn.components = unmodifiableMapOfImmutableRdns;
return immutableRdn;
diff --git a/core/src/main/java/org/springframework/ldap/core/LdapTemplate.java b/core/src/main/java/org/springframework/ldap/core/LdapTemplate.java
index 07651c11..1c89bf34 100644
--- a/core/src/main/java/org/springframework/ldap/core/LdapTemplate.java
+++ b/core/src/main/java/org/springframework/ldap/core/LdapTemplate.java
@@ -1334,7 +1334,7 @@ public class LdapTemplate implements LdapOperations, InitializingBean {
return authenticate(base, filter, password,
getDefaultSearchControls(this.defaultSearchScope, RETURN_OBJ_FLAG, null), callback, errorCallback)
- .isSuccess();
+ .isSuccess();
}
private AuthenticationStatus authenticate(Name base, String filter, String password, SearchControls searchControls,
@@ -1572,10 +1572,11 @@ public class LdapTemplate implements LdapOperations, InitializingBean {
return Stream.empty();
}
return StreamSupport
- .stream(Spliterators.spliteratorUnknownSize(CollectionUtils.toIterator(results), Spliterator.ORDERED),
- false)
- .map((nameClassPair) -> unchecked(() -> mapper.apply(nameClassPair))).filter(Objects::nonNull)
- .onClose(() -> closeContextAndNamingEnumeration(ctx, results));
+ .stream(Spliterators.spliteratorUnknownSize(CollectionUtils.toIterator(results), Spliterator.ORDERED),
+ false)
+ .map((nameClassPair) -> unchecked(() -> mapper.apply(nameClassPair)))
+ .filter(Objects::nonNull)
+ .onClose(() -> closeContextAndNamingEnumeration(ctx, results));
}
/**
diff --git a/core/src/main/java/org/springframework/ldap/core/support/BaseLdapPathBeanPostProcessor.java b/core/src/main/java/org/springframework/ldap/core/support/BaseLdapPathBeanPostProcessor.java
index 5914883b..e99e034e 100644
--- a/core/src/main/java/org/springframework/ldap/core/support/BaseLdapPathBeanPostProcessor.java
+++ b/core/src/main/java/org/springframework/ldap/core/support/BaseLdapPathBeanPostProcessor.java
@@ -94,7 +94,7 @@ public class BaseLdapPathBeanPostProcessor implements BeanPostProcessor, Applica
}
Collection beans = this.applicationContext.getBeansOfType(BaseLdapPathSource.class)
- .values();
+ .values();
if (beans.isEmpty()) {
throw new NoSuchBeanDefinitionException("No BaseLdapPathSource implementation definition found");
}
diff --git a/core/src/main/java/org/springframework/ldap/core/support/DefaultIncrementalAttributesMapper.java b/core/src/main/java/org/springframework/ldap/core/support/DefaultIncrementalAttributesMapper.java
index 4464e575..422cdfa9 100644
--- a/core/src/main/java/org/springframework/ldap/core/support/DefaultIncrementalAttributesMapper.java
+++ b/core/src/main/java/org/springframework/ldap/core/support/DefaultIncrementalAttributesMapper.java
@@ -333,7 +333,7 @@ public class DefaultIncrementalAttributesMapper
*/
public static List
+ *
* @author Mattias Hellborg Arthursson
* @since 2.0
*/
diff --git a/core/src/main/java/org/springframework/ldap/odm/annotations/Id.java b/core/src/main/java/org/springframework/ldap/odm/annotations/Id.java
index 1a7daf0f..0fcdfff0 100755
--- a/core/src/main/java/org/springframework/ldap/odm/annotations/Id.java
+++ b/core/src/main/java/org/springframework/ldap/odm/annotations/Id.java
@@ -29,7 +29,6 @@ import java.lang.annotation.Target;
* annotated {@link Attribute}.
*
* @author Paul Harvey <paul.at.pauls-place.me.uk>
- *
* @see Attribute
* @see javax.naming.Name
*/
diff --git a/core/src/main/java/org/springframework/ldap/odm/annotations/Transient.java b/core/src/main/java/org/springframework/ldap/odm/annotations/Transient.java
index 8801dd6c..43aba6b9 100755
--- a/core/src/main/java/org/springframework/ldap/odm/annotations/Transient.java
+++ b/core/src/main/java/org/springframework/ldap/odm/annotations/Transient.java
@@ -26,7 +26,6 @@ import java.lang.annotation.Target;
* not be persisted to LDAP.
*
* @author Paul Harvey <paul@pauls-place.me.uk>
- *
* @see Entry
*/
@Target(ElementType.FIELD)
diff --git a/core/src/main/java/org/springframework/ldap/odm/core/impl/DefaultObjectDirectoryMapper.java b/core/src/main/java/org/springframework/ldap/odm/core/impl/DefaultObjectDirectoryMapper.java
index f3773b6d..f55b33b0 100644
--- a/core/src/main/java/org/springframework/ldap/odm/core/impl/DefaultObjectDirectoryMapper.java
+++ b/core/src/main/java/org/springframework/ldap/odm/core/impl/DefaultObjectDirectoryMapper.java
@@ -209,7 +209,7 @@ public class DefaultObjectDirectoryMapper implements ObjectDirectoryMapper {
// but only if this is a new entry.
int numOcs = metaData.getObjectClasses().size();
CaseIgnoreString[] metaDataObjectClasses = metaData.getObjectClasses()
- .toArray(new CaseIgnoreString[numOcs]);
+ .toArray(new CaseIgnoreString[numOcs]);
String[] stringOcs = new String[numOcs];
for (int ocIndex = 0; ocIndex < numOcs; ocIndex++) {
diff --git a/core/src/main/java/org/springframework/ldap/odm/core/impl/ObjectMetaData.java b/core/src/main/java/org/springframework/ldap/odm/core/impl/ObjectMetaData.java
index 2388f15a..f0092441 100755
--- a/core/src/main/java/org/springframework/ldap/odm/core/impl/ObjectMetaData.java
+++ b/core/src/main/java/org/springframework/ldap/odm/core/impl/ObjectMetaData.java
@@ -139,8 +139,8 @@ import org.springframework.util.StringUtils;
if (currentAttributeMetaData.isId()) {
if (this.idAttribute != null) {
// There can be only one id field
- throw new MetaDataException(String.format(
- "You man have only one field with the %1$s annotation in class %2$s", Id.class, clazz));
+ throw new MetaDataException(String
+ .format("You man have only one field with the %1$s annotation in class %2$s", Id.class, clazz));
}
this.idAttribute = currentAttributeMetaData;
}
diff --git a/core/src/main/java/org/springframework/ldap/pool/factory/DirContextPoolableObjectFactory.java b/core/src/main/java/org/springframework/ldap/pool/factory/DirContextPoolableObjectFactory.java
index 59c77ea4..4746dc67 100644
--- a/core/src/main/java/org/springframework/ldap/pool/factory/DirContextPoolableObjectFactory.java
+++ b/core/src/main/java/org/springframework/ldap/pool/factory/DirContextPoolableObjectFactory.java
@@ -152,7 +152,7 @@ class DirContextPoolableObjectFactory extends BaseKeyedPoolableObjectFactory {
if (this.logger.isDebugEnabled()) {
this.logger
- .debug("Created new " + DirContextType.READ_WRITE + " DirContext='" + readWriteContext + "'");
+ .debug("Created new " + DirContextType.READ_WRITE + " DirContext='" + readWriteContext + "'");
}
return makeFailureAwareProxy(readWriteContext);
diff --git a/core/src/main/java/org/springframework/ldap/pool2/factory/DirContextPooledObjectFactory.java b/core/src/main/java/org/springframework/ldap/pool2/factory/DirContextPooledObjectFactory.java
index d79bc1ef..092b3306 100644
--- a/core/src/main/java/org/springframework/ldap/pool2/factory/DirContextPooledObjectFactory.java
+++ b/core/src/main/java/org/springframework/ldap/pool2/factory/DirContextPooledObjectFactory.java
@@ -213,7 +213,7 @@ class DirContextPooledObjectFactory extends BaseKeyedPooledObjectFactory registrar.registerHints(this.hints, ClassUtils.getDefaultClassLoader()));
+ SpringFactoriesLoader.forResourceLocation("META-INF/spring/aot.factories")
+ .load(RuntimeHintsRegistrar.class)
+ .forEach((registrar) -> registrar.registerHints(this.hints, ClassUtils.getDefaultClassLoader()));
}
@Test
public void ldapCtxFactoryHasHints() {
- assertThat(RuntimeHintsPredicates.reflection().onType(TypeReference.of("com.sun.jndi.ldap.LdapCtxFactory"))
- .withMemberCategories(MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS)).accepts(this.hints);
+ assertThat(RuntimeHintsPredicates.reflection()
+ .onType(TypeReference.of("com.sun.jndi.ldap.LdapCtxFactory"))
+ .withMemberCategories(MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS)).accepts(this.hints);
}
@Test
public void abstractContextSourceHasHints() {
- assertThat(RuntimeHintsPredicates.reflection().onType(AbstractContextSource.class)
- .withMemberCategories(MemberCategory.INTROSPECT_DECLARED_METHODS, MemberCategory.DECLARED_FIELDS))
- .accepts(this.hints);
+ assertThat(RuntimeHintsPredicates.reflection()
+ .onType(AbstractContextSource.class)
+ .withMemberCategories(MemberCategory.INTROSPECT_DECLARED_METHODS, MemberCategory.DECLARED_FIELDS))
+ .accepts(this.hints);
}
@Test
public void defaultDirObjectFactoryHasHints() {
- assertThat(RuntimeHintsPredicates.reflection().onType(DefaultDirObjectFactory.class)
- .withMemberCategories(MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS)).accepts(this.hints);
+ assertThat(RuntimeHintsPredicates.reflection()
+ .onType(DefaultDirObjectFactory.class)
+ .withMemberCategories(MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS)).accepts(this.hints);
}
@Test
public void pagedResultsControlHasHints() {
- assertThat(RuntimeHintsPredicates.reflection().onType(PagedResultsControl.class)
- .withMemberCategories(MemberCategory.INVOKE_PUBLIC_METHODS, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS))
- .accepts(this.hints);
- assertThat(RuntimeHintsPredicates.reflection().onType(com.sun.jndi.ldap.ctl.PagedResultsControl.class)
- .withMemberCategories(MemberCategory.INVOKE_PUBLIC_METHODS, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS))
- .accepts(this.hints);
- assertThat(RuntimeHintsPredicates.reflection().onType(PagedResultsResponseControl.class)
- .withMemberCategories(MemberCategory.INVOKE_PUBLIC_METHODS, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS))
- .accepts(this.hints);
- assertThat(RuntimeHintsPredicates.reflection().onType(com.sun.jndi.ldap.ctl.PagedResultsResponseControl.class)
- .withMemberCategories(MemberCategory.INVOKE_PUBLIC_METHODS, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS))
- .accepts(this.hints);
+ assertThat(RuntimeHintsPredicates.reflection()
+ .onType(PagedResultsControl.class)
+ .withMemberCategories(MemberCategory.INVOKE_PUBLIC_METHODS, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS))
+ .accepts(this.hints);
+ assertThat(RuntimeHintsPredicates.reflection()
+ .onType(com.sun.jndi.ldap.ctl.PagedResultsControl.class)
+ .withMemberCategories(MemberCategory.INVOKE_PUBLIC_METHODS, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS))
+ .accepts(this.hints);
+ assertThat(RuntimeHintsPredicates.reflection()
+ .onType(PagedResultsResponseControl.class)
+ .withMemberCategories(MemberCategory.INVOKE_PUBLIC_METHODS, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS))
+ .accepts(this.hints);
+ assertThat(RuntimeHintsPredicates.reflection()
+ .onType(com.sun.jndi.ldap.ctl.PagedResultsResponseControl.class)
+ .withMemberCategories(MemberCategory.INVOKE_PUBLIC_METHODS, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS))
+ .accepts(this.hints);
}
@Test
public void sortControlHasHints() {
- assertThat(RuntimeHintsPredicates.reflection().onType(SortControl.class)
- .withMemberCategories(MemberCategory.INVOKE_PUBLIC_METHODS, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS))
- .accepts(this.hints);
- assertThat(RuntimeHintsPredicates.reflection().onType(com.sun.jndi.ldap.ctl.SortControl.class)
- .withMemberCategories(MemberCategory.INVOKE_PUBLIC_METHODS, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS))
- .accepts(this.hints);
- assertThat(RuntimeHintsPredicates.reflection().onType(SortResponseControl.class)
- .withMemberCategories(MemberCategory.INVOKE_PUBLIC_METHODS, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS))
- .accepts(this.hints);
- assertThat(RuntimeHintsPredicates.reflection().onType(com.sun.jndi.ldap.ctl.SortResponseControl.class)
- .withMemberCategories(MemberCategory.INVOKE_PUBLIC_METHODS, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS))
- .accepts(this.hints);
+ assertThat(RuntimeHintsPredicates.reflection()
+ .onType(SortControl.class)
+ .withMemberCategories(MemberCategory.INVOKE_PUBLIC_METHODS, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS))
+ .accepts(this.hints);
+ assertThat(RuntimeHintsPredicates.reflection()
+ .onType(com.sun.jndi.ldap.ctl.SortControl.class)
+ .withMemberCategories(MemberCategory.INVOKE_PUBLIC_METHODS, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS))
+ .accepts(this.hints);
+ assertThat(RuntimeHintsPredicates.reflection()
+ .onType(SortResponseControl.class)
+ .withMemberCategories(MemberCategory.INVOKE_PUBLIC_METHODS, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS))
+ .accepts(this.hints);
+ assertThat(RuntimeHintsPredicates.reflection()
+ .onType(com.sun.jndi.ldap.ctl.SortResponseControl.class)
+ .withMemberCategories(MemberCategory.INVOKE_PUBLIC_METHODS, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS))
+ .accepts(this.hints);
}
@Test
public void sslSocketFactoryHasHints() throws Exception {
assertThat(RuntimeHintsPredicates.reflection().onMethod(SSLSocketFactory.class.getDeclaredMethod("getDefault")))
- .accepts(this.hints);
+ .accepts(this.hints);
}
}
diff --git a/core/src/test/java/org/springframework/ldap/config/LdapTemplateNamespaceHandlerTests.java b/core/src/test/java/org/springframework/ldap/config/LdapTemplateNamespaceHandlerTests.java
index b72a0ea9..a645098d 100644
--- a/core/src/test/java/org/springframework/ldap/config/LdapTemplateNamespaceHandlerTests.java
+++ b/core/src/test/java/org/springframework/ldap/config/LdapTemplateNamespaceHandlerTests.java
@@ -73,7 +73,7 @@ public class LdapTemplateNamespaceHandlerTests {
assertThat("uid=admin").isEqualTo(getInternalState(contextSource, "userDn"));
assertThat("apassword").isEqualTo(getInternalState(contextSource, "password"));
assertThat(new String[] { "ldap://localhost:389" })
- .isEqualTo((Object[]) getInternalState(contextSource, "urls"));
+ .isEqualTo((Object[]) getInternalState(contextSource, "urls"));
assertThat(Boolean.FALSE).isEqualTo(getInternalState(contextSource, "pooled"));
assertThat(Boolean.FALSE).isEqualTo(getInternalState(contextSource, "anonymousReadOnly"));
assertThat((Object) getInternalState(contextSource, "referral")).isNull();
@@ -148,7 +148,7 @@ public class LdapTemplateNamespaceHandlerTests {
assertThat("uid=admin").isEqualTo(getInternalState(contextSource, "userDn"));
assertThat("apassword").isEqualTo(getInternalState(contextSource, "password"));
assertThat(new String[] { "ldap://localhost:389" })
- .isEqualTo((Object[]) getInternalState(contextSource, "urls"));
+ .isEqualTo((Object[]) getInternalState(contextSource, "urls"));
assertThat(Boolean.TRUE).isEqualTo(getInternalState(contextSource, "pooled"));
assertThat(Boolean.FALSE).isEqualTo(getInternalState(contextSource, "anonymousReadOnly"));
assertThat("follow").isEqualTo(getInternalState(contextSource, "referral"));
@@ -176,7 +176,7 @@ public class LdapTemplateNamespaceHandlerTests {
assertThat("uid=admin").isEqualTo(getInternalState(contextSource, "userDn"));
assertThat("apassword").isEqualTo(getInternalState(contextSource, "password"));
assertThat(new String[] { "ldap://localhost:389" })
- .isEqualTo((Object[]) getInternalState(contextSource, "urls"));
+ .isEqualTo((Object[]) getInternalState(contextSource, "urls"));
}
@@ -192,7 +192,7 @@ public class LdapTemplateNamespaceHandlerTests {
ContextSource contextSource = ((TransactionAwareContextSourceProxy) outerContextSource).getTarget();
assertThat(new String[] { "ldap://a.localhost:389", "ldap://b.localhost:389" })
- .isEqualTo(getInternalState(contextSource, "urls"));
+ .isEqualTo(getInternalState(contextSource, "urls"));
}
@@ -207,7 +207,7 @@ public class LdapTemplateNamespaceHandlerTests {
ContextSource contextSource = ((TransactionAwareContextSourceProxy) outerContextSource).getTarget();
assertThat(new String[] { "ldap://a.localhost:389", "ldap://b.localhost:389" })
- .isEqualTo(getInternalState(contextSource, "urls"));
+ .isEqualTo(getInternalState(contextSource, "urls"));
}
@@ -404,7 +404,7 @@ public class LdapTemplateNamespaceHandlerTests {
assertThat(objectPool.getMinIdlePerKey()).isEqualTo(0);
assertThat(objectPool.getBlockWhenExhausted()).isEqualTo(true);
assertThat(objectPool.getEvictionPolicyClassName())
- .isEqualTo(GenericKeyedObjectPoolConfig.DEFAULT_EVICTION_POLICY_CLASS_NAME);
+ .isEqualTo(GenericKeyedObjectPoolConfig.DEFAULT_EVICTION_POLICY_CLASS_NAME);
assertThat(objectPool.getFairness()).isEqualTo(false);
// ensures the pool is registered
@@ -445,7 +445,7 @@ public class LdapTemplateNamespaceHandlerTests {
assertThat(objectPool.getMinIdlePerKey()).isEqualTo(14);
assertThat(objectPool.getBlockWhenExhausted()).isEqualTo(true);
assertThat(objectPool.getEvictionPolicyClassName())
- .isEqualTo("org.springframework.ldap.pool2.DummyEvictionPolicy");
+ .isEqualTo("org.springframework.ldap.pool2.DummyEvictionPolicy");
assertThat(objectPool.getFairness()).isEqualTo(true);
assertThat(objectPool.getLifo()).isEqualTo(false);
diff --git a/core/src/test/java/org/springframework/ldap/control/RequestControlDirContextProcessorTests.java b/core/src/test/java/org/springframework/ldap/control/RequestControlDirContextProcessorTests.java
index f72bef39..d4c6a1b8 100644
--- a/core/src/test/java/org/springframework/ldap/control/RequestControlDirContextProcessorTests.java
+++ b/core/src/test/java/org/springframework/ldap/control/RequestControlDirContextProcessorTests.java
@@ -104,7 +104,7 @@ public class RequestControlDirContextProcessorTests {
this.tested.preProcess(this.ldapContextMock);
verify(this.ldapContextMock)
- .setRequestControls(new Control[] { this.requestControl2Mock, this.requestControlMock });
+ .setRequestControls(new Control[] { this.requestControl2Mock, this.requestControlMock });
}
@Test
diff --git a/core/src/test/java/org/springframework/ldap/core/CollectingNameClassPairCallbackHandlerTests.java b/core/src/test/java/org/springframework/ldap/core/CollectingNameClassPairCallbackHandlerTests.java
index 79f73d99..f999df23 100644
--- a/core/src/test/java/org/springframework/ldap/core/CollectingNameClassPairCallbackHandlerTests.java
+++ b/core/src/test/java/org/springframework/ldap/core/CollectingNameClassPairCallbackHandlerTests.java
@@ -41,7 +41,7 @@ public class CollectingNameClassPairCallbackHandlerTests {
this.tested = new CollectingNameClassPairCallbackHandler() {
public Object getObjectFromNameClassPair(NameClassPair nameClassPair) {
assertThat(nameClassPair)
- .isSameAs(CollectingNameClassPairCallbackHandlerTests.this.expectedNameClassPair);
+ .isSameAs(CollectingNameClassPairCallbackHandlerTests.this.expectedNameClassPair);
return CollectingNameClassPairCallbackHandlerTests.this.expectedResult;
}
};
diff --git a/core/src/test/java/org/springframework/ldap/core/DefaultLdapClientListTests.java b/core/src/test/java/org/springframework/ldap/core/DefaultLdapClientListTests.java
index 5b72ec0a..5d82e7e2 100644
--- a/core/src/test/java/org/springframework/ldap/core/DefaultLdapClientListTests.java
+++ b/core/src/test/java/org/springframework/ldap/core/DefaultLdapClientListTests.java
@@ -144,7 +144,7 @@ public class DefaultLdapClientListTests {
given(this.dirContextMock.list(this.nameMock)).willThrow(pre);
assertThatExceptionOfType(PartialResultException.class)
- .isThrownBy(() -> this.tested.list(NAME).toList(NameClassPair::getName));
+ .isThrownBy(() -> this.tested.list(NAME).toList(NameClassPair::getName));
verify(this.dirContextMock).close();
}
@@ -156,7 +156,7 @@ public class DefaultLdapClientListTests {
given(this.dirContextMock.list(this.nameMock)).willThrow(pre);
assertThatExceptionOfType(PartialResultException.class)
- .isThrownBy(() -> this.tested.list(NAME).toStream(NameClassPair::getName).collect(Collectors.toList()));
+ .isThrownBy(() -> this.tested.list(NAME).toStream(NameClassPair::getName).collect(Collectors.toList()));
verify(this.dirContextMock).close();
}
@@ -202,7 +202,7 @@ public class DefaultLdapClientListTests {
javax.naming.LimitExceededException ne = new javax.naming.LimitExceededException();
given(this.dirContextMock.list(this.nameMock)).willThrow(ne);
assertThatExceptionOfType(LimitExceededException.class)
- .isThrownBy(() -> this.tested.list(NAME).toList(NameClassPair::getName));
+ .isThrownBy(() -> this.tested.list(NAME).toList(NameClassPair::getName));
verify(this.dirContextMock).close();
}
@@ -212,7 +212,7 @@ public class DefaultLdapClientListTests {
javax.naming.LimitExceededException ne = new javax.naming.LimitExceededException();
given(this.dirContextMock.list(this.nameMock)).willThrow(ne);
assertThatExceptionOfType(LimitExceededException.class)
- .isThrownBy(() -> this.tested.list(NAME).toStream(NameClassPair::getName).collect(Collectors.toList()));
+ .isThrownBy(() -> this.tested.list(NAME).toStream(NameClassPair::getName).collect(Collectors.toList()));
verify(this.dirContextMock).close();
}
diff --git a/core/src/test/java/org/springframework/ldap/core/DefaultLdapClientLookupTests.java b/core/src/test/java/org/springframework/ldap/core/DefaultLdapClientLookupTests.java
index 1e323a7c..5108dff5 100644
--- a/core/src/test/java/org/springframework/ldap/core/DefaultLdapClientLookupTests.java
+++ b/core/src/test/java/org/springframework/ldap/core/DefaultLdapClientLookupTests.java
@@ -101,7 +101,7 @@ public class DefaultLdapClientLookupTests {
whenSearching(this.name).willThrow(ne);
assertThatExceptionOfType(NameNotFoundException.class).describedAs("NameNotFoundException expected")
- .isThrownBy(() -> this.tested.search().name(this.name).toEntry());
+ .isThrownBy(() -> this.tested.search().name(this.name).toEntry());
verify(this.dirContextMock).close();
}
@@ -142,7 +142,7 @@ public class DefaultLdapClientLookupTests {
AttributesMapper> mapper = (attributes) -> attributes;
assertThatExceptionOfType(NameNotFoundException.class).describedAs("NameNotFoundException expected")
- .isThrownBy(() -> this.tested.search().name(this.name).toObject(mapper));
+ .isThrownBy(() -> this.tested.search().name(this.name).toObject(mapper));
verify(this.dirContextMock).close();
}
@@ -185,7 +185,7 @@ public class DefaultLdapClientLookupTests {
ContextMapper> mapper = (ctx) -> ctx;
assertThatExceptionOfType(NameNotFoundException.class).describedAs("NameNotFoundException expected")
- .isThrownBy(() -> this.tested.search().name(this.name).toObject(mapper));
+ .isThrownBy(() -> this.tested.search().name(this.name).toObject(mapper));
verify(this.dirContextMock).close();
}
diff --git a/core/src/test/java/org/springframework/ldap/core/DefaultLdapClientTests.java b/core/src/test/java/org/springframework/ldap/core/DefaultLdapClientTests.java
index 2b23e940..8e572b2e 100644
--- a/core/src/test/java/org/springframework/ldap/core/DefaultLdapClientTests.java
+++ b/core/src/test/java/org/springframework/ldap/core/DefaultLdapClientTests.java
@@ -146,9 +146,9 @@ public class DefaultLdapClientTests {
singleSearchResult(searchControlsOneLevel(), searchResult);
- this.tested.search().query(
- (builder) -> builder.base(this.nameMock).searchScope(SearchScope.ONELEVEL).filter("(ou=somevalue)"))
- .toObject(this.contextMapperMock);
+ this.tested.search()
+ .query((builder) -> builder.base(this.nameMock).searchScope(SearchScope.ONELEVEL).filter("(ou=somevalue)"))
+ .toObject(this.contextMapperMock);
verify(this.contextMapperMock).mapFromContext(any());
verify(this.dirContextMock).close();
@@ -164,8 +164,11 @@ public class DefaultLdapClientTests {
singleSearchResultWithStringBase(controls, searchResult);
- this.tested.search().query((builder) -> builder.base(DEFAULT_BASE.toString()).searchScope(SearchScope.ONELEVEL)
- .filter("(ou=somevalue)")).toObject(this.contextMapperMock);
+ this.tested.search()
+ .query((builder) -> builder.base(DEFAULT_BASE.toString())
+ .searchScope(SearchScope.ONELEVEL)
+ .filter("(ou=somevalue)"))
+ .toObject(this.contextMapperMock);
verify(this.contextMapperMock).mapFromContext(any());
verify(this.dirContextMock).close();
@@ -182,9 +185,9 @@ public class DefaultLdapClientTests {
singleSearchResult(controls, searchResult);
- this.tested.search().query(
- (builder) -> builder.base(this.nameMock).searchScope(SearchScope.SUBTREE).filter("(ou=somevalue)"))
- .toObject(this.attributesMapperMock);
+ this.tested.search()
+ .query((builder) -> builder.base(this.nameMock).searchScope(SearchScope.SUBTREE).filter("(ou=somevalue)"))
+ .toObject(this.attributesMapperMock);
verify(this.attributesMapperMock).mapFromAttributes(any());
verify(this.dirContextMock).close();
@@ -201,8 +204,11 @@ public class DefaultLdapClientTests {
singleSearchResultWithStringBase(controls, searchResult);
- this.tested.search().query((builder) -> builder.base(DEFAULT_BASE.toString()).searchScope(SearchScope.SUBTREE)
- .filter("(ou=somevalue)")).toObject(this.attributesMapperMock);
+ this.tested.search()
+ .query((builder) -> builder.base(DEFAULT_BASE.toString())
+ .searchScope(SearchScope.SUBTREE)
+ .filter("(ou=somevalue)"))
+ .toObject(this.attributesMapperMock);
verify(this.attributesMapperMock).mapFromAttributes(any());
verify(this.dirContextMock).close();
@@ -217,12 +223,15 @@ public class DefaultLdapClientTests {
javax.naming.NameNotFoundException ne = new javax.naming.NameNotFoundException("some text");
given(this.dirContextMock.search(eq(this.nameMock), eq("(ou=somevalue)"),
- argThat(new SearchControlsMatcher(controls)))).willThrow(ne);
+ argThat(new SearchControlsMatcher(controls))))
+ .willThrow(ne);
try {
- this.tested.search().query(
- (builder) -> builder.base(this.nameMock).searchScope(SearchScope.SUBTREE).filter("(ou=somevalue)"))
- .toObject(this.attributesMapperMock);
+ this.tested.search()
+ .query((builder) -> builder.base(this.nameMock)
+ .searchScope(SearchScope.SUBTREE)
+ .filter("(ou=somevalue)"))
+ .toObject(this.attributesMapperMock);
fail("NameNotFoundException expected");
}
catch (NameNotFoundException expected) {
@@ -240,11 +249,13 @@ public class DefaultLdapClientTests {
javax.naming.LimitExceededException ne = new javax.naming.LimitExceededException();
given(this.dirContextMock.search(eq(this.nameMock), eq("(ou=somevalue)"),
- argThat(new SearchControlsMatcher(controls)))).willThrow(ne);
+ argThat(new SearchControlsMatcher(controls))))
+ .willThrow(ne);
try {
- this.tested.search().query((builder) -> builder.base(this.nameMock).filter("(ou=somevalue)"))
- .toObject(this.attributesMapperMock);
+ this.tested.search()
+ .query((builder) -> builder.base(this.nameMock).filter("(ou=somevalue)"))
+ .toObject(this.attributesMapperMock);
fail("LimitExceededException expected");
}
catch (LimitExceededException expected) {
@@ -258,8 +269,10 @@ public class DefaultLdapClientTests {
public void verifyThatDefaultSearchControlParametersAreAutomaticallyAppliedInSearch() throws Exception {
Supplier defaults = mock(Supplier.class);
given(defaults.get()).willReturn(new SearchControls());
- LdapClient tested = LdapClient.builder().contextSource(this.contextSourceMock).defaultSearchControls(defaults)
- .build();
+ LdapClient tested = LdapClient.builder()
+ .contextSource(this.contextSourceMock)
+ .defaultSearchControls(defaults)
+ .build();
expectGetReadOnlyContext();
@@ -395,8 +408,11 @@ public class DefaultLdapClientTests {
Object expectedObject = new Object();
BasicAttributes expectedAttributes = new BasicAttributes();
- this.tested.bind(this.nameMock).object(expectedObject).attributes(expectedAttributes).replaceExisting(true)
- .execute();
+ this.tested.bind(this.nameMock)
+ .object(expectedObject)
+ .attributes(expectedAttributes)
+ .replaceExisting(true)
+ .execute();
verify(this.dirContextMock).rebind(this.nameMock, expectedObject, expectedAttributes);
verify(this.dirContextMock).close();
@@ -409,8 +425,11 @@ public class DefaultLdapClientTests {
Object expectedObject = new Object();
BasicAttributes expectedAttributes = new BasicAttributes();
- this.tested.bind(DEFAULT_BASE.toString()).object(expectedObject).attributes(expectedAttributes)
- .replaceExisting(true).execute();
+ this.tested.bind(DEFAULT_BASE.toString())
+ .object(expectedObject)
+ .attributes(expectedAttributes)
+ .replaceExisting(true)
+ .execute();
verify(this.dirContextMock).rebind(DEFAULT_BASE, expectedObject, expectedAttributes);
verify(this.dirContextMock).close();
@@ -516,13 +535,15 @@ public class DefaultLdapClientTests {
@Test
public void testSearch_PartialResult_IgnoreSet() throws Exception {
- LdapClient tested = LdapClient.builder().contextSource(this.contextSourceMock)
- .ignorePartialResultException(true).build();
+ LdapClient tested = LdapClient.builder()
+ .contextSource(this.contextSourceMock)
+ .ignorePartialResultException(true)
+ .build();
expectGetReadOnlyContext();
given(this.dirContextMock.search(eq(this.nameMock), anyString(), any()))
- .willThrow(javax.naming.PartialResultException.class);
+ .willThrow(javax.naming.PartialResultException.class);
tested.search().name(this.nameMock).toEntryStream();
@@ -542,7 +563,7 @@ public class DefaultLdapClientTests {
singleSearchResult(searchControlsRecursive(), searchResult);
given(this.contextSourceMock.getContext("cn=john doe,dc=jayway,dc=se", "password"))
- .willReturn(this.authenticatedContextMock);
+ .willReturn(this.authenticatedContextMock);
given(entryContextMapper.mapWithContext(any(), any())).willReturn(new Object());
LdapQuery query = LdapQueryBuilder.query().base(this.nameMock).filter("(ou=somevalue)");
@@ -584,7 +605,7 @@ public class DefaultLdapClientTests {
LdapQuery query = LdapQueryBuilder.query().base(this.nameMock).filter("(ou=somevalue)");
assertThatExceptionOfType(EmptyResultDataAccessException.class)
- .isThrownBy(() -> this.tested.authenticate().query(query).password("password").execute());
+ .isThrownBy(() -> this.tested.authenticate().query(query).password("password").execute());
verify(this.dirContextMock).close();
}
@@ -598,7 +619,9 @@ public class DefaultLdapClientTests {
LdapQuery query = LdapQueryBuilder.query().base(this.nameMock).filter("(ou=somevalue)");
assertThatExceptionOfType(EmptyResultDataAccessException.class).isThrownBy(() -> this.tested.authenticate()
- .query(query).password("password").execute((ctx, entry) -> new Object()));
+ .query(query)
+ .password("password")
+ .execute((ctx, entry) -> new Object()));
verify(this.dirContextMock).close();
}
@@ -614,17 +637,18 @@ public class DefaultLdapClientTests {
singleSearchResult(searchControlsRecursive(), searchResult);
given(this.contextSourceMock.getContext("cn=john doe,dc=jayway,dc=se", "password"))
- .willThrow(new UncategorizedLdapException("Authentication failed"));
+ .willThrow(new UncategorizedLdapException("Authentication failed"));
LdapQuery query = LdapQueryBuilder.query().base(this.nameMock).filter("(ou=somevalue)");
assertThatExceptionOfType(UncategorizedLdapException.class)
- .isThrownBy(() -> this.tested.authenticate().query(query).password("password").execute());
+ .isThrownBy(() -> this.tested.authenticate().query(query).password("password").execute());
verify(this.dirContextMock).close();
}
private void noSearchResults(SearchControls controls) throws Exception {
given(this.dirContextMock.search(eq(this.nameMock), eq("(ou=somevalue)"),
- argThat(new SearchControlsMatcher(controls)))).willReturn(this.namingEnumerationMock);
+ argThat(new SearchControlsMatcher(controls))))
+ .willReturn(this.namingEnumerationMock);
given(this.namingEnumerationMock.hasMore()).willReturn(false);
}
@@ -635,7 +659,8 @@ public class DefaultLdapClientTests {
private void setupSearchResults(SearchControls controls, SearchResult... searchResults) throws Exception {
given(this.dirContextMock.search(eq(this.nameMock), eq("(ou=somevalue)"),
- argThat(new SearchControlsMatcher(controls)))).willReturn(this.namingEnumerationMock);
+ argThat(new SearchControlsMatcher(controls))))
+ .willReturn(this.namingEnumerationMock);
if (searchResults.length == 1) {
given(this.namingEnumerationMock.hasMore()).willReturn(true, false);
@@ -652,7 +677,8 @@ public class DefaultLdapClientTests {
private void singleSearchResultWithStringBase(SearchControls controls, SearchResult searchResult) throws Exception {
given(this.dirContextMock.search(eq(DEFAULT_BASE), eq("(ou=somevalue)"),
- argThat(new SearchControlsMatcher(controls)))).willReturn(this.namingEnumerationMock);
+ argThat(new SearchControlsMatcher(controls))))
+ .willReturn(this.namingEnumerationMock);
given(this.namingEnumerationMock.hasMore()).willReturn(true, false);
given(this.namingEnumerationMock.next()).willReturn(searchResult);
diff --git a/core/src/test/java/org/springframework/ldap/core/LdapTemplateTests.java b/core/src/test/java/org/springframework/ldap/core/LdapTemplateTests.java
index c77cece0..1f9eee7f 100644
--- a/core/src/test/java/org/springframework/ldap/core/LdapTemplateTests.java
+++ b/core/src/test/java/org/springframework/ldap/core/LdapTemplateTests.java
@@ -217,7 +217,8 @@ public class LdapTemplateTests {
javax.naming.NameNotFoundException ne = new javax.naming.NameNotFoundException("some text");
given(this.dirContextMock.search(eq(this.nameMock), eq("(ou=somevalue)"),
- argThat(new SearchControlsMatcher(controls)))).willThrow(ne);
+ argThat(new SearchControlsMatcher(controls))))
+ .willThrow(ne);
try {
this.tested.search(this.nameMock, "(ou=somevalue)", this.handlerMock);
@@ -238,7 +239,8 @@ public class LdapTemplateTests {
javax.naming.LimitExceededException ne = new javax.naming.LimitExceededException();
given(this.dirContextMock.search(eq(this.nameMock), eq("(ou=somevalue)"),
- argThat(new SearchControlsMatcher(controls)))).willThrow(ne);
+ argThat(new SearchControlsMatcher(controls))))
+ .willThrow(ne);
try {
this.tested.search(this.nameMock, "(ou=somevalue)", this.handlerMock);
@@ -617,7 +619,7 @@ public class LdapTemplateTests {
given(this.contextSourceMock.getReadOnlyContext()).willReturn(this.dirContextMock);
given(this.odmMock.filterFor(expectedClass, new EqualsFilter("ou", "somevalue")))
- .willReturn(new EqualsFilter("ou", "somevalue"));
+ .willReturn(new EqualsFilter("ou", "somevalue"));
DirContextAdapter expectedObject = new DirContextAdapter();
SearchResult searchResult = new SearchResult("", expectedObject, new BasicAttributes());
@@ -640,7 +642,7 @@ public class LdapTemplateTests {
given(this.contextSourceMock.getReadOnlyContext()).willReturn(this.dirContextMock);
given(this.odmMock.filterFor(expectedClass, new EqualsFilter("ou", "somevalue")))
- .willReturn(new EqualsFilter("ou", "somevalue"));
+ .willReturn(new EqualsFilter("ou", "somevalue"));
noSearchResults(searchControlsRecursive());
@@ -663,7 +665,7 @@ public class LdapTemplateTests {
given(this.contextSourceMock.getReadOnlyContext()).willReturn(this.dirContextMock);
given(this.odmMock.filterFor(expectedClass, new EqualsFilter("ou", "somevalue")))
- .willReturn(new EqualsFilter("ou", "somevalue"));
+ .willReturn(new EqualsFilter("ou", "somevalue"));
DirContextAdapter expectedObject = new DirContextAdapter();
SearchResult searchResult = new SearchResult("", expectedObject, new BasicAttributes());
@@ -1508,7 +1510,7 @@ public class LdapTemplateTests {
expectGetReadOnlyContext();
given(this.searchExecutorMock.executeSearch(this.dirContextMock))
- .willThrow(new javax.naming.NameNotFoundException());
+ .willThrow(new javax.naming.NameNotFoundException());
try {
this.tested.search(this.searchExecutorMock, this.handlerMock);
@@ -1548,7 +1550,7 @@ public class LdapTemplateTests {
expectGetReadOnlyContext();
given(this.searchExecutorMock.executeSearch(this.dirContextMock))
- .willThrow(new javax.naming.PartialResultException());
+ .willThrow(new javax.naming.PartialResultException());
this.tested.search(this.searchExecutorMock, this.handlerMock, this.dirContextProcessorMock);
@@ -1679,7 +1681,8 @@ public class LdapTemplateTests {
SearchResult searchResult = new SearchResult("", expectedObject, new BasicAttributes());
given(this.dirContextMock.search(eq(this.nameMock), eq("(ou=somevalue)"),
- argThat(new SearchControlsMatcher(controls)))).willReturn(this.namingEnumerationMock);
+ argThat(new SearchControlsMatcher(controls))))
+ .willReturn(this.namingEnumerationMock);
given(this.namingEnumerationMock.hasMore()).willReturn(true, true, false);
given(this.namingEnumerationMock.next()).willReturn(searchResult, searchResult);
@@ -1728,7 +1731,7 @@ public class LdapTemplateTests {
singleSearchResult(searchControlsRecursive(), searchResult);
given(this.contextSourceMock.getContext("cn=john doe,dc=jayway,dc=se", "password"))
- .willReturn(this.authenticatedContextMock);
+ .willReturn(this.authenticatedContextMock);
this.entryContextCallbackMock.executeWithContext(this.authenticatedContextMock, new LdapEntryIdentification(
LdapUtils.newLdapName("cn=john doe,dc=jayway,dc=se"), LdapUtils.newLdapName("cn=john doe")));
@@ -1784,7 +1787,7 @@ public class LdapTemplateTests {
given(this.contextSourceMock.getReadOnlyContext()).willReturn(this.dirContextMock);
given(this.dirContextMock.search(any(Name.class), any(String.class), any(SearchControls.class)))
- .willReturn(this.namingEnumerationMock);
+ .willReturn(this.namingEnumerationMock);
given(this.namingEnumerationMock.hasMore()).willReturn(false);
@@ -1804,7 +1807,7 @@ public class LdapTemplateTests {
given(this.contextSourceMock.getReadOnlyContext()).willReturn(this.dirContextMock);
given(this.dirContextMock.search(any(Name.class), any(String.class), any(SearchControls.class)))
- .willReturn(this.namingEnumerationMock);
+ .willReturn(this.namingEnumerationMock);
given(this.namingEnumerationMock.hasMore()).willReturn(false);
@@ -1828,7 +1831,7 @@ public class LdapTemplateTests {
singleSearchResult(searchControlsRecursive(), searchResult);
given(this.contextSourceMock.getContext("cn=john doe,dc=jayway,dc=se", "password"))
- .willThrow(new UncategorizedLdapException("Authentication failed"));
+ .willThrow(new UncategorizedLdapException("Authentication failed"));
boolean result = this.tested.authenticate(this.nameMock, "(ou=somevalue)", "password",
this.entryContextCallbackMock);
@@ -1849,10 +1852,10 @@ public class LdapTemplateTests {
singleSearchResult(searchControlsRecursive(), searchResult);
given(this.contextSourceMock.getContext("cn=john doe,dc=jayway,dc=se", "password"))
- .willReturn(this.authenticatedContextMock);
+ .willReturn(this.authenticatedContextMock);
willThrow(new UncategorizedLdapException("Authentication failed")).given(this.entryContextCallbackMock)
- .executeWithContext(this.authenticatedContextMock, new LdapEntryIdentification(
- LdapUtils.newLdapName("cn=john doe,dc=jayway,dc=se"), LdapUtils.newLdapName("cn=john doe")));
+ .executeWithContext(this.authenticatedContextMock, new LdapEntryIdentification(
+ LdapUtils.newLdapName("cn=john doe,dc=jayway,dc=se"), LdapUtils.newLdapName("cn=john doe")));
boolean result = this.tested.authenticate(this.nameMock, "(ou=somevalue)", "password",
this.entryContextCallbackMock);
@@ -1865,7 +1868,8 @@ public class LdapTemplateTests {
private void noSearchResults(SearchControls controls) throws Exception {
given(this.dirContextMock.search(eq(this.nameMock), eq("(ou=somevalue)"),
- argThat(new SearchControlsMatcher(controls)))).willReturn(this.namingEnumerationMock);
+ argThat(new SearchControlsMatcher(controls))))
+ .willReturn(this.namingEnumerationMock);
given(this.namingEnumerationMock.hasMore()).willReturn(false);
}
@@ -1876,7 +1880,8 @@ public class LdapTemplateTests {
private void setupSearchResults(SearchControls controls, SearchResult... searchResults) throws Exception {
given(this.dirContextMock.search(eq(this.nameMock), eq("(ou=somevalue)"),
- argThat(new SearchControlsMatcher(controls)))).willReturn(this.namingEnumerationMock);
+ argThat(new SearchControlsMatcher(controls))))
+ .willReturn(this.namingEnumerationMock);
if (searchResults.length == 1) {
given(this.namingEnumerationMock.hasMore()).willReturn(true, false);
@@ -1893,7 +1898,8 @@ public class LdapTemplateTests {
private void singleSearchResultWithStringBase(SearchControls controls, SearchResult searchResult) throws Exception {
given(this.dirContextMock.search(eq(DEFAULT_BASE_STRING), eq("(ou=somevalue)"),
- argThat(new SearchControlsMatcher(controls)))).willReturn(this.namingEnumerationMock);
+ argThat(new SearchControlsMatcher(controls))))
+ .willReturn(this.namingEnumerationMock);
given(this.namingEnumerationMock.hasMore()).willReturn(true, false);
given(this.namingEnumerationMock.next()).willReturn(searchResult);
diff --git a/core/src/test/java/org/springframework/ldap/core/support/BaseLdapPathBeanPostProcessorTests.java b/core/src/test/java/org/springframework/ldap/core/support/BaseLdapPathBeanPostProcessorTests.java
index c9d2c497..6ffc42b9 100644
--- a/core/src/test/java/org/springframework/ldap/core/support/BaseLdapPathBeanPostProcessorTests.java
+++ b/core/src/test/java/org/springframework/ldap/core/support/BaseLdapPathBeanPostProcessorTests.java
@@ -123,7 +123,7 @@ public class BaseLdapPathBeanPostProcessorTests {
@Test
public void testGetAbstractContextSourceFromApplicationContext() throws Exception {
given(this.applicationContextMock.getBeanNamesForType(BaseLdapPathSource.class))
- .willReturn(new String[] { "contextSource" });
+ .willReturn(new String[] { "contextSource" });
final LdapContextSource expectedContextSource = new LdapContextSource();
HashMap expectedBeans = new HashMap() {
diff --git a/core/src/test/java/org/springframework/ldap/core/support/LdapContextSourceTests.java b/core/src/test/java/org/springframework/ldap/core/support/LdapContextSourceTests.java
index dc17f781..51382623 100644
--- a/core/src/test/java/org/springframework/ldap/core/support/LdapContextSourceTests.java
+++ b/core/src/test/java/org/springframework/ldap/core/support/LdapContextSourceTests.java
@@ -73,7 +73,7 @@ public class LdapContextSourceTests {
// check that base was added to environment
assertThat(env.get(DefaultDirObjectFactory.JNDI_ENV_BASE_PATH_KEY))
- .isEqualTo(LdapUtils.newLdapName("dc=some example,dc=se"));
+ .isEqualTo(LdapUtils.newLdapName("dc=some example,dc=se"));
// Verify that changing values does not change the environment values.
this.tested.setBase("dc=other,dc=se");
@@ -87,7 +87,7 @@ public class LdapContextSourceTests {
assertThat(env.get(Context.SECURITY_CREDENTIALS)).isNull();
assertThat(env.get(DefaultDirObjectFactory.JNDI_ENV_BASE_PATH_KEY))
- .isEqualTo(LdapUtils.newLdapName("dc=some example,dc=se"));
+ .isEqualTo(LdapUtils.newLdapName("dc=some example,dc=se"));
}
@Test
@@ -155,7 +155,7 @@ public class LdapContextSourceTests {
// check that base was added to environment
assertThat(env.get(DefaultDirObjectFactory.JNDI_ENV_BASE_PATH_KEY))
- .isEqualTo(LdapUtils.newLdapName("dc=example,dc=se"));
+ .isEqualTo(LdapUtils.newLdapName("dc=example,dc=se"));
}
@Test
diff --git a/core/src/test/java/org/springframework/ldap/filter/AndFilterTests.java b/core/src/test/java/org/springframework/ldap/filter/AndFilterTests.java
index 2997e839..357a485b 100644
--- a/core/src/test/java/org/springframework/ldap/filter/AndFilterTests.java
+++ b/core/src/test/java/org/springframework/ldap/filter/AndFilterTests.java
@@ -49,8 +49,9 @@ public class AndFilterTests {
@Test
public void testThree() {
- AndFilter aq = new AndFilter().and(new EqualsFilter("a", "b")).and(new EqualsFilter("c", "d"))
- .and(new EqualsFilter("e", "f"));
+ AndFilter aq = new AndFilter().and(new EqualsFilter("a", "b"))
+ .and(new EqualsFilter("c", "d"))
+ .and(new EqualsFilter("e", "f"));
assertThat(aq.encode()).isEqualTo("(&(a=b)(c=d)(e=f))");
}
diff --git a/core/src/test/java/org/springframework/ldap/filter/OrFilterTests.java b/core/src/test/java/org/springframework/ldap/filter/OrFilterTests.java
index 35eb145a..c5b84421 100644
--- a/core/src/test/java/org/springframework/ldap/filter/OrFilterTests.java
+++ b/core/src/test/java/org/springframework/ldap/filter/OrFilterTests.java
@@ -50,8 +50,9 @@ public class OrFilterTests {
@Test
public void testThree() {
- OrFilter of = new OrFilter().or(new EqualsFilter("a", "b")).or(new EqualsFilter("c", "d"))
- .or(new EqualsFilter("e", "f"));
+ OrFilter of = new OrFilter().or(new EqualsFilter("a", "b"))
+ .or(new EqualsFilter("c", "d"))
+ .or(new EqualsFilter("e", "f"));
assertThat(of.encode()).isEqualTo("(|(a=b)(c=d)(e=f))");
}
diff --git a/core/src/test/java/org/springframework/ldap/odm/core/impl/DefaultObjectDirectoryMapperTests.java b/core/src/test/java/org/springframework/ldap/odm/core/impl/DefaultObjectDirectoryMapperTests.java
index 63c58f1e..79a31a90 100644
--- a/core/src/test/java/org/springframework/ldap/odm/core/impl/DefaultObjectDirectoryMapperTests.java
+++ b/core/src/test/java/org/springframework/ldap/odm/core/impl/DefaultObjectDirectoryMapperTests.java
@@ -68,9 +68,16 @@ public class DefaultObjectDirectoryMapperTests {
DefaultObjectDirectoryMapper.EntityData entityData = this.tested.getMetaDataMap().get(UnitTestPerson.class);
assertThat(entityData).isNotNull();
- assertThat(entityData.ocFilter).isEqualTo(LdapQueryBuilder.query().where("objectclass").is("inetOrgPerson")
- .and("objectclass").is("organizationalPerson").and("objectclass").is("person").and("objectclass")
- .is("top").filter());
+ assertThat(entityData.ocFilter).isEqualTo(LdapQueryBuilder.query()
+ .where("objectclass")
+ .is("inetOrgPerson")
+ .and("objectclass")
+ .is("organizationalPerson")
+ .and("objectclass")
+ .is("person")
+ .and("objectclass")
+ .is("top")
+ .filter());
assertThat(entityData.metaData).hasSize(8);
diff --git a/core/src/test/java/org/springframework/ldap/pool/DelegatingContextTests.java b/core/src/test/java/org/springframework/ldap/pool/DelegatingContextTests.java
index 8a682355..ff22a6f0 100644
--- a/core/src/test/java/org/springframework/ldap/pool/DelegatingContextTests.java
+++ b/core/src/test/java/org/springframework/ldap/pool/DelegatingContextTests.java
@@ -422,7 +422,7 @@ public class DelegatingContextTests extends AbstractPoolTestCase {
@Test
public void testPoolExceptionOnClose() throws Exception {
willThrow(new Exception("Fake Pool returnObject Exception")).given(keyedObjectPoolMock)
- .returnObject(DirContextType.READ_ONLY, contextMock);
+ .returnObject(DirContextType.READ_ONLY, contextMock);
final DelegatingContext delegatingContext = new DelegatingContext(keyedObjectPoolMock, contextMock,
DirContextType.READ_ONLY);
diff --git a/core/src/test/java/org/springframework/ldap/pool/factory/DirContextPoolableObjectFactoryTests.java b/core/src/test/java/org/springframework/ldap/pool/factory/DirContextPoolableObjectFactoryTests.java
index 62f02225..6ebc9474 100644
--- a/core/src/test/java/org/springframework/ldap/pool/factory/DirContextPoolableObjectFactoryTests.java
+++ b/core/src/test/java/org/springframework/ldap/pool/factory/DirContextPoolableObjectFactoryTests.java
@@ -185,7 +185,7 @@ public class DirContextPoolableObjectFactoryTests extends AbstractPoolTestCase {
DirContextValidator secondDirContextValidatorMock = mock(DirContextValidator.class);
given(secondDirContextValidatorMock.validateDirContext(DirContextType.READ_ONLY, dirContextMock))
- .willThrow(new RuntimeException("Failed to validate"));
+ .willThrow(new RuntimeException("Failed to validate"));
objectFactory.setDirContextValidator(secondDirContextValidatorMock);
final boolean valid2 = objectFactory.validateObject(DirContextType.READ_ONLY, dirContextMock);
diff --git a/core/src/test/java/org/springframework/ldap/pool/validation/DefaultDirContextValidatorTests.java b/core/src/test/java/org/springframework/ldap/pool/validation/DefaultDirContextValidatorTests.java
index 452b6ee4..02979b08 100644
--- a/core/src/test/java/org/springframework/ldap/pool/validation/DefaultDirContextValidatorTests.java
+++ b/core/src/test/java/org/springframework/ldap/pool/validation/DefaultDirContextValidatorTests.java
@@ -52,7 +52,7 @@ public class DefaultDirContextValidatorTests {
public void testSearchScopeOneLevelScopeSetInConstructorIsUsed() throws Exception {
DefaultDirContextValidator tested = new DefaultDirContextValidator(SearchControls.ONELEVEL_SCOPE);
assertThat(tested.getSearchControls().getSearchScope()).as("ONELEVEL_SCOPE, ")
- .isEqualTo(SearchControls.ONELEVEL_SCOPE);
+ .isEqualTo(SearchControls.ONELEVEL_SCOPE);
}
// LDAP-189
@@ -60,7 +60,7 @@ public class DefaultDirContextValidatorTests {
public void testSearchScopeSubTreeScopeSetInConstructorIsUsed() throws Exception {
DefaultDirContextValidator tested = new DefaultDirContextValidator(SearchControls.SUBTREE_SCOPE);
assertThat(tested.getSearchControls().getSearchScope()).as("SUBTREE_SCOPE, ")
- .isEqualTo(SearchControls.SUBTREE_SCOPE);
+ .isEqualTo(SearchControls.SUBTREE_SCOPE);
}
// LDAP-189
@@ -68,7 +68,7 @@ public class DefaultDirContextValidatorTests {
public void testSearchScopeObjectScopeSetInConstructorIsUsed() throws Exception {
DefaultDirContextValidator tested = new DefaultDirContextValidator(SearchControls.OBJECT_SCOPE);
assertThat(tested.getSearchControls().getSearchScope()).as("OBJECT_SCOPE, ")
- .isEqualTo(SearchControls.OBJECT_SCOPE);
+ .isEqualTo(SearchControls.OBJECT_SCOPE);
}
@Test
@@ -164,7 +164,7 @@ public class DefaultDirContextValidatorTests {
final SearchControls searchControls = dirContextValidator.getSearchControls();
given(this.dirContextMock.search(baseName, filter, searchControls))
- .willThrow(new NamingException("Failed to search"));
+ .willThrow(new NamingException("Failed to search"));
final boolean valid = dirContextValidator.validateDirContext(DirContextType.READ_ONLY, this.dirContextMock);
diff --git a/core/src/test/java/org/springframework/ldap/pool2/DelegatingContextTests.java b/core/src/test/java/org/springframework/ldap/pool2/DelegatingContextTests.java
index b63d7c9b..3833422c 100644
--- a/core/src/test/java/org/springframework/ldap/pool2/DelegatingContextTests.java
+++ b/core/src/test/java/org/springframework/ldap/pool2/DelegatingContextTests.java
@@ -422,7 +422,7 @@ public class DelegatingContextTests extends AbstractPoolTestCase {
@Test
public void testPoolExceptionOnClose() throws Exception {
willThrow(new Exception("Fake Pool returnObject Exception")).given(keyedObjectPoolMock)
- .returnObject(DirContextType.READ_ONLY, contextMock);
+ .returnObject(DirContextType.READ_ONLY, contextMock);
final DelegatingContext delegatingContext = new DelegatingContext(keyedObjectPoolMock, contextMock,
DirContextType.READ_ONLY);
diff --git a/core/src/test/java/org/springframework/ldap/pool2/factory/DirContextPooledObjectFactoryTests.java b/core/src/test/java/org/springframework/ldap/pool2/factory/DirContextPooledObjectFactoryTests.java
index e029fdda..072a7a14 100644
--- a/core/src/test/java/org/springframework/ldap/pool2/factory/DirContextPooledObjectFactoryTests.java
+++ b/core/src/test/java/org/springframework/ldap/pool2/factory/DirContextPooledObjectFactoryTests.java
@@ -192,7 +192,7 @@ public class DirContextPooledObjectFactoryTests extends AbstractPoolTestCase {
DirContextValidator secondDirContextValidatorMock = mock(DirContextValidator.class);
given(secondDirContextValidatorMock.validateDirContext(DirContextType.READ_ONLY, dirContextMock))
- .willThrow(new RuntimeException("Failed to validate"));
+ .willThrow(new RuntimeException("Failed to validate"));
objectFactory.setDirContextValidator(secondDirContextValidatorMock);
final boolean valid2 = objectFactory.validateObject(DirContextType.READ_ONLY, pooledObject);
diff --git a/core/src/test/java/org/springframework/ldap/query/LdapQueryBuilderTests.java b/core/src/test/java/org/springframework/ldap/query/LdapQueryBuilderTests.java
index f1909914..0f1c3843 100644
--- a/core/src/test/java/org/springframework/ldap/query/LdapQueryBuilderTests.java
+++ b/core/src/test/java/org/springframework/ldap/query/LdapQueryBuilderTests.java
@@ -103,8 +103,15 @@ public class LdapQueryBuilderTests {
@Test
public void testBuildSimpleAnd() {
- LdapQuery query = LdapQueryBuilder.query().base("dc=261consulting, dc=com").searchScope(SearchScope.ONELEVEL)
- .timeLimit(200).countLimit(221).where("objectclass").is("person").and("cn").is("John Doe");
+ LdapQuery query = LdapQueryBuilder.query()
+ .base("dc=261consulting, dc=com")
+ .searchScope(SearchScope.ONELEVEL)
+ .timeLimit(200)
+ .countLimit(221)
+ .where("objectclass")
+ .is("person")
+ .and("cn")
+ .is("John Doe");
assertThat(query.base()).isEqualTo(LdapUtils.newLdapName("dc=261consulting, dc=com"));
assertThat(query.searchScope()).isEqualTo(SearchScope.ONELEVEL);
@@ -122,8 +129,12 @@ public class LdapQueryBuilderTests {
@Test
public void buildAndOrPrecedence() {
- LdapQuery result = LdapQueryBuilder.query().where("objectclass").is("person").and("cn").is("John Doe")
- .or(LdapQueryBuilder.query().where("sn").is("Doe"));
+ LdapQuery result = LdapQueryBuilder.query()
+ .where("objectclass")
+ .is("person")
+ .and("cn")
+ .is("John Doe")
+ .or(LdapQueryBuilder.query().where("sn").is("Doe"));
assertThat(result.filter().encode()).isEqualTo("(|(&(objectclass=person)(cn=John Doe))(sn=Doe))");
}
@@ -136,8 +147,10 @@ public class LdapQueryBuilderTests {
@Test
public void buildNestedAnd() {
- LdapQuery result = LdapQueryBuilder.query().where("objectclass").is("person")
- .and(LdapQueryBuilder.query().where("sn").is("Doe").or("sn").like("Die"));
+ LdapQuery result = LdapQueryBuilder.query()
+ .where("objectclass")
+ .is("person")
+ .and(LdapQueryBuilder.query().where("sn").is("Doe").or("sn").like("Die"));
assertThat(result.filter().encode()).isEqualTo("(&(objectclass=person)(|(sn=Doe)(sn=Die)))");
}
diff --git a/core/src/test/java/org/springframework/ldap/support/LdapNameBuilderTests.java b/core/src/test/java/org/springframework/ldap/support/LdapNameBuilderTests.java
index ed9051bf..dde503da 100644
--- a/core/src/test/java/org/springframework/ldap/support/LdapNameBuilderTests.java
+++ b/core/src/test/java/org/springframework/ldap/support/LdapNameBuilderTests.java
@@ -39,8 +39,8 @@ public class LdapNameBuilderTests {
@Test
public void testAddComponentToBaseName() {
- LdapNameBuilder tested = LdapNameBuilder.newInstance(LdapUtils.newLdapName("dc=com")).add("dc",
- "261consulting");
+ LdapNameBuilder tested = LdapNameBuilder.newInstance(LdapUtils.newLdapName("dc=com"))
+ .add("dc", "261consulting");
assertThat(tested.build().toString()).isEqualTo("dc=261consulting,dc=com");
}
@@ -53,7 +53,7 @@ public class LdapNameBuilderTests {
@Test
public void testAddNameToBaseString() {
LdapNameBuilder tested = LdapNameBuilder.newInstance("dc=261consulting,dc=com")
- .add(LdapUtils.newLdapName("ou=people"));
+ .add(LdapUtils.newLdapName("ou=people"));
assertThat(tested.build().toString()).isEqualTo("ou=people,dc=261consulting,dc=com");
}
diff --git a/core/src/test/java/org/springframework/ldap/support/LdapUtilsTests.java b/core/src/test/java/org/springframework/ldap/support/LdapUtilsTests.java
index 34802a32..0037d70a 100644
--- a/core/src/test/java/org/springframework/ldap/support/LdapUtilsTests.java
+++ b/core/src/test/java/org/springframework/ldap/support/LdapUtilsTests.java
@@ -302,138 +302,138 @@ public class LdapUtilsTests {
// Test the Exceptions in the javax.naming package
assertThat(LdapUtils.convertLdapException(new javax.naming.directory.AttributeInUseException()).getClass())
- .isEqualTo(org.springframework.ldap.AttributeInUseException.class);
+ .isEqualTo(org.springframework.ldap.AttributeInUseException.class);
assertThat(
LdapUtils.convertLdapException(new javax.naming.directory.AttributeModificationException()).getClass())
- .isEqualTo(org.springframework.ldap.AttributeModificationException.class);
+ .isEqualTo(org.springframework.ldap.AttributeModificationException.class);
assertThat(LdapUtils.convertLdapException(new javax.naming.CannotProceedException()).getClass())
- .isEqualTo(org.springframework.ldap.CannotProceedException.class);
+ .isEqualTo(org.springframework.ldap.CannotProceedException.class);
assertThat(LdapUtils.convertLdapException(new javax.naming.CommunicationException()).getClass())
- .isEqualTo(org.springframework.ldap.CommunicationException.class);
+ .isEqualTo(org.springframework.ldap.CommunicationException.class);
assertThat(LdapUtils.convertLdapException(new javax.naming.ConfigurationException()).getClass())
- .isEqualTo(org.springframework.ldap.ConfigurationException.class);
+ .isEqualTo(org.springframework.ldap.ConfigurationException.class);
assertThat(LdapUtils.convertLdapException(new javax.naming.ContextNotEmptyException()).getClass())
- .isEqualTo(org.springframework.ldap.ContextNotEmptyException.class);
+ .isEqualTo(org.springframework.ldap.ContextNotEmptyException.class);
assertThat(LdapUtils.convertLdapException(new javax.naming.InsufficientResourcesException()).getClass())
- .isEqualTo(org.springframework.ldap.InsufficientResourcesException.class);
+ .isEqualTo(org.springframework.ldap.InsufficientResourcesException.class);
assertThat(LdapUtils.convertLdapException(new javax.naming.InterruptedNamingException()).getClass())
- .isEqualTo(org.springframework.ldap.InterruptedNamingException.class);
+ .isEqualTo(org.springframework.ldap.InterruptedNamingException.class);
assertThat(LdapUtils.convertLdapException(new javax.naming.directory.InvalidAttributeIdentifierException())
- .getClass()).isEqualTo(org.springframework.ldap.InvalidAttributeIdentifierException.class);
+ .getClass()).isEqualTo(org.springframework.ldap.InvalidAttributeIdentifierException.class);
assertThat(LdapUtils.convertLdapException(new javax.naming.directory.InvalidAttributesException()).getClass())
- .isEqualTo(org.springframework.ldap.InvalidAttributesException.class);
+ .isEqualTo(org.springframework.ldap.InvalidAttributesException.class);
assertThat(
LdapUtils.convertLdapException(new javax.naming.directory.InvalidAttributeValueException()).getClass())
- .isEqualTo(org.springframework.ldap.InvalidAttributeValueException.class);
+ .isEqualTo(org.springframework.ldap.InvalidAttributeValueException.class);
assertThat(LdapUtils.convertLdapException(new javax.naming.InvalidNameException()).getClass())
- .isEqualTo(org.springframework.ldap.InvalidNameException.class);
+ .isEqualTo(org.springframework.ldap.InvalidNameException.class);
assertThat(
LdapUtils.convertLdapException(new javax.naming.directory.InvalidSearchControlsException()).getClass())
- .isEqualTo(org.springframework.ldap.InvalidSearchControlsException.class);
+ .isEqualTo(org.springframework.ldap.InvalidSearchControlsException.class);
assertThat(LdapUtils.convertLdapException(new javax.naming.directory.InvalidSearchFilterException()).getClass())
- .isEqualTo(org.springframework.ldap.InvalidSearchFilterException.class);
+ .isEqualTo(org.springframework.ldap.InvalidSearchFilterException.class);
assertThat(LdapUtils.convertLdapException(new javax.naming.SizeLimitExceededException()).getClass())
- .isEqualTo(org.springframework.ldap.SizeLimitExceededException.class);
+ .isEqualTo(org.springframework.ldap.SizeLimitExceededException.class);
assertThat(LdapUtils.convertLdapException(new javax.naming.TimeLimitExceededException()).getClass())
- .isEqualTo(org.springframework.ldap.TimeLimitExceededException.class);
+ .isEqualTo(org.springframework.ldap.TimeLimitExceededException.class);
assertThat(LdapUtils.convertLdapException(new javax.naming.LimitExceededException()).getClass())
- .isEqualTo(org.springframework.ldap.LimitExceededException.class);
+ .isEqualTo(org.springframework.ldap.LimitExceededException.class);
assertThat(LdapUtils.convertLdapException(new javax.naming.LinkLoopException()).getClass())
- .isEqualTo(org.springframework.ldap.LinkLoopException.class);
+ .isEqualTo(org.springframework.ldap.LinkLoopException.class);
assertThat(LdapUtils.convertLdapException(new javax.naming.MalformedLinkException()).getClass())
- .isEqualTo(org.springframework.ldap.MalformedLinkException.class);
+ .isEqualTo(org.springframework.ldap.MalformedLinkException.class);
assertThat(LdapUtils.convertLdapException(new javax.naming.LinkException()).getClass())
- .isEqualTo(org.springframework.ldap.LinkException.class);
+ .isEqualTo(org.springframework.ldap.LinkException.class);
assertThat(LdapUtils.convertLdapException(new javax.naming.NameAlreadyBoundException()).getClass())
- .isEqualTo(org.springframework.ldap.NameAlreadyBoundException.class);
+ .isEqualTo(org.springframework.ldap.NameAlreadyBoundException.class);
assertThat(LdapUtils.convertLdapException(new javax.naming.NameNotFoundException()).getClass())
- .isEqualTo(org.springframework.ldap.NameNotFoundException.class);
+ .isEqualTo(org.springframework.ldap.NameNotFoundException.class);
assertThat(LdapUtils.convertLdapException(new javax.naming.NoPermissionException()).getClass())
- .isEqualTo(org.springframework.ldap.NoPermissionException.class);
+ .isEqualTo(org.springframework.ldap.NoPermissionException.class);
assertThat(LdapUtils.convertLdapException(new javax.naming.AuthenticationException()).getClass())
- .isEqualTo(org.springframework.ldap.AuthenticationException.class);
+ .isEqualTo(org.springframework.ldap.AuthenticationException.class);
assertThat(LdapUtils.convertLdapException(new javax.naming.AuthenticationNotSupportedException()).getClass())
- .isEqualTo(org.springframework.ldap.AuthenticationNotSupportedException.class);
+ .isEqualTo(org.springframework.ldap.AuthenticationNotSupportedException.class);
assertThat(LdapUtils.convertLdapException(new javax.naming.NoInitialContextException()).getClass())
- .isEqualTo(org.springframework.ldap.NoInitialContextException.class);
+ .isEqualTo(org.springframework.ldap.NoInitialContextException.class);
assertThat(LdapUtils.convertLdapException(new javax.naming.directory.NoSuchAttributeException()).getClass())
- .isEqualTo(org.springframework.ldap.NoSuchAttributeException.class);
+ .isEqualTo(org.springframework.ldap.NoSuchAttributeException.class);
assertThat(LdapUtils.convertLdapException(new javax.naming.NotContextException()).getClass())
- .isEqualTo(org.springframework.ldap.NotContextException.class);
+ .isEqualTo(org.springframework.ldap.NotContextException.class);
assertThat(LdapUtils.convertLdapException(new javax.naming.OperationNotSupportedException()).getClass())
- .isEqualTo(org.springframework.ldap.OperationNotSupportedException.class);
+ .isEqualTo(org.springframework.ldap.OperationNotSupportedException.class);
assertThat(LdapUtils.convertLdapException(new javax.naming.PartialResultException()).getClass())
- .isEqualTo(org.springframework.ldap.PartialResultException.class);
+ .isEqualTo(org.springframework.ldap.PartialResultException.class);
assertThat(LdapUtils.convertLdapException(new javax.naming.directory.SchemaViolationException()).getClass())
- .isEqualTo(org.springframework.ldap.SchemaViolationException.class);
+ .isEqualTo(org.springframework.ldap.SchemaViolationException.class);
assertThat(LdapUtils.convertLdapException(new javax.naming.ServiceUnavailableException()).getClass())
- .isEqualTo(org.springframework.ldap.ServiceUnavailableException.class);
+ .isEqualTo(org.springframework.ldap.ServiceUnavailableException.class);
// Test Exceptions that extend javax.naming packaage extensions
assertThat(LdapUtils.convertLdapException(new MockAttributeInUseException()).getClass())
- .isEqualTo(org.springframework.ldap.AttributeInUseException.class);
+ .isEqualTo(org.springframework.ldap.AttributeInUseException.class);
assertThat(LdapUtils.convertLdapException(new MockAttributeModificationException()).getClass())
- .isEqualTo(org.springframework.ldap.AttributeModificationException.class);
+ .isEqualTo(org.springframework.ldap.AttributeModificationException.class);
assertThat(LdapUtils.convertLdapException(new MockCannotProceedException()).getClass())
- .isEqualTo(org.springframework.ldap.CannotProceedException.class);
+ .isEqualTo(org.springframework.ldap.CannotProceedException.class);
assertThat(LdapUtils.convertLdapException(new MockCommunicationException()).getClass())
- .isEqualTo(org.springframework.ldap.CommunicationException.class);
+ .isEqualTo(org.springframework.ldap.CommunicationException.class);
assertThat(LdapUtils.convertLdapException(new MockConfigurationException()).getClass())
- .isEqualTo(org.springframework.ldap.ConfigurationException.class);
+ .isEqualTo(org.springframework.ldap.ConfigurationException.class);
assertThat(LdapUtils.convertLdapException(new MockContextNotEmptyException()).getClass())
- .isEqualTo(org.springframework.ldap.ContextNotEmptyException.class);
+ .isEqualTo(org.springframework.ldap.ContextNotEmptyException.class);
assertThat(LdapUtils.convertLdapException(new MockInsufficientResourcesException()).getClass())
- .isEqualTo(org.springframework.ldap.InsufficientResourcesException.class);
+ .isEqualTo(org.springframework.ldap.InsufficientResourcesException.class);
assertThat(LdapUtils.convertLdapException(new MockInterruptedNamingException()).getClass())
- .isEqualTo(org.springframework.ldap.InterruptedNamingException.class);
+ .isEqualTo(org.springframework.ldap.InterruptedNamingException.class);
assertThat(LdapUtils.convertLdapException(new MockInvalidAttributeIdentifierException()).getClass())
- .isEqualTo(org.springframework.ldap.InvalidAttributeIdentifierException.class);
+ .isEqualTo(org.springframework.ldap.InvalidAttributeIdentifierException.class);
assertThat(LdapUtils.convertLdapException(new MockInvalidAttributesException()).getClass())
- .isEqualTo(org.springframework.ldap.InvalidAttributesException.class);
+ .isEqualTo(org.springframework.ldap.InvalidAttributesException.class);
assertThat(LdapUtils.convertLdapException(new MockInvalidAttributeValueException()).getClass())
- .isEqualTo(org.springframework.ldap.InvalidAttributeValueException.class);
+ .isEqualTo(org.springframework.ldap.InvalidAttributeValueException.class);
assertThat(LdapUtils.convertLdapException(new MockInvalidNameException()).getClass())
- .isEqualTo(org.springframework.ldap.InvalidNameException.class);
+ .isEqualTo(org.springframework.ldap.InvalidNameException.class);
assertThat(LdapUtils.convertLdapException(new MockInvalidSearchControlsException()).getClass())
- .isEqualTo(org.springframework.ldap.InvalidSearchControlsException.class);
+ .isEqualTo(org.springframework.ldap.InvalidSearchControlsException.class);
assertThat(LdapUtils.convertLdapException(new MockInvalidSearchFilterException()).getClass())
- .isEqualTo(org.springframework.ldap.InvalidSearchFilterException.class);
+ .isEqualTo(org.springframework.ldap.InvalidSearchFilterException.class);
assertThat(LdapUtils.convertLdapException(new MockSizeLimitExceededException()).getClass())
- .isEqualTo(org.springframework.ldap.SizeLimitExceededException.class);
+ .isEqualTo(org.springframework.ldap.SizeLimitExceededException.class);
assertThat(LdapUtils.convertLdapException(new MockTimeLimitExceededException()).getClass())
- .isEqualTo(org.springframework.ldap.TimeLimitExceededException.class);
+ .isEqualTo(org.springframework.ldap.TimeLimitExceededException.class);
assertThat(LdapUtils.convertLdapException(new MockLimitExceededException()).getClass())
- .isEqualTo(org.springframework.ldap.LimitExceededException.class);
+ .isEqualTo(org.springframework.ldap.LimitExceededException.class);
assertThat(LdapUtils.convertLdapException(new MockLinkLoopException()).getClass())
- .isEqualTo(org.springframework.ldap.LinkLoopException.class);
+ .isEqualTo(org.springframework.ldap.LinkLoopException.class);
assertThat(LdapUtils.convertLdapException(new MockMalformedLinkException()).getClass())
- .isEqualTo(org.springframework.ldap.MalformedLinkException.class);
+ .isEqualTo(org.springframework.ldap.MalformedLinkException.class);
assertThat(LdapUtils.convertLdapException(new MockLinkException()).getClass())
- .isEqualTo(org.springframework.ldap.LinkException.class);
+ .isEqualTo(org.springframework.ldap.LinkException.class);
assertThat(LdapUtils.convertLdapException(new MockNameAlreadyBoundException()).getClass())
- .isEqualTo(org.springframework.ldap.NameAlreadyBoundException.class);
+ .isEqualTo(org.springframework.ldap.NameAlreadyBoundException.class);
assertThat(LdapUtils.convertLdapException(new MockNameNotFoundException()).getClass())
- .isEqualTo(org.springframework.ldap.NameNotFoundException.class);
+ .isEqualTo(org.springframework.ldap.NameNotFoundException.class);
assertThat(LdapUtils.convertLdapException(new MockNoPermissionException()).getClass())
- .isEqualTo(org.springframework.ldap.NoPermissionException.class);
+ .isEqualTo(org.springframework.ldap.NoPermissionException.class);
assertThat(LdapUtils.convertLdapException(new MockAuthenticationException()).getClass())
- .isEqualTo(org.springframework.ldap.AuthenticationException.class);
+ .isEqualTo(org.springframework.ldap.AuthenticationException.class);
assertThat(LdapUtils.convertLdapException(new MockAuthenticationNotSupportedException()).getClass())
- .isEqualTo(org.springframework.ldap.AuthenticationNotSupportedException.class);
+ .isEqualTo(org.springframework.ldap.AuthenticationNotSupportedException.class);
assertThat(LdapUtils.convertLdapException(new MockNoInitialContextException()).getClass())
- .isEqualTo(org.springframework.ldap.NoInitialContextException.class);
+ .isEqualTo(org.springframework.ldap.NoInitialContextException.class);
assertThat(LdapUtils.convertLdapException(new MockNoSuchAttributeException()).getClass())
- .isEqualTo(org.springframework.ldap.NoSuchAttributeException.class);
+ .isEqualTo(org.springframework.ldap.NoSuchAttributeException.class);
assertThat(LdapUtils.convertLdapException(new MockNotContextException()).getClass())
- .isEqualTo(org.springframework.ldap.NotContextException.class);
+ .isEqualTo(org.springframework.ldap.NotContextException.class);
assertThat(LdapUtils.convertLdapException(new MockOperationNotSupportedException()).getClass())
- .isEqualTo(org.springframework.ldap.OperationNotSupportedException.class);
+ .isEqualTo(org.springframework.ldap.OperationNotSupportedException.class);
assertThat(LdapUtils.convertLdapException(new MockPartialResultException()).getClass())
- .isEqualTo(org.springframework.ldap.PartialResultException.class);
+ .isEqualTo(org.springframework.ldap.PartialResultException.class);
assertThat(LdapUtils.convertLdapException(new MockSchemaViolationException()).getClass())
- .isEqualTo(org.springframework.ldap.SchemaViolationException.class);
+ .isEqualTo(org.springframework.ldap.SchemaViolationException.class);
assertThat(LdapUtils.convertLdapException(new MockServiceUnavailableException()).getClass())
- .isEqualTo(org.springframework.ldap.ServiceUnavailableException.class);
+ .isEqualTo(org.springframework.ldap.ServiceUnavailableException.class);
}
public class MockAttributeInUseException extends javax.naming.directory.AttributeInUseException {
diff --git a/core/src/test/java/org/springframework/ldap/transaction/compensating/BindOperationRecorderTests.java b/core/src/test/java/org/springframework/ldap/transaction/compensating/BindOperationRecorderTests.java
index 99b2e5bc..b42e9c6b 100644
--- a/core/src/test/java/org/springframework/ldap/transaction/compensating/BindOperationRecorderTests.java
+++ b/core/src/test/java/org/springframework/ldap/transaction/compensating/BindOperationRecorderTests.java
@@ -48,7 +48,7 @@ public class BindOperationRecorderTests {
BasicAttributes expectedAttributes = new BasicAttributes();
// Perform test.
CompensatingTransactionOperationExecutor operation = tested
- .recordOperation(new Object[] { expectedDn, expectedObject, expectedAttributes });
+ .recordOperation(new Object[] { expectedDn, expectedObject, expectedAttributes });
assertThat(operation instanceof BindOperationExecutor).isTrue();
BindOperationExecutor rollbackOperation = (BindOperationExecutor) operation;
@@ -67,7 +67,7 @@ public class BindOperationRecorderTests {
BasicAttributes expectedAttributes = new BasicAttributes();
// Perform test.
CompensatingTransactionOperationExecutor operation = tested
- .recordOperation(new Object[] { expectedDn, expectedObject, expectedAttributes });
+ .recordOperation(new Object[] { expectedDn, expectedObject, expectedAttributes });
assertThat(operation instanceof BindOperationExecutor).isTrue();
BindOperationExecutor rollbackOperation = (BindOperationExecutor) operation;
diff --git a/core/src/test/java/org/springframework/ldap/transaction/compensating/ModifyAttributesOperationRecorderTests.java b/core/src/test/java/org/springframework/ldap/transaction/compensating/ModifyAttributesOperationRecorderTests.java
index df376e36..7e886309 100644
--- a/core/src/test/java/org/springframework/ldap/transaction/compensating/ModifyAttributesOperationRecorderTests.java
+++ b/core/src/test/java/org/springframework/ldap/transaction/compensating/ModifyAttributesOperationRecorderTests.java
@@ -81,12 +81,12 @@ public class ModifyAttributesOperationRecorderTests {
given(this.attributesMapperMock.hasMore()).willReturn(true, false);
given(this.attributesMapperMock.getAttributesForLookup()).willReturn(new String[] { "attribute1" });
given(this.ldapOperationsMock.lookup(expectedName, new String[] { "attribute1" }, this.attributesMapperMock))
- .willReturn(expectedAttributes);
+ .willReturn(expectedAttributes);
given(this.attributesMapperMock.getCollectedAttributes()).willReturn(expectedAttributes);
// Perform test
CompensatingTransactionOperationExecutor operation = this.tested
- .recordOperation(new Object[] { expectedName, incomingMods });
+ .recordOperation(new Object[] { expectedName, incomingMods });
// Verify outcome
assertThat(operation instanceof ModifyAttributesOperationExecutor).isTrue();
diff --git a/core/src/test/java/org/springframework/ldap/transaction/compensating/RebindOperationRecorderTests.java b/core/src/test/java/org/springframework/ldap/transaction/compensating/RebindOperationRecorderTests.java
index 0f9ccaeb..6424e5f1 100644
--- a/core/src/test/java/org/springframework/ldap/transaction/compensating/RebindOperationRecorderTests.java
+++ b/core/src/test/java/org/springframework/ldap/transaction/compensating/RebindOperationRecorderTests.java
@@ -57,7 +57,7 @@ public class RebindOperationRecorderTests {
// perform test
CompensatingTransactionOperationExecutor result = tested
- .recordOperation(new Object[] { expectedDn, expectedObject, expectedAttributes });
+ .recordOperation(new Object[] { expectedDn, expectedObject, expectedAttributes });
assertThat(result instanceof RebindOperationExecutor).isTrue();
RebindOperationExecutor rollbackOperation = (RebindOperationExecutor) result;
assertThat(rollbackOperation.getLdapOperations()).isSameAs(this.ldapOperationsMock);
diff --git a/core/src/test/java/org/springframework/ldap/transaction/compensating/RenameOperationRecorderTests.java b/core/src/test/java/org/springframework/ldap/transaction/compensating/RenameOperationRecorderTests.java
index cb9414b3..a89abf7b 100644
--- a/core/src/test/java/org/springframework/ldap/transaction/compensating/RenameOperationRecorderTests.java
+++ b/core/src/test/java/org/springframework/ldap/transaction/compensating/RenameOperationRecorderTests.java
@@ -40,7 +40,7 @@ public class RenameOperationRecorderTests {
// Perform test
CompensatingTransactionOperationExecutor operation = tested
- .recordOperation(new Object[] { "ou=someou", "ou=newou" });
+ .recordOperation(new Object[] { "ou=someou", "ou=newou" });
assertThat(operation instanceof RenameOperationExecutor).isTrue();
RenameOperationExecutor rollbackOperation = (RenameOperationExecutor) operation;
diff --git a/core/src/test/java/org/springframework/ldap/transaction/compensating/manager/ContextSourceTransactionManagerTests.java b/core/src/test/java/org/springframework/ldap/transaction/compensating/manager/ContextSourceTransactionManagerTests.java
index 28bf805d..f9771071 100644
--- a/core/src/test/java/org/springframework/ldap/transaction/compensating/manager/ContextSourceTransactionManagerTests.java
+++ b/core/src/test/java/org/springframework/ldap/transaction/compensating/manager/ContextSourceTransactionManagerTests.java
@@ -102,7 +102,7 @@ public class ContextSourceTransactionManagerTests {
this.tested.doBegin(expectedTransactionObject, this.transactionDefinitionMock);
DirContextHolder foundContextHolder = (DirContextHolder) TransactionSynchronizationManager
- .getResource(this.contextSourceMock);
+ .getResource(this.contextSourceMock);
assertThat(foundContextHolder.getCtx()).isSameAs(this.contextMock);
}
@@ -168,8 +168,8 @@ public class ContextSourceTransactionManagerTests {
final ContextSourceTransactionManager txMgrInner = new ContextSourceTransactionManager();
txMgrInner.setContextSource(unconnectableContextSourceMock);
- final TransactionStatus txInner = txMgrInner.getTransaction(
- new DefaultTransactionDefinition(TransactionDefinition.PROPAGATION_REQUIRES_NEW));
+ final TransactionStatus txInner = txMgrInner
+ .getTransaction(new DefaultTransactionDefinition(TransactionDefinition.PROPAGATION_REQUIRES_NEW));
try {
// Do something with the connection that succeeds or fails
diff --git a/core/src/test/java/org/springframework/transaction/compensating/support/DefaultCompensatingTransactionOperationManagerTests.java b/core/src/test/java/org/springframework/transaction/compensating/support/DefaultCompensatingTransactionOperationManagerTests.java
index 65cb4ce9..c89f0f93 100644
--- a/core/src/test/java/org/springframework/transaction/compensating/support/DefaultCompensatingTransactionOperationManagerTests.java
+++ b/core/src/test/java/org/springframework/transaction/compensating/support/DefaultCompensatingTransactionOperationManagerTests.java
@@ -54,7 +54,7 @@ public class DefaultCompensatingTransactionOperationManagerTests {
Object expectedResource = new Object();
given(this.operationFactoryMock.createRecordingOperation(expectedResource, "some method"))
- .willReturn(this.operationRecorderMock);
+ .willReturn(this.operationRecorderMock);
given(this.operationRecorderMock.recordOperation(expectedArgs)).willReturn(this.operationExecutorMock);
DefaultCompensatingTransactionOperationManager tested = new DefaultCompensatingTransactionOperationManager(
diff --git a/ldif/ldif-core/src/main/java/org/springframework/ldap/ldif/parser/LdifParser.java b/ldif/ldif-core/src/main/java/org/springframework/ldap/ldif/parser/LdifParser.java
index 05fe1862..b3ecd7e4 100644
--- a/ldif/ldif-core/src/main/java/org/springframework/ldap/ldif/parser/LdifParser.java
+++ b/ldif/ldif-core/src/main/java/org/springframework/ldap/ldif/parser/LdifParser.java
@@ -253,82 +253,83 @@ public class LdifParser implements Parser, InitializingBean {
LineIdentifier identifier = this.separatorPolicy.assess(line);
switch (identifier) {
- case NewRecord:
- LOG.trace("Starting new record.");
- // Start new record.
- record = new LdapAttributes(this.caseInsensitive);
- builder = new StringBuilder(line);
+ case NewRecord:
+ LOG.trace("Starting new record.");
+ // Start new record.
+ record = new LdapAttributes(this.caseInsensitive);
+ builder = new StringBuilder(line);
- break;
+ break;
- case Control:
- LOG.trace("'control' encountered.");
+ case Control:
+ LOG.trace("'control' encountered.");
- // Log WARN and discard record.
- LOG.warn("LDIF change records have no implementation: record will be ignored.");
- builder = null;
- record = null;
+ // Log WARN and discard record.
+ LOG.warn("LDIF change records have no implementation: record will be ignored.");
+ builder = null;
+ record = null;
- break;
+ break;
- case ChangeType:
- LOG.trace("'changetype' encountered.");
+ case ChangeType:
+ LOG.trace("'changetype' encountered.");
- // Log WARN and discard record.
- LOG.warn("LDIF change records have no implementation: record will be ignored.");
- builder = null;
- record = null;
+ // Log WARN and discard record.
+ LOG.warn("LDIF change records have no implementation: record will be ignored.");
+ builder = null;
+ record = null;
- break;
+ break;
- case Attribute:
- // flush buffer.
- addAttributeToRecord(builder.toString(), record);
+ case Attribute:
+ // flush buffer.
+ addAttributeToRecord(builder.toString(), record);
- LOG.trace("Starting new attribute.");
- // Start new attribute.
- builder = new StringBuilder(line);
+ LOG.trace("Starting new attribute.");
+ // Start new attribute.
+ builder = new StringBuilder(line);
- break;
+ break;
- case Continuation:
- LOG.trace("...appending line to buffer.");
- // Append line to buffer.
- builder.append(line.replaceFirst(" ", ""));
+ case Continuation:
+ LOG.trace("...appending line to buffer.");
+ // Append line to buffer.
+ builder.append(line.replaceFirst(" ", ""));
- break;
+ break;
- case EndOfRecord:
- LOG.trace("...done parsing record. (EndOfRecord)");
+ case EndOfRecord:
+ LOG.trace("...done parsing record. (EndOfRecord)");
- // Validate record and return.
- if (record == null) {
- return null;
- }
- else {
- try {
- // flush buffer.
- addAttributeToRecord(builder.toString(), record);
-
- if (this.specification.isSatisfiedBy(record)) {
- LOG.debug("record parsed:\n" + record);
- return record;
-
- }
- else {
- throw new InvalidRecordFormatException(
- "Record [dn: " + record.getDN() + "] does not conform to specification.");
- }
- }
- catch (NamingException ex) {
- LOG.error("Error adding attribute to record", ex);
+ // Validate record and return.
+ if (record == null) {
return null;
}
- }
+ else {
+ try {
+ // flush buffer.
+ addAttributeToRecord(builder.toString(), record);
- default:
- // Take no action -- applies to VersionIdentifier, Comments, and voided
- // records.
+ if (this.specification.isSatisfiedBy(record)) {
+ LOG.debug("record parsed:\n" + record);
+ return record;
+
+ }
+ else {
+ throw new InvalidRecordFormatException(
+ "Record [dn: " + record.getDN() + "] does not conform to specification.");
+ }
+ }
+ catch (NamingException ex) {
+ LOG.error("Error adding attribute to record", ex);
+ return null;
+ }
+ }
+
+ default:
+ // Take no action -- applies to VersionIdentifier, Comments, and
+ // voided
+ // records.
}
line = this.reader.readLine();
diff --git a/ldif/ldif-core/src/test/java/org/springframework/ldap/ldif/DefaultAttributeValidationPolicyTests.java b/ldif/ldif-core/src/test/java/org/springframework/ldap/ldif/DefaultAttributeValidationPolicyTests.java
index f068290f..ce42b737 100644
--- a/ldif/ldif-core/src/test/java/org/springframework/ldap/ldif/DefaultAttributeValidationPolicyTests.java
+++ b/ldif/ldif-core/src/test/java/org/springframework/ldap/ldif/DefaultAttributeValidationPolicyTests.java
@@ -68,8 +68,8 @@ public class DefaultAttributeValidationPolicyTests {
private AttributeType type;
private List exceptions = Arrays
- .asList(new String[] { "description: :A big sailing fan.", "cn;lang-ja:: 5bCP56yg5Y6fIO.ODreODieODi+ODvA==",
- "url:< https://java.sun.com/j2se/1.3/docs/guide/collections/designfaq.html#28" });
+ .asList(new String[] { "description: :A big sailing fan.", "cn;lang-ja:: 5bCP56yg5Y6fIO.ODreODieODi+ODvA==",
+ "url:< https://java.sun.com/j2se/1.3/docs/guide/collections/designfaq.html#28" });
/**
* The data set to parse.
@@ -165,7 +165,8 @@ public class DefaultAttributeValidationPolicyTests {
LdapAttribute attribute = (LdapAttribute) policy.parse(this.line);
assertThat(this.id.equalsIgnoreCase(attribute.getID()))
- .as("IDs do not match: [expected: " + attribute.getID() + ", obtained: " + this.id + "]").isTrue();
+ .as("IDs do not match: [expected: " + attribute.getID() + ", obtained: " + this.id + "]")
+ .isTrue();
String[] expected = !StringUtils.hasLength(this.options) ? new String[] {}
: this.options.replaceFirst(";", "").split(";");
@@ -175,27 +176,27 @@ public class DefaultAttributeValidationPolicyTests {
assertThat(obtained).as("Options do not match: ").isEqualTo(expected);
switch (this.type) {
- case STRING:
- assertThat(attribute.get() instanceof String).as("Value is not a string.").isTrue();
- assertThat(attribute.get()).as("Values do not match: ").isEqualTo(this.value);
- break;
+ case STRING:
+ assertThat(attribute.get() instanceof String).as("Value is not a string.").isTrue();
+ assertThat(attribute.get()).as("Values do not match: ").isEqualTo(this.value);
+ break;
- case BASE64:
- byte[] bytes = LdapEncoder.parseBase64Binary(this.value);
- assertThat(attribute.get() instanceof byte[]).as("Value is not a byte[].").isTrue();
- assertThat((byte[]) attribute.get()).as("Values do not match: ").isEqualTo(bytes);
- break;
+ case BASE64:
+ byte[] bytes = LdapEncoder.parseBase64Binary(this.value);
+ assertThat(attribute.get() instanceof byte[]).as("Value is not a byte[].").isTrue();
+ assertThat((byte[]) attribute.get()).as("Values do not match: ").isEqualTo(bytes);
+ break;
- case URL:
- URI url = new URI(this.value);
- assertThat(attribute.get() instanceof URI).as("Value is not a URL.").isTrue();
- assertThat(attribute.get()).as("Values do not match: ").isEqualTo(url);
- break;
+ case URL:
+ URI url = new URI(this.value);
+ assertThat(attribute.get() instanceof URI).as("Value is not a URL.").isTrue();
+ assertThat(attribute.get()).as("Values do not match: ").isEqualTo(url);
+ break;
- case UTF8:
- assertThat(attribute.get() instanceof String).as("Value is not a UTF8.").isTrue();
- assertThat(attribute.get()).as("Values do not match: ").isEqualTo(this.value);
- break;
+ case UTF8:
+ assertThat(attribute.get() instanceof String).as("Value is not a UTF8.").isTrue();
+ assertThat(attribute.get()).as("Values do not match: ").isEqualTo(this.value);
+ break;
}
log.info("Success!");
diff --git a/odm/src/main/java/org/springframework/ldap/odm/tools/SchemaReader.java b/odm/src/main/java/org/springframework/ldap/odm/tools/SchemaReader.java
index 9eff2b3e..2a526891 100755
--- a/odm/src/main/java/org/springframework/ldap/odm/tools/SchemaReader.java
+++ b/odm/src/main/java/org/springframework/ldap/odm/tools/SchemaReader.java
@@ -166,23 +166,23 @@ import org.springframework.ldap.odm.tools.SyntaxToJavaClass.ClassInfo;
while (currentValues.hasMoreElements()) {
String currentValue = (String) currentValues.nextElement();
switch (type) {
- case SUP:
- // Its a super class
- String lowerCased = currentValue.toLowerCase();
- if (!schema.getObjectClass().contains(lowerCased)) {
- supList.add(lowerCased);
- }
- break;
- case MUST:
- // Add must attribute
- schema.addMust(createAttributeSchema(currentValue, schemaContext));
- break;
- case MAY:
- // Add may attribute
- schema.addMay(createAttributeSchema(currentValue, schemaContext));
- break;
- default:
- // Nothing to do
+ case SUP:
+ // Its a super class
+ String lowerCased = currentValue.toLowerCase();
+ if (!schema.getObjectClass().contains(lowerCased)) {
+ supList.add(lowerCased);
+ }
+ break;
+ case MUST:
+ // Add must attribute
+ schema.addMust(createAttributeSchema(currentValue, schemaContext));
+ break;
+ case MAY:
+ // Add may attribute
+ schema.addMay(createAttributeSchema(currentValue, schemaContext));
+ break;
+ default:
+ // Nothing to do
}
}
}
diff --git a/odm/src/main/java/org/springframework/ldap/odm/tools/SchemaToJava.java b/odm/src/main/java/org/springframework/ldap/odm/tools/SchemaToJava.java
index f5741fac..cb6c74c8 100755
--- a/odm/src/main/java/org/springframework/ldap/odm/tools/SchemaToJava.java
+++ b/odm/src/main/java/org/springframework/ldap/odm/tools/SchemaToJava.java
@@ -119,9 +119,9 @@ public final class SchemaToJava {
// Command line flags
private enum Flag {
- URL("l", "url"), USERNAME("u", "username"), PASSWORD("p", "password"), OBJECTCLASS("o", "objectclasses"), CLASS(
- "c", "class"), PACKAGE("k",
- "package"), SYNTAX_MAP("s", "syntaxmap"), OUTPUT_DIR("t", "outputdir"), HELP("h", "help");
+ URL("l", "url"), USERNAME("u", "username"), PASSWORD("p", "password"), OBJECTCLASS("o", "objectclasses"),
+ CLASS("c", "class"), PACKAGE("k", "package"), SYNTAX_MAP("s", "syntaxmap"), OUTPUT_DIR("t", "outputdir"),
+ HELP("h", "help");
private String shortName;
diff --git a/odm/src/main/java/org/springframework/ldap/odm/tools/SchemaViewer.java b/odm/src/main/java/org/springframework/ldap/odm/tools/SchemaViewer.java
index c8e9edc5..39f511c6 100755
--- a/odm/src/main/java/org/springframework/ldap/odm/tools/SchemaViewer.java
+++ b/odm/src/main/java/org/springframework/ldap/odm/tools/SchemaViewer.java
@@ -66,9 +66,8 @@ public final class SchemaViewer {
private enum Flag {
- URL("l", "url"), USERNAME("u", "username"), PASSWORD("p", "password"), OBJECTCLASS("o",
- "objectclass"), ATTRIBUTE("a",
- "attribute"), SYNTAX("s", "syntax"), HELP("h", "help"), ERROR("e", "error");
+ URL("l", "url"), USERNAME("u", "username"), PASSWORD("p", "password"), OBJECTCLASS("o", "objectclass"),
+ ATTRIBUTE("a", "attribute"), SYNTAX("s", "syntax"), HELP("h", "help"), ERROR("e", "error");
private String shortName;
diff --git a/odm/src/test/java/org/springframework/ldap/odm/test/ConverterFactoryTests.java b/odm/src/test/java/org/springframework/ldap/odm/test/ConverterFactoryTests.java
index e4cff176..33c962fb 100755
--- a/odm/src/test/java/org/springframework/ldap/odm/test/ConverterFactoryTests.java
+++ b/odm/src/test/java/org/springframework/ldap/odm/test/ConverterFactoryTests.java
@@ -67,7 +67,7 @@ public class ConverterFactoryTests {
new ExecuteRunnable().runTests(new RunnableTests() {
public void runTest(ConverterTestData testData) {
assertThat(testData.canConvert)
- .isEqualTo(converterManager.canConvert(testData.fromClass, testData.syntax, testData.toClass));
+ .isEqualTo(converterManager.canConvert(testData.fromClass, testData.syntax, testData.toClass));
}
}, this.converterTestData);
}
diff --git a/odm/src/test/java/org/springframework/ldap/odm/test/ConverterManagerTests.java b/odm/src/test/java/org/springframework/ldap/odm/test/ConverterManagerTests.java
index 1c1b8a8e..fcce66f3 100755
--- a/odm/src/test/java/org/springframework/ldap/odm/test/ConverterManagerTests.java
+++ b/odm/src/test/java/org/springframework/ldap/odm/test/ConverterManagerTests.java
@@ -102,7 +102,7 @@ public final class ConverterManagerTests {
new ExecuteRunnable>().runTests(new RunnableTests>() {
public void runTest(ConverterTestData> testData) {
assertThat(testData.expectedValue).isEqualTo(ConverterManagerTests.this.converterManager
- .convert(testData.sourceData, "", testData.destClass));
+ .convert(testData.sourceData, "", testData.destClass));
}
}, primitiveTypeTests);
}
@@ -134,7 +134,7 @@ public final class ConverterManagerTests {
new ExecuteRunnable>().runTests(new RunnableTests>() {
public void runTest(ConverterTestData> testData) {
assertThat(testData.expectedValue).isEqualTo(ConverterManagerTests.this.converterManager
- .convert(testData.sourceData, testData.syntax, testData.destClass));
+ .convert(testData.sourceData, testData.syntax, testData.destClass));
}
}, syntaxTests);
diff --git a/odm/src/test/java/org/springframework/ldap/odm/test/LdapTests.java b/odm/src/test/java/org/springframework/ldap/odm/test/LdapTests.java
index 6669fd54..4f045c07 100755
--- a/odm/src/test/java/org/springframework/ldap/odm/test/LdapTests.java
+++ b/odm/src/test/java/org/springframework/ldap/odm/test/LdapTests.java
@@ -312,7 +312,7 @@ public final class LdapTests {
this.searchControls);
LOG.debug(String.format("Found - %1$s", allOus));
assertThat(new HashSet(Arrays.asList(ouTestData)))
- .isEqualTo(new HashSet(allOus));
+ .isEqualTo(new HashSet(allOus));
OrganizationalUnit testOu = ouTestData[OrganizationalName.ASSISTANTS.getIndex()];
LOG.debug(String.format("Reading - %1$s", testOu.getDn()));
@@ -337,7 +337,7 @@ public final class LdapTests {
assertThat(9).isEqualTo(allPeople.size());
assertThat(CollectionUtils.containsInstance(allPeople, null)).isFalse()
- .withFailMessage("No nulls should have been returned");
+ .withFailMessage("No nulls should have been returned");
}
@Test
diff --git a/odm/src/test/java/org/springframework/ldap/odm/test/SchemaToJavaTests.java b/odm/src/test/java/org/springframework/ldap/odm/test/SchemaToJavaTests.java
index 94293fe3..0cd88400 100755
--- a/odm/src/test/java/org/springframework/ldap/odm/test/SchemaToJavaTests.java
+++ b/odm/src/test/java/org/springframework/ldap/odm/test/SchemaToJavaTests.java
@@ -215,7 +215,7 @@ public final class SchemaToJavaTests {
Method telephoneNumberIteratorMethod = clazz.getMethod("getTelephoneNumberIterator");
@SuppressWarnings("unchecked")
Iterator telephoneNumberIterator = (Iterator) telephoneNumberIteratorMethod
- .invoke(fromDirectory);
+ .invoke(fromDirectory);
int telephoneNumberCount = 0;
while (telephoneNumberIterator.hasNext()) {
telephoneNumberCount++;
diff --git a/odm/src/test/java/org/springframework/ldap/odm/test/utils/CompilerInterface.java b/odm/src/test/java/org/springframework/ldap/odm/test/utils/CompilerInterface.java
index 49dadd28..e8455c95 100755
--- a/odm/src/test/java/org/springframework/ldap/odm/test/utils/CompilerInterface.java
+++ b/odm/src/test/java/org/springframework/ldap/odm/test/utils/CompilerInterface.java
@@ -33,7 +33,7 @@ public final class CompilerInterface {
StandardJavaFileManager fileManager = compiler.getStandardFileManager(null, null, null);
Iterable extends JavaFileObject> javaFileObjects = fileManager
- .getJavaFileObjectsFromFiles(Arrays.asList(toCompile));
+ .getJavaFileObjectsFromFiles(Arrays.asList(toCompile));
compiler.getTask(null, fileManager, null, null, null, javaFileObjects).call();
fileManager.close();
diff --git a/sandbox/src/test/java/org/springframework/ldap/control/VirtualListViewControlDirContextProcessorTests.java b/sandbox/src/test/java/org/springframework/ldap/control/VirtualListViewControlDirContextProcessorTests.java
index 8058e9ad..d0b481f5 100644
--- a/sandbox/src/test/java/org/springframework/ldap/control/VirtualListViewControlDirContextProcessorTests.java
+++ b/sandbox/src/test/java/org/springframework/ldap/control/VirtualListViewControlDirContextProcessorTests.java
@@ -164,20 +164,20 @@ public class VirtualListViewControlDirContextProcessorTests {
targetType >>= 3;
ber.parseLength(); // ignore
switch (targetType) {
- case 0: // byOffset
- int actualOffset = ber.parseInt();
- int actualContentCount = ber.parseInt();
- assertThat(expectedBeforeCount).isEqualTo(actualBeforeCount);
- assertThat(expectedAfterCount).isEqualTo(actualAfterCount);
- assertThat(expectedOffset).isEqualTo(actualOffset);
- assertThat(actualContentCount).isEqualTo(expectedContentCount);
- break;
+ case 0: // byOffset
+ int actualOffset = ber.parseInt();
+ int actualContentCount = ber.parseInt();
+ assertThat(expectedBeforeCount).isEqualTo(actualBeforeCount);
+ assertThat(expectedAfterCount).isEqualTo(actualAfterCount);
+ assertThat(expectedOffset).isEqualTo(actualOffset);
+ assertThat(actualContentCount).isEqualTo(expectedContentCount);
+ break;
- case 1: // greaterThanOrEqual
- throw new AssertionFailedError("CHOICE value greaterThanOrEqual not supported");
+ case 1: // greaterThanOrEqual
+ throw new AssertionFailedError("CHOICE value greaterThanOrEqual not supported");
- default:
- throw new AssertionFailedError("illegal CHOICE value: " + targetType);
+ default:
+ throw new AssertionFailedError("illegal CHOICE value: " + targetType);
}
byte[] bs = ber.parseOctetString(Ber.ASN_OCTET_STR, null);
assertContextId(expectedContextId, bs);
diff --git a/test-support/src/main/java/org/springframework/ldap/test/AbstractEc2InstanceLaunchingFactoryBean.java b/test-support/src/main/java/org/springframework/ldap/test/AbstractEc2InstanceLaunchingFactoryBean.java
index 29505fbd..ef7ff759 100644
--- a/test-support/src/main/java/org/springframework/ldap/test/AbstractEc2InstanceLaunchingFactoryBean.java
+++ b/test-support/src/main/java/org/springframework/ldap/test/AbstractEc2InstanceLaunchingFactoryBean.java
@@ -129,7 +129,7 @@ public abstract class AbstractEc2InstanceLaunchingFactoryBean extends AbstractFa
LOG.info("Instance still starting up; sleeping " + INSTANCE_START_SLEEP_TIME + "ms");
Thread.sleep(INSTANCE_START_SLEEP_TIME);
reservationDescription = jec2.describeInstances(Collections.singletonList(this.instance.getInstanceId()))
- .get(0);
+ .get(0);
this.instance = reservationDescription.getInstances().get(0);
}
diff --git a/test/integration-tests-ad/src/test/java/org/springframework/ldap/itest/ad/IncrementalAttributeMapperITests.java b/test/integration-tests-ad/src/test/java/org/springframework/ldap/itest/ad/IncrementalAttributeMapperITests.java
index 35548bea..ac705bb9 100644
--- a/test/integration-tests-ad/src/test/java/org/springframework/ldap/itest/ad/IncrementalAttributeMapperITests.java
+++ b/test/integration-tests-ad/src/test/java/org/springframework/ldap/itest/ad/IncrementalAttributeMapperITests.java
@@ -225,7 +225,7 @@ public class IncrementalAttributeMapperITests extends AbstractJUnit4SpringContex
// LDAP-234: After rollback the attribute values were cleared after rollback
assertThat(DefaultIncrementalAttributesMapper.lookupAttributeValues(this.ldapTemplate, GROUP_DN, "member")
- .size()).isEqualTo(1501);
+ .size()).isEqualTo(1501);
}
}
diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/itest/DefaultLdapClientAuthenticationITests.java b/test/integration-tests/src/test/java/org/springframework/ldap/itest/DefaultLdapClientAuthenticationITests.java
index c6af1928..216625c1 100644
--- a/test/integration-tests/src/test/java/org/springframework/ldap/itest/DefaultLdapClientAuthenticationITests.java
+++ b/test/integration-tests/src/test/java/org/springframework/ldap/itest/DefaultLdapClientAuthenticationITests.java
@@ -76,7 +76,7 @@ public class DefaultLdapClientAuthenticationITests extends AbstractLdapTemplateI
filter.and(new EqualsFilter("objectclass", "person")).and(new EqualsFilter("uid", "some.person3"));
LdapQuery query = LdapQueryBuilder.query().filter(filter);
assertThatExceptionOfType(AuthenticationException.class)
- .isThrownBy(() -> this.tested.authenticate().query(query).password("invalidpassword").execute());
+ .isThrownBy(() -> this.tested.authenticate().query(query).password("invalidpassword").execute());
}
@Test
@@ -86,7 +86,7 @@ public class DefaultLdapClientAuthenticationITests extends AbstractLdapTemplateI
filter.and(new EqualsFilter("objectclass", "person")).and(new EqualsFilter("uid", "some.person3"));
LdapQuery query = LdapQueryBuilder.query().where("objectclass").is("person").and("uid").is("some.person3");
assertThatExceptionOfType(AuthenticationException.class)
- .isThrownBy(() -> this.tested.authenticate().query(query).password("invalidpassword").execute());
+ .isThrownBy(() -> this.tested.authenticate().query(query).password("invalidpassword").execute());
}
@Test
@@ -114,8 +114,10 @@ public class DefaultLdapClientAuthenticationITests extends AbstractLdapTemplateI
@Category(NoAdTests.class)
public void testAuthenticateWithLdapQueryAndMapper() {
LdapQuery query = LdapQueryBuilder.query().where("objectclass").is("person").and("uid").is("some.person3");
- DirContextOperations ctx = this.tested.authenticate().query(query).password("password")
- .execute(new LookupAttemptingCallback());
+ DirContextOperations ctx = this.tested.authenticate()
+ .query(query)
+ .password("password")
+ .execute(new LookupAttemptingCallback());
assertThat(ctx).isNotNull();
assertThat(ctx.getStringAttribute("uid")).isEqualTo("some.person3");
@@ -126,7 +128,9 @@ public class DefaultLdapClientAuthenticationITests extends AbstractLdapTemplateI
public void testAuthenticateWithLdapQueryAndMapperAndInvalidPassword() {
LdapQuery query = LdapQueryBuilder.query().where("objectclass").is("person").and("uid").is("some.person3");
assertThatExceptionOfType(AuthenticationException.class).isThrownBy(() -> this.tested.authenticate()
- .query(query).password("invalidpassword").execute(new LookupAttemptingCallback()));
+ .query(query)
+ .password("invalidpassword")
+ .execute(new LookupAttemptingCallback()));
}
@Test
@@ -136,7 +140,7 @@ public class DefaultLdapClientAuthenticationITests extends AbstractLdapTemplateI
filter.and(new EqualsFilter("objectclass", "person")).and(new EqualsFilter("uid", "some.person3"));
LdapQuery query = LdapQueryBuilder.query().filter(filter);
assertThatExceptionOfType(AuthenticationException.class)
- .isThrownBy(() -> this.tested.authenticate().query(query).password("invalidpassword").execute());
+ .isThrownBy(() -> this.tested.authenticate().query(query).password("invalidpassword").execute());
}
@Test
@@ -144,10 +148,10 @@ public class DefaultLdapClientAuthenticationITests extends AbstractLdapTemplateI
public void testAuthenticateWithFilterThatDoesNotMatchAnything() {
AndFilter filter = new AndFilter();
filter.and(new EqualsFilter("objectclass", "person"))
- .and(new EqualsFilter("uid", "some.person.that.isnt.there"));
+ .and(new EqualsFilter("uid", "some.person.that.isnt.there"));
LdapQuery query = LdapQueryBuilder.query().filter(filter);
assertThatExceptionOfType(EmptyResultDataAccessException.class)
- .isThrownBy(() -> this.tested.authenticate().query(query).password("password").execute());
+ .isThrownBy(() -> this.tested.authenticate().query(query).password("password").execute());
}
@Test
@@ -157,7 +161,7 @@ public class DefaultLdapClientAuthenticationITests extends AbstractLdapTemplateI
filter.and(new EqualsFilter("objectclass", "person")).and(new EqualsFilter("cn", "Some Person"));
LdapQuery query = LdapQueryBuilder.query().filter(filter);
assertThatExceptionOfType(IncorrectResultSizeDataAccessException.class)
- .isThrownBy(() -> this.tested.authenticate().query(query).password("password").execute());
+ .isThrownBy(() -> this.tested.authenticate().query(query).password("password").execute());
}
@Test
diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/itest/DefaultLdapClientBindUnbindITests.java b/test/integration-tests/src/test/java/org/springframework/ldap/itest/DefaultLdapClientBindUnbindITests.java
index c4091bf9..daf7a9d8 100644
--- a/test/integration-tests/src/test/java/org/springframework/ldap/itest/DefaultLdapClientBindUnbindITests.java
+++ b/test/integration-tests/src/test/java/org/springframework/ldap/itest/DefaultLdapClientBindUnbindITests.java
@@ -158,7 +158,7 @@ public class DefaultLdapClientBindUnbindITests extends AbstractLdapTemplateInteg
private void verifyCleanup() {
assertThatExceptionOfType(NameNotFoundException.class).describedAs("NameNotFoundException expected")
- .isThrownBy(() -> this.tested.search().name(DN).toEntry());
+ .isThrownBy(() -> this.tested.search().name(DN).toEntry());
}
}
diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/itest/DefaultLdapClientListITests.java b/test/integration-tests/src/test/java/org/springframework/ldap/itest/DefaultLdapClientListITests.java
index 858fc70f..7cec0c21 100644
--- a/test/integration-tests/src/test/java/org/springframework/ldap/itest/DefaultLdapClientListITests.java
+++ b/test/integration-tests/src/test/java/org/springframework/ldap/itest/DefaultLdapClientListITests.java
@@ -73,7 +73,7 @@ public class DefaultLdapClientListITests extends AbstractLdapTemplateIntegration
this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES);
this.contextMapper.setExpectedValues(ALL_VALUES);
List list = this.tested.listBindings("ou=company2,ou=Sweden" + BASE_STRING)
- .toList(this.contextMapper);
+ .toList(this.contextMapper);
assertThat(list).hasSize(1);
}
diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/itest/DefaultLdapClientLookupITests.java b/test/integration-tests/src/test/java/org/springframework/ldap/itest/DefaultLdapClientLookupITests.java
index 60c9c344..93bc9e4b 100644
--- a/test/integration-tests/src/test/java/org/springframework/ldap/itest/DefaultLdapClientLookupITests.java
+++ b/test/integration-tests/src/test/java/org/springframework/ldap/itest/DefaultLdapClientLookupITests.java
@@ -82,8 +82,9 @@ public class DefaultLdapClientLookupITests extends AbstractLdapTemplateIntegrati
@Test
public void testLookup_AttributesMapper_LdapName() {
AttributesMapper mapper = new PersonAttributesMapper();
- Person person = this.tested.search().name(LdapUtils.newLdapName("cn=Some Person2, ou=company1,ou=Sweden"))
- .toObject(mapper);
+ Person person = this.tested.search()
+ .name(LdapUtils.newLdapName("cn=Some Person2, ou=company1,ou=Sweden"))
+ .toObject(mapper);
assertThat(person.getFullname()).isEqualTo("Some Person2");
assertThat(person.getLastname()).isEqualTo("Person2");
@@ -99,8 +100,8 @@ public class DefaultLdapClientLookupITests extends AbstractLdapTemplateIntegrati
AttributesMapper mapper = new SubsetPersonAttributesMapper();
Person person = this.tested.search()
- .query((builder) -> builder.base("cn=Some Person2, ou=company1,ou=Sweden").attributes("cn"))
- .toObject(mapper);
+ .query((builder) -> builder.base("cn=Some Person2, ou=company1,ou=Sweden").attributes("cn"))
+ .toObject(mapper);
assertThat(person.getFullname()).isEqualTo("Some Person2");
assertThat(person.getLastname()).as("lastName should not be set").isNull();
@@ -114,10 +115,10 @@ public class DefaultLdapClientLookupITests extends AbstractLdapTemplateIntegrati
@Test
public void testLookup_ReturnAttributes_AttributesMapper_LdapName() {
AttributesMapper mapper = new SubsetPersonAttributesMapper();
- Person person = this.tested
- .search().query((builder) -> builder
- .base(LdapUtils.newLdapName("cn=Some Person2, ou=company1,ou=Sweden")).attributes("cn"))
- .toObject(mapper);
+ Person person = this.tested.search()
+ .query((builder) -> builder.base(LdapUtils.newLdapName("cn=Some Person2, ou=company1,ou=Sweden"))
+ .attributes("cn"))
+ .toObject(mapper);
assertThat(person.getFullname()).isEqualTo("Some Person2");
assertThat(person.getLastname()).as("lastName should not be set").isNull();
@@ -148,8 +149,8 @@ public class DefaultLdapClientLookupITests extends AbstractLdapTemplateIntegrati
ContextMapper mapper = new PersonContextMapper();
Person person = this.tested.search()
- .query((builder) -> builder.base("cn=Some Person2, ou=company1,ou=Sweden").attributes("cn"))
- .toObject(mapper);
+ .query((builder) -> builder.base("cn=Some Person2, ou=company1,ou=Sweden").attributes("cn"))
+ .toObject(mapper);
assertThat(person.getFullname()).isEqualTo("Some Person2");
assertThat(person.getLastname()).as("lastName should not be set").isNull();
diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/itest/DefaultLdapClientLookupMultiRdnITests.java b/test/integration-tests/src/test/java/org/springframework/ldap/itest/DefaultLdapClientLookupMultiRdnITests.java
index ef4b7fb9..c8cb6eac 100644
--- a/test/integration-tests/src/test/java/org/springframework/ldap/itest/DefaultLdapClientLookupMultiRdnITests.java
+++ b/test/integration-tests/src/test/java/org/springframework/ldap/itest/DefaultLdapClientLookupMultiRdnITests.java
@@ -76,8 +76,9 @@ public class DefaultLdapClientLookupMultiRdnITests extends AbstractLdapTemplateI
@Test
@Category(NoAdTests.class)
public void testLookup_GetNameInNamespace_MultiRdn() {
- DirContextOperations result = this.tested.search().name("cn=Some Person+sn=Person,ou=company1,ou=Norway")
- .toEntry();
+ DirContextOperations result = this.tested.search()
+ .name("cn=Some Person+sn=Person,ou=company1,ou=Norway")
+ .toEntry();
assertThat(result.getDn().toString()).isEqualTo("cn=Some Person+sn=Person,ou=company1,ou=Norway");
assertThat(result.getNameInNamespace()).isEqualTo("cn=Some Person+sn=Person,ou=company1,ou=Norway," + base);
}
diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/itest/DefaultLdapClientRecursiveDeleteITests.java b/test/integration-tests/src/test/java/org/springframework/ldap/itest/DefaultLdapClientRecursiveDeleteITests.java
index 646b3ea5..179aae66 100644
--- a/test/integration-tests/src/test/java/org/springframework/ldap/itest/DefaultLdapClientRecursiveDeleteITests.java
+++ b/test/integration-tests/src/test/java/org/springframework/ldap/itest/DefaultLdapClientRecursiveDeleteITests.java
@@ -123,8 +123,8 @@ public class DefaultLdapClientRecursiveDeleteITests extends AbstractLdapTemplate
private void verifyDeleted(Name dn) {
assertThatExceptionOfType(NameNotFoundException.class)
- .describedAs("Expected entry '" + dn + "' to be non-existent")
- .isThrownBy(() -> this.tested.list(dn).toList(NameClassPair::getName));
+ .describedAs("Expected entry '" + dn + "' to be non-existent")
+ .isThrownBy(() -> this.tested.list(dn).toList(NameClassPair::getName));
}
}
diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/itest/DefaultLdapClientSearchResultITests.java b/test/integration-tests/src/test/java/org/springframework/ldap/itest/DefaultLdapClientSearchResultITests.java
index bf2bf6fa..8a1e98ba 100644
--- a/test/integration-tests/src/test/java/org/springframework/ldap/itest/DefaultLdapClientSearchResultITests.java
+++ b/test/integration-tests/src/test/java/org/springframework/ldap/itest/DefaultLdapClientSearchResultITests.java
@@ -106,9 +106,9 @@ public class DefaultLdapClientSearchResultITests extends AbstractLdapTemplateInt
this.attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES);
this.attributesMapper.setExpectedValues(ALL_VALUES);
- List list = this.tested.search().query(
- LdapQueryBuilder.query().base(BASE_STRING).where("objectclass").is("person").and("sn").is("Person2"))
- .toList(this.attributesMapper);
+ List list = this.tested.search()
+ .query(LdapQueryBuilder.query().base(BASE_STRING).where("objectclass").is("person").and("sn").is("Person2"))
+ .toList(this.attributesMapper);
assertThat(list).hasSize(1);
}
@@ -117,9 +117,10 @@ public class DefaultLdapClientSearchResultITests extends AbstractLdapTemplateInt
this.attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES);
this.attributesMapper.setExpectedValues(ALL_VALUES);
- List list = this.tested.search().query(
- LdapQueryBuilder.query().base(BASE_STRING).where("objectclass").is("person").and("sn").is("Person2"))
- .toStream(this.attributesMapper).collect(Collectors.toList());
+ List list = this.tested.search()
+ .query(LdapQueryBuilder.query().base(BASE_STRING).where("objectclass").is("person").and("sn").is("Person2"))
+ .toStream(this.attributesMapper)
+ .collect(Collectors.toList());
assertThat(list).hasSize(1);
}
@@ -128,8 +129,15 @@ public class DefaultLdapClientSearchResultITests extends AbstractLdapTemplateInt
this.attributesMapper.setExpectedAttributes(new String[] { "cn" });
this.attributesMapper.setExpectedValues(new String[] { "Some Person2" });
- List list = this.tested.search().query(LdapQueryBuilder.query().base(BASE_STRING).attributes("cn")
- .where("objectclass").is("person").and("sn").is("Person2")).toList(this.attributesMapper);
+ List list = this.tested.search()
+ .query(LdapQueryBuilder.query()
+ .base(BASE_STRING)
+ .attributes("cn")
+ .where("objectclass")
+ .is("person")
+ .and("sn")
+ .is("Person2"))
+ .toList(this.attributesMapper);
assertThat(list).hasSize(1);
}
@@ -138,10 +146,16 @@ public class DefaultLdapClientSearchResultITests extends AbstractLdapTemplateInt
this.attributesMapper.setExpectedAttributes(new String[] { "cn" });
this.attributesMapper.setExpectedValues(new String[] { "Some Person2" });
- List list = this.tested
- .search().query(LdapQueryBuilder.query().base(BASE_STRING).attributes("cn").where("objectclass")
- .is("person").and("sn").is("Person2"))
- .toStream(this.attributesMapper).collect(Collectors.toList());
+ List list = this.tested.search()
+ .query(LdapQueryBuilder.query()
+ .base(BASE_STRING)
+ .attributes("cn")
+ .where("objectclass")
+ .is("person")
+ .and("sn")
+ .is("Person2"))
+ .toStream(this.attributesMapper)
+ .collect(Collectors.toList());
assertThat(list).hasSize(1);
}
@@ -150,9 +164,15 @@ public class DefaultLdapClientSearchResultITests extends AbstractLdapTemplateInt
this.attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES);
this.attributesMapper.setExpectedValues(ALL_VALUES);
- List list = this.tested.search().query(LdapQueryBuilder.query().base(BASE_STRING)
- .searchScope(SearchScope.ONELEVEL).where("objectclass").is("person").and("sn").is("Person2"))
- .toList(this.attributesMapper);
+ List list = this.tested.search()
+ .query(LdapQueryBuilder.query()
+ .base(BASE_STRING)
+ .searchScope(SearchScope.ONELEVEL)
+ .where("objectclass")
+ .is("person")
+ .and("sn")
+ .is("Person2"))
+ .toList(this.attributesMapper);
assertThat(list).isEmpty();
}
@@ -162,9 +182,15 @@ public class DefaultLdapClientSearchResultITests extends AbstractLdapTemplateInt
this.attributesMapper.setExpectedValues(ALL_VALUES);
List list = this.tested.search()
- .query(LdapQueryBuilder.query().base(BASE_STRING).searchScope(SearchScope.ONELEVEL).where("objectclass")
- .is("person").and("sn").is("Person2"))
- .toStream(this.attributesMapper).collect(Collectors.toList());
+ .query(LdapQueryBuilder.query()
+ .base(BASE_STRING)
+ .searchScope(SearchScope.ONELEVEL)
+ .where("objectclass")
+ .is("person")
+ .and("sn")
+ .is("Person2"))
+ .toStream(this.attributesMapper)
+ .collect(Collectors.toList());
assertThat(list).isEmpty();
}
@@ -173,9 +199,15 @@ public class DefaultLdapClientSearchResultITests extends AbstractLdapTemplateInt
this.attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES);
this.attributesMapper.setExpectedValues(ALL_VALUES);
- List list = this.tested.search().query(LdapQueryBuilder.query().base("ou=company1,ou=Sweden")
- .searchScope(SearchScope.ONELEVEL).where("objectclass").is("person").and("sn").is("Person2"))
- .toList(this.attributesMapper);
+ List list = this.tested.search()
+ .query(LdapQueryBuilder.query()
+ .base("ou=company1,ou=Sweden")
+ .searchScope(SearchScope.ONELEVEL)
+ .where("objectclass")
+ .is("person")
+ .and("sn")
+ .is("Person2"))
+ .toList(this.attributesMapper);
assertThat(list).hasSize(1);
}
@@ -185,9 +217,15 @@ public class DefaultLdapClientSearchResultITests extends AbstractLdapTemplateInt
this.attributesMapper.setExpectedValues(ALL_VALUES);
List list = this.tested.search()
- .query(LdapQueryBuilder.query().base("ou=company1,ou=Sweden").searchScope(SearchScope.ONELEVEL)
- .where("objectclass").is("person").and("sn").is("Person2"))
- .toStream(this.attributesMapper).collect(Collectors.toList());
+ .query(LdapQueryBuilder.query()
+ .base("ou=company1,ou=Sweden")
+ .searchScope(SearchScope.ONELEVEL)
+ .where("objectclass")
+ .is("person")
+ .and("sn")
+ .is("Person2"))
+ .toStream(this.attributesMapper)
+ .collect(Collectors.toList());
assertThat(list).hasSize(1);
}
@@ -197,8 +235,8 @@ public class DefaultLdapClientSearchResultITests extends AbstractLdapTemplateInt
this.attributesMapper.setExpectedValues(ALL_VALUES);
List list = this.tested.search()
- .query(LdapQueryBuilder.query().where("objectclass").is("person").and("sn").is("Person2"))
- .toList(this.attributesMapper);
+ .query(LdapQueryBuilder.query().where("objectclass").is("person").and("sn").is("Person2"))
+ .toList(this.attributesMapper);
assertThat(list).hasSize(1);
}
@@ -208,8 +246,9 @@ public class DefaultLdapClientSearchResultITests extends AbstractLdapTemplateInt
this.attributesMapper.setExpectedValues(ALL_VALUES);
List list = this.tested.search()
- .query(LdapQueryBuilder.query().where("objectclass").is("person").and("sn").is("Person2"))
- .toStream(this.attributesMapper).collect(Collectors.toList());
+ .query(LdapQueryBuilder.query().where("objectclass").is("person").and("sn").is("Person2"))
+ .toStream(this.attributesMapper)
+ .collect(Collectors.toList());
assertThat(list).hasSize(1);
}
@@ -218,9 +257,9 @@ public class DefaultLdapClientSearchResultITests extends AbstractLdapTemplateInt
this.attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES);
this.attributesMapper.setExpectedValues(ALL_VALUES);
- List list = this.tested.search().query(
- LdapQueryBuilder.query().base("ou=Norway").where("objectclass").is("person").and("sn").is("Person2"))
- .toList(this.attributesMapper);
+ List list = this.tested.search()
+ .query(LdapQueryBuilder.query().base("ou=Norway").where("objectclass").is("person").and("sn").is("Person2"))
+ .toList(this.attributesMapper);
assertThat(list).isEmpty();
}
@@ -229,9 +268,10 @@ public class DefaultLdapClientSearchResultITests extends AbstractLdapTemplateInt
this.attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES);
this.attributesMapper.setExpectedValues(ALL_VALUES);
- List list = this.tested.search().query(
- LdapQueryBuilder.query().base("ou=Norway").where("objectclass").is("person").and("sn").is("Person2"))
- .toStream(this.attributesMapper).collect(Collectors.toList());
+ List list = this.tested.search()
+ .query(LdapQueryBuilder.query().base("ou=Norway").where("objectclass").is("person").and("sn").is("Person2"))
+ .toStream(this.attributesMapper)
+ .collect(Collectors.toList());
assertThat(list).isEmpty();
}
@@ -239,9 +279,9 @@ public class DefaultLdapClientSearchResultITests extends AbstractLdapTemplateInt
public void testSearch_SearchScope_AttributesMapper() {
this.attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES);
this.attributesMapper.setExpectedValues(ALL_VALUES);
- List list = this.tested.search().query(
- LdapQueryBuilder.query().base(BASE_STRING).searchScope(SearchScope.SUBTREE).filter(FILTER_STRING))
- .toList(this.attributesMapper);
+ List list = this.tested.search()
+ .query(LdapQueryBuilder.query().base(BASE_STRING).searchScope(SearchScope.SUBTREE).filter(FILTER_STRING))
+ .toList(this.attributesMapper);
assertThat(list).hasSize(1);
}
@@ -250,9 +290,13 @@ public class DefaultLdapClientSearchResultITests extends AbstractLdapTemplateInt
this.attributesMapper.setExpectedAttributes(CN_SN_ATTRS);
this.attributesMapper.setExpectedValues(CN_SN_VALUES);
this.attributesMapper.setAbsentAttributes(ABSENT_ATTRIBUTES);
- List list = this.tested.search().query(LdapQueryBuilder.query().base(BASE_STRING)
- .searchScope(SearchScope.SUBTREE).attributes(CN_SN_ATTRS).filter(FILTER_STRING))
- .toList(this.attributesMapper);
+ List list = this.tested.search()
+ .query(LdapQueryBuilder.query()
+ .base(BASE_STRING)
+ .searchScope(SearchScope.SUBTREE)
+ .attributes(CN_SN_ATTRS)
+ .filter(FILTER_STRING))
+ .toList(this.attributesMapper);
assertThat(list).hasSize(1);
}
@@ -260,8 +304,9 @@ public class DefaultLdapClientSearchResultITests extends AbstractLdapTemplateInt
public void testSearch_AttributesMapper_Name() {
this.attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES);
this.attributesMapper.setExpectedValues(ALL_VALUES);
- List list = this.tested.search().query(LdapQueryBuilder.query().base(BASE_NAME).filter(FILTER_STRING))
- .toList(this.attributesMapper);
+ List list = this.tested.search()
+ .query(LdapQueryBuilder.query().base(BASE_NAME).filter(FILTER_STRING))
+ .toList(this.attributesMapper);
assertThat(list).hasSize(1);
}
@@ -270,8 +315,8 @@ public class DefaultLdapClientSearchResultITests extends AbstractLdapTemplateInt
this.attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES);
this.attributesMapper.setExpectedValues(ALL_VALUES);
List list = this.tested.search()
- .query(LdapQueryBuilder.query().base(BASE_NAME).searchScope(SearchScope.SUBTREE).filter(FILTER_STRING))
- .toList(this.attributesMapper);
+ .query(LdapQueryBuilder.query().base(BASE_NAME).searchScope(SearchScope.SUBTREE).filter(FILTER_STRING))
+ .toList(this.attributesMapper);
assertThat(list).hasSize(1);
}
@@ -280,9 +325,13 @@ public class DefaultLdapClientSearchResultITests extends AbstractLdapTemplateInt
this.attributesMapper.setExpectedAttributes(CN_SN_ATTRS);
this.attributesMapper.setExpectedValues(CN_SN_VALUES);
this.attributesMapper.setAbsentAttributes(ABSENT_ATTRIBUTES);
- List list = this.tested.search().query(LdapQueryBuilder.query().base(BASE_NAME)
- .searchScope(SearchScope.SUBTREE).attributes(CN_SN_ATTRS).filter(FILTER_STRING))
- .toList(this.attributesMapper);
+ List list = this.tested.search()
+ .query(LdapQueryBuilder.query()
+ .base(BASE_NAME)
+ .searchScope(SearchScope.SUBTREE)
+ .attributes(CN_SN_ATTRS)
+ .filter(FILTER_STRING))
+ .toList(this.attributesMapper);
assertThat(list).hasSize(1);
}
@@ -291,7 +340,8 @@ public class DefaultLdapClientSearchResultITests extends AbstractLdapTemplateInt
this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES);
this.contextMapper.setExpectedValues(ALL_VALUES);
List list = this.tested.search()
- .query(LdapQueryBuilder.query().base(BASE_STRING).filter(FILTER_STRING)).toList(this.contextMapper);
+ .query(LdapQueryBuilder.query().base(BASE_STRING).filter(FILTER_STRING))
+ .toList(this.contextMapper);
assertThat(list).hasSize(1);
}
@@ -300,21 +350,25 @@ public class DefaultLdapClientSearchResultITests extends AbstractLdapTemplateInt
this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES);
this.contextMapper.setExpectedValues(ALL_VALUES);
DirContextAdapter result = this.tested.search()
- .query(LdapQueryBuilder.query().base(BASE_STRING).filter(FILTER_STRING)).toObject(this.contextMapper);
+ .query(LdapQueryBuilder.query().base(BASE_STRING).filter(FILTER_STRING))
+ .toObject(this.contextMapper);
assertThat(result).isNotNull();
}
@Test(expected = IncorrectResultSizeDataAccessException.class)
public void testSearchForObjectWithMultipleHits() {
- this.tested.search().query(LdapQueryBuilder.query().base(BASE_STRING).filter("(&(objectclass=person)(sn=*))"))
- .toObject((Object ctx) -> ctx);
+ this.tested.search()
+ .query(LdapQueryBuilder.query().base(BASE_STRING).filter("(&(objectclass=person)(sn=*))"))
+ .toObject((Object ctx) -> ctx);
}
@Test // (expected = EmptyResultDataAccessException.class)
public void testSearchForObjectNoHits() {
- Object result = this.tested.search().query(
- LdapQueryBuilder.query().base(BASE_STRING).filter("(&(objectclass=person)(sn=Person does not exist))"))
- .toObject((Object ctx) -> ctx);
+ Object result = this.tested.search()
+ .query(LdapQueryBuilder.query()
+ .base(BASE_STRING)
+ .filter("(&(objectclass=person)(sn=Person does not exist))"))
+ .toObject((Object ctx) -> ctx);
assertThat(result).isNull();
}
@@ -322,9 +376,9 @@ public class DefaultLdapClientSearchResultITests extends AbstractLdapTemplateInt
public void testSearch_SearchScope_ContextMapper() {
this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES);
this.contextMapper.setExpectedValues(ALL_VALUES);
- List list = this.tested.search().query(
- LdapQueryBuilder.query().base(BASE_STRING).searchScope(SearchScope.SUBTREE).filter(FILTER_STRING))
- .toList(this.contextMapper);
+ List list = this.tested.search()
+ .query(LdapQueryBuilder.query().base(BASE_STRING).searchScope(SearchScope.SUBTREE).filter(FILTER_STRING))
+ .toList(this.contextMapper);
assertThat(list).hasSize(1);
}
@@ -333,9 +387,13 @@ public class DefaultLdapClientSearchResultITests extends AbstractLdapTemplateInt
this.contextMapper.setExpectedAttributes(CN_SN_ATTRS);
this.contextMapper.setExpectedValues(CN_SN_VALUES);
this.contextMapper.setAbsentAttributes(ABSENT_ATTRIBUTES);
- List list = this.tested.search().query(LdapQueryBuilder.query().base(BASE_STRING)
- .searchScope(SearchScope.SUBTREE).attributes(CN_SN_ATTRS).filter(FILTER_STRING))
- .toList(this.contextMapper);
+ List list = this.tested.search()
+ .query(LdapQueryBuilder.query()
+ .base(BASE_STRING)
+ .searchScope(SearchScope.SUBTREE)
+ .attributes(CN_SN_ATTRS)
+ .filter(FILTER_STRING))
+ .toList(this.contextMapper);
assertThat(list).hasSize(1);
}
@@ -344,7 +402,8 @@ public class DefaultLdapClientSearchResultITests extends AbstractLdapTemplateInt
this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES);
this.contextMapper.setExpectedValues(ALL_VALUES);
List list = this.tested.search()
- .query(LdapQueryBuilder.query().base(BASE_NAME).filter(FILTER_STRING)).toList(this.contextMapper);
+ .query(LdapQueryBuilder.query().base(BASE_NAME).filter(FILTER_STRING))
+ .toList(this.contextMapper);
assertThat(list).hasSize(1);
}
@@ -352,9 +411,9 @@ public class DefaultLdapClientSearchResultITests extends AbstractLdapTemplateInt
public void testSearch_ContextMapper_LdapQuery() {
this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES);
this.contextMapper.setExpectedValues(ALL_VALUES);
- List list = this.tested.search().query(
- LdapQueryBuilder.query().base(BASE_NAME).where("objectclass").is("person").and("sn").is("Person2"))
- .toList(this.contextMapper);
+ List list = this.tested.search()
+ .query(LdapQueryBuilder.query().base(BASE_NAME).where("objectclass").is("person").and("sn").is("Person2"))
+ .toList(this.contextMapper);
assertThat(list).hasSize(1);
}
@@ -362,9 +421,10 @@ public class DefaultLdapClientSearchResultITests extends AbstractLdapTemplateInt
public void testSearchForStream_ContextMapper_LdapQuery() {
this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES);
this.contextMapper.setExpectedValues(ALL_VALUES);
- List list = this.tested.search().query(
- LdapQueryBuilder.query().base(BASE_NAME).where("objectclass").is("person").and("sn").is("Person2"))
- .toStream(this.contextMapper).collect(Collectors.toList());
+ List list = this.tested.search()
+ .query(LdapQueryBuilder.query().base(BASE_NAME).where("objectclass").is("person").and("sn").is("Person2"))
+ .toStream(this.contextMapper)
+ .collect(Collectors.toList());
assertThat(list).hasSize(1);
}
@@ -373,8 +433,8 @@ public class DefaultLdapClientSearchResultITests extends AbstractLdapTemplateInt
this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES);
this.contextMapper.setExpectedValues(ALL_VALUES);
List list = this.tested.search()
- .query(LdapQueryBuilder.query().where("objectclass").is("person").and("sn").is("Person2"))
- .toList(this.contextMapper);
+ .query(LdapQueryBuilder.query().where("objectclass").is("person").and("sn").is("Person2"))
+ .toList(this.contextMapper);
assertThat(list).hasSize(1);
}
@@ -383,8 +443,9 @@ public class DefaultLdapClientSearchResultITests extends AbstractLdapTemplateInt
this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES);
this.contextMapper.setExpectedValues(ALL_VALUES);
List list = this.tested.search()
- .query(LdapQueryBuilder.query().where("objectclass").is("person").and("sn").is("Person2"))
- .toStream(this.contextMapper).collect(Collectors.toList());
+ .query(LdapQueryBuilder.query().where("objectclass").is("person").and("sn").is("Person2"))
+ .toStream(this.contextMapper)
+ .collect(Collectors.toList());
assertThat(list).hasSize(1);
}
@@ -392,9 +453,15 @@ public class DefaultLdapClientSearchResultITests extends AbstractLdapTemplateInt
public void testSearch_ContextMapper_LdapQuery_SearchScope() {
this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES);
this.contextMapper.setExpectedValues(ALL_VALUES);
- List list = this.tested.search().query(LdapQueryBuilder.query().base(BASE_NAME)
- .searchScope(SearchScope.ONELEVEL).where("objectclass").is("person").and("sn").is("Person2"))
- .toList(this.contextMapper);
+ List list = this.tested.search()
+ .query(LdapQueryBuilder.query()
+ .base(BASE_NAME)
+ .searchScope(SearchScope.ONELEVEL)
+ .where("objectclass")
+ .is("person")
+ .and("sn")
+ .is("Person2"))
+ .toList(this.contextMapper);
assertThat(list).isEmpty();
}
@@ -403,9 +470,15 @@ public class DefaultLdapClientSearchResultITests extends AbstractLdapTemplateInt
this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES);
this.contextMapper.setExpectedValues(ALL_VALUES);
List list = this.tested.search()
- .query(LdapQueryBuilder.query().base(BASE_NAME).searchScope(SearchScope.ONELEVEL).where("objectclass")
- .is("person").and("sn").is("Person2"))
- .toStream(this.contextMapper).collect(Collectors.toList());
+ .query(LdapQueryBuilder.query()
+ .base(BASE_NAME)
+ .searchScope(SearchScope.ONELEVEL)
+ .where("objectclass")
+ .is("person")
+ .and("sn")
+ .is("Person2"))
+ .toStream(this.contextMapper)
+ .collect(Collectors.toList());
assertThat(list).isEmpty();
}
@@ -413,9 +486,15 @@ public class DefaultLdapClientSearchResultITests extends AbstractLdapTemplateInt
public void testSearch_ContextMapper_LdapQuery_SearchScope_CorrectBase() {
this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES);
this.contextMapper.setExpectedValues(ALL_VALUES);
- List list = this.tested.search().query(LdapQueryBuilder.query().base("ou=company1,ou=Sweden")
- .searchScope(SearchScope.ONELEVEL).where("objectclass").is("person").and("sn").is("Person2"))
- .toList(this.contextMapper);
+ List list = this.tested.search()
+ .query(LdapQueryBuilder.query()
+ .base("ou=company1,ou=Sweden")
+ .searchScope(SearchScope.ONELEVEL)
+ .where("objectclass")
+ .is("person")
+ .and("sn")
+ .is("Person2"))
+ .toList(this.contextMapper);
assertThat(list).hasSize(1);
}
@@ -424,9 +503,15 @@ public class DefaultLdapClientSearchResultITests extends AbstractLdapTemplateInt
this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES);
this.contextMapper.setExpectedValues(ALL_VALUES);
List list = this.tested.search()
- .query(LdapQueryBuilder.query().base("ou=company1,ou=Sweden").searchScope(SearchScope.ONELEVEL)
- .where("objectclass").is("person").and("sn").is("Person2"))
- .toStream(this.contextMapper).collect(Collectors.toList());
+ .query(LdapQueryBuilder.query()
+ .base("ou=company1,ou=Sweden")
+ .searchScope(SearchScope.ONELEVEL)
+ .where("objectclass")
+ .is("person")
+ .and("sn")
+ .is("Person2"))
+ .toStream(this.contextMapper)
+ .collect(Collectors.toList());
assertThat(list).hasSize(1);
}
@@ -434,16 +519,22 @@ public class DefaultLdapClientSearchResultITests extends AbstractLdapTemplateInt
public void testSearchForContext_LdapQuery() {
ContextMapper mapper = (result) -> (DirContextOperations) result;
DirContextOperations result = this.tested.search()
- .query(LdapQueryBuilder.query().where("objectclass").is("person").and("sn").is("Person2"))
- .toObject(mapper);
+ .query(LdapQueryBuilder.query().where("objectclass").is("person").and("sn").is("Person2"))
+ .toObject(mapper);
assertThat(result).isNotNull();
assertThat(result.getStringAttribute("sn")).isEqualTo("Person2");
}
@Test // (expected = EmptyResultDataAccessException.class)
public void testSearchForContext_LdapQuery_SearchScopeNotFound() {
- Object result = this.tested.search().query(LdapQueryBuilder.query().searchScope(SearchScope.ONELEVEL)
- .where("objectclass").is("person").and("sn").is("Person2")).toObject(this.attributesMapper);
+ Object result = this.tested.search()
+ .query(LdapQueryBuilder.query()
+ .searchScope(SearchScope.ONELEVEL)
+ .where("objectclass")
+ .is("person")
+ .and("sn")
+ .is("Person2"))
+ .toObject(this.attributesMapper);
assertThat(result).isNull();
}
@@ -451,9 +542,14 @@ public class DefaultLdapClientSearchResultITests extends AbstractLdapTemplateInt
public void testSearchForContext_LdapQuery_SearchScope_CorrectBase() {
ContextMapper mapper = (result) -> (DirContextOperations) result;
DirContextOperations result = this.tested.search()
- .query(LdapQueryBuilder.query().searchScope(SearchScope.ONELEVEL).base("ou=company1,ou=Sweden")
- .where("objectclass").is("person").and("sn").is("Person2"))
- .toObject(mapper);
+ .query(LdapQueryBuilder.query()
+ .searchScope(SearchScope.ONELEVEL)
+ .base("ou=company1,ou=Sweden")
+ .where("objectclass")
+ .is("person")
+ .and("sn")
+ .is("Person2"))
+ .toObject(mapper);
assertThat(result).isNotNull();
assertThat(result.getStringAttribute("sn")).isEqualTo("Person2");
@@ -464,8 +560,8 @@ public class DefaultLdapClientSearchResultITests extends AbstractLdapTemplateInt
this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES);
this.contextMapper.setExpectedValues(ALL_VALUES);
List list = this.tested.search()
- .query(LdapQueryBuilder.query().base(BASE_NAME).searchScope(SearchScope.SUBTREE).filter(FILTER_STRING))
- .toList(this.contextMapper);
+ .query(LdapQueryBuilder.query().base(BASE_NAME).searchScope(SearchScope.SUBTREE).filter(FILTER_STRING))
+ .toList(this.contextMapper);
assertThat(list).hasSize(1);
}
@@ -474,19 +570,26 @@ public class DefaultLdapClientSearchResultITests extends AbstractLdapTemplateInt
this.contextMapper.setExpectedAttributes(CN_SN_ATTRS);
this.contextMapper.setExpectedValues(CN_SN_VALUES);
this.contextMapper.setAbsentAttributes(ABSENT_ATTRIBUTES);
- List list = this.tested.search().query(LdapQueryBuilder.query().base(BASE_NAME)
- .searchScope(SearchScope.SUBTREE).attributes(CN_SN_ATTRS).filter(FILTER_STRING))
- .toList(this.contextMapper);
+ List list = this.tested.search()
+ .query(LdapQueryBuilder.query()
+ .base(BASE_NAME)
+ .searchScope(SearchScope.SUBTREE)
+ .attributes(CN_SN_ATTRS)
+ .filter(FILTER_STRING))
+ .toList(this.contextMapper);
assertThat(list).hasSize(1);
}
@Test
public void testSearchWithInvalidSearchBaseShouldByDefaultThrowException() {
try {
- this.tested
- .search().query(LdapQueryBuilder.query().base(BASE_NAME + "ou=unknown")
- .searchScope(SearchScope.SUBTREE).attributes(CN_SN_ATTRS).filter(FILTER_STRING))
- .toObject(this.contextMapper);
+ this.tested.search()
+ .query(LdapQueryBuilder.query()
+ .base(BASE_NAME + "ou=unknown")
+ .searchScope(SearchScope.SUBTREE)
+ .attributes(CN_SN_ATTRS)
+ .filter(FILTER_STRING))
+ .toObject(this.contextMapper);
fail("NameNotFoundException expected");
}
catch (NameNotFoundException expected) {
@@ -501,17 +604,20 @@ public class DefaultLdapClientSearchResultITests extends AbstractLdapTemplateInt
this.contextMapper.setExpectedValues(CN_SN_VALUES);
this.contextMapper.setAbsentAttributes(ABSENT_ATTRIBUTES);
List list = this.tested.search()
- .query(LdapQueryBuilder.query().base(BASE_NAME + "ou=unknown").searchScope(SearchScope.SUBTREE)
- .attributes(CN_SN_ATTRS).filter(FILTER_STRING))
- .toList(this.contextMapper);
+ .query(LdapQueryBuilder.query()
+ .base(BASE_NAME + "ou=unknown")
+ .searchScope(SearchScope.SUBTREE)
+ .attributes(CN_SN_ATTRS)
+ .filter(FILTER_STRING))
+ .toList(this.contextMapper);
assertThat(list).isEmpty();
}
@Test
public void verifyThatSearchWithCountLimitReturnsTheEntriesFoundSoFar() {
List result = this.tested.search()
- .query(LdapQueryBuilder.query().countLimit(3).where("objectclass").is("person"))
- .toList((Object ctx) -> new Object());
+ .query(LdapQueryBuilder.query().countLimit(3).where("objectclass").is("person"))
+ .toList((Object ctx) -> new Object());
assertThat(result).hasSize(3);
}
@@ -519,8 +625,9 @@ public class DefaultLdapClientSearchResultITests extends AbstractLdapTemplateInt
@Test(expected = SizeLimitExceededException.class)
public void verifyThatSearchWithCountLimitWithFlagToFalseThrowsException() {
ReflectionTestUtils.setField(this.tested, "ignoreSizeLimitExceededException", false);
- this.tested.search().query(LdapQueryBuilder.query().countLimit(3).where("objectclass").is("person"))
- .toList((Object ctx) -> ctx);
+ this.tested.search()
+ .query(LdapQueryBuilder.query().countLimit(3).where("objectclass").is("person"))
+ .toList((Object ctx) -> ctx);
}
}
diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateAuthenticationITests.java b/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateAuthenticationITests.java
index 7ea12c3f..efde93ab 100644
--- a/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateAuthenticationITests.java
+++ b/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateAuthenticationITests.java
@@ -134,9 +134,11 @@ public class LdapTemplateAuthenticationITests extends AbstractLdapTemplateIntegr
final Exception error = errorCallback.getError();
assertThat(error).as("collected error should not be null").isNotNull();
assertThat(error instanceof AuthenticationException)
- .as("expected org.springframework.ldap.AuthenticationException").isTrue();
+ .as("expected org.springframework.ldap.AuthenticationException")
+ .isTrue();
assertThat(error.getCause() instanceof javax.naming.AuthenticationException)
- .as("expected javax.naming.AuthenticationException").isTrue();
+ .as("expected javax.naming.AuthenticationException")
+ .isTrue();
}
@Test
@@ -144,7 +146,7 @@ public class LdapTemplateAuthenticationITests extends AbstractLdapTemplateIntegr
public void testAuthenticateWithFilterThatDoesNotMatchAnything() {
AndFilter filter = new AndFilter();
filter.and(new EqualsFilter("objectclass", "person"))
- .and(new EqualsFilter("uid", "some.person.that.isnt.there"));
+ .and(new EqualsFilter("uid", "some.person.that.isnt.there"));
assertThat(this.tested.authenticate("", filter.toString(), "password")).isFalse();
}
diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateLookupMultiRdnITests.java b/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateLookupMultiRdnITests.java
index 42c9554f..4801c65d 100644
--- a/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateLookupMultiRdnITests.java
+++ b/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateLookupMultiRdnITests.java
@@ -69,7 +69,7 @@ public class LdapTemplateLookupMultiRdnITests extends AbstractLdapTemplateIntegr
@Category(NoAdTests.class)
public void testLookup_MultiValuedRdn_DirContextAdapter() {
DirContextAdapter result = (DirContextAdapter) this.tested
- .lookup("cn=Some Person+sn=Person, ou=company1,ou=Norway");
+ .lookup("cn=Some Person+sn=Person, ou=company1,ou=Norway");
assertThat(result.getStringAttribute("cn")).isEqualTo("Some Person");
assertThat(result.getStringAttribute("sn")).isEqualTo("Person");
@@ -80,7 +80,7 @@ public class LdapTemplateLookupMultiRdnITests extends AbstractLdapTemplateIntegr
@Category(NoAdTests.class)
public void testLookup_GetNameInNamespace_MultiRdn() {
DirContextAdapter result = (DirContextAdapter) this.tested
- .lookup("cn=Some Person+sn=Person,ou=company1,ou=Norway");
+ .lookup("cn=Some Person+sn=Person,ou=company1,ou=Norway");
assertThat(result.getDn().toString()).isEqualTo("cn=Some Person+sn=Person,ou=company1,ou=Norway");
assertThat(result.getNameInNamespace()).isEqualTo("cn=Some Person+sn=Person,ou=company1,ou=Norway," + base);
diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateNoBaseSuffixITests.java b/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateNoBaseSuffixITests.java
index 51eb20a9..3ef778cd 100644
--- a/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateNoBaseSuffixITests.java
+++ b/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateNoBaseSuffixITests.java
@@ -87,7 +87,7 @@ public class LdapTemplateNoBaseSuffixITests extends AbstractLdapTemplateIntegrat
this.tested.bind("cn=Some Person4, ou=company1, ou=Sweden," + base, adapter, null);
DirContextAdapter result = (DirContextAdapter) this.tested
- .lookup("cn=Some Person4, ou=company1, ou=Sweden," + base);
+ .lookup("cn=Some Person4, ou=company1, ou=Sweden," + base);
assertThat(result.getStringAttribute("cn")).isEqualTo("Some Person4");
assertThat(result.getStringAttribute("sn")).isEqualTo("Person4");
diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateSearchResultITests.java b/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateSearchResultITests.java
index 7f7dcd55..61cd253f 100644
--- a/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateSearchResultITests.java
+++ b/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateSearchResultITests.java
@@ -121,7 +121,8 @@ public class LdapTemplateSearchResultITests extends AbstractLdapTemplateIntegrat
List list = this.tested.searchForStream(
LdapQueryBuilder.query().base(BASE_STRING).where("objectclass").is("person").and("sn").is("Person2"),
- this.attributesMapper).collect(Collectors.toList());
+ this.attributesMapper)
+ .collect(Collectors.toList());
assertThat(list).hasSize(1);
}
@@ -130,8 +131,13 @@ public class LdapTemplateSearchResultITests extends AbstractLdapTemplateIntegrat
this.attributesMapper.setExpectedAttributes(new String[] { "cn" });
this.attributesMapper.setExpectedValues(new String[] { "Some Person2" });
- List list = this.tested.search(LdapQueryBuilder.query().base(BASE_STRING).attributes("cn")
- .where("objectclass").is("person").and("sn").is("Person2"), this.attributesMapper);
+ List list = this.tested.search(LdapQueryBuilder.query()
+ .base(BASE_STRING)
+ .attributes("cn")
+ .where("objectclass")
+ .is("person")
+ .and("sn")
+ .is("Person2"), this.attributesMapper);
assertThat(list).hasSize(1);
}
@@ -140,9 +146,15 @@ public class LdapTemplateSearchResultITests extends AbstractLdapTemplateIntegrat
this.attributesMapper.setExpectedAttributes(new String[] { "cn" });
this.attributesMapper.setExpectedValues(new String[] { "Some Person2" });
- List list = this.tested.searchForStream(LdapQueryBuilder.query().base(BASE_STRING).attributes("cn")
- .where("objectclass").is("person").and("sn").is("Person2"), this.attributesMapper)
- .collect(Collectors.toList());
+ List list = this.tested
+ .searchForStream(LdapQueryBuilder.query()
+ .base(BASE_STRING)
+ .attributes("cn")
+ .where("objectclass")
+ .is("person")
+ .and("sn")
+ .is("Person2"), this.attributesMapper)
+ .collect(Collectors.toList());
assertThat(list).hasSize(1);
}
@@ -151,9 +163,13 @@ public class LdapTemplateSearchResultITests extends AbstractLdapTemplateIntegrat
this.attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES);
this.attributesMapper.setExpectedValues(ALL_VALUES);
- List list = this.tested.search(LdapQueryBuilder.query().base(BASE_STRING)
- .searchScope(SearchScope.ONELEVEL).where("objectclass").is("person").and("sn").is("Person2"),
- this.attributesMapper);
+ List list = this.tested.search(LdapQueryBuilder.query()
+ .base(BASE_STRING)
+ .searchScope(SearchScope.ONELEVEL)
+ .where("objectclass")
+ .is("person")
+ .and("sn")
+ .is("Person2"), this.attributesMapper);
assertThat(list).isEmpty();
}
@@ -163,9 +179,14 @@ public class LdapTemplateSearchResultITests extends AbstractLdapTemplateIntegrat
this.attributesMapper.setExpectedValues(ALL_VALUES);
List list = this.tested
- .searchForStream(LdapQueryBuilder.query().base(BASE_STRING).searchScope(SearchScope.ONELEVEL)
- .where("objectclass").is("person").and("sn").is("Person2"), this.attributesMapper)
- .collect(Collectors.toList());
+ .searchForStream(LdapQueryBuilder.query()
+ .base(BASE_STRING)
+ .searchScope(SearchScope.ONELEVEL)
+ .where("objectclass")
+ .is("person")
+ .and("sn")
+ .is("Person2"), this.attributesMapper)
+ .collect(Collectors.toList());
assertThat(list).isEmpty();
}
@@ -174,9 +195,13 @@ public class LdapTemplateSearchResultITests extends AbstractLdapTemplateIntegrat
this.attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES);
this.attributesMapper.setExpectedValues(ALL_VALUES);
- List list = this.tested.search(LdapQueryBuilder.query().base("ou=company1,ou=Sweden")
- .searchScope(SearchScope.ONELEVEL).where("objectclass").is("person").and("sn").is("Person2"),
- this.attributesMapper);
+ List list = this.tested.search(LdapQueryBuilder.query()
+ .base("ou=company1,ou=Sweden")
+ .searchScope(SearchScope.ONELEVEL)
+ .where("objectclass")
+ .is("person")
+ .and("sn")
+ .is("Person2"), this.attributesMapper);
assertThat(list).hasSize(1);
}
@@ -185,9 +210,15 @@ public class LdapTemplateSearchResultITests extends AbstractLdapTemplateIntegrat
this.attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES);
this.attributesMapper.setExpectedValues(ALL_VALUES);
- List list = this.tested.searchForStream(LdapQueryBuilder.query().base("ou=company1,ou=Sweden")
- .searchScope(SearchScope.ONELEVEL).where("objectclass").is("person").and("sn").is("Person2"),
- this.attributesMapper).collect(Collectors.toList());
+ List list = this.tested
+ .searchForStream(LdapQueryBuilder.query()
+ .base("ou=company1,ou=Sweden")
+ .searchScope(SearchScope.ONELEVEL)
+ .where("objectclass")
+ .is("person")
+ .and("sn")
+ .is("Person2"), this.attributesMapper)
+ .collect(Collectors.toList());
assertThat(list).hasSize(1);
}
@@ -208,9 +239,9 @@ public class LdapTemplateSearchResultITests extends AbstractLdapTemplateIntegrat
this.attributesMapper.setExpectedValues(ALL_VALUES);
List list = this.tested
- .searchForStream(LdapQueryBuilder.query().where("objectclass").is("person").and("sn").is("Person2"),
- this.attributesMapper)
- .collect(Collectors.toList());
+ .searchForStream(LdapQueryBuilder.query().where("objectclass").is("person").and("sn").is("Person2"),
+ this.attributesMapper)
+ .collect(Collectors.toList());
assertThat(list).hasSize(1);
}
@@ -232,7 +263,8 @@ public class LdapTemplateSearchResultITests extends AbstractLdapTemplateIntegrat
List list = this.tested.searchForStream(
LdapQueryBuilder.query().base("ou=Norway").where("objectclass").is("person").and("sn").is("Person2"),
- this.attributesMapper).collect(Collectors.toList());
+ this.attributesMapper)
+ .collect(Collectors.toList());
assertThat(list).isEmpty();
}
@@ -358,9 +390,11 @@ public class LdapTemplateSearchResultITests extends AbstractLdapTemplateIntegrat
public void testSearchForStream_ContextMapper_LdapQuery() {
this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES);
this.contextMapper.setExpectedValues(ALL_VALUES);
- List list = this.tested.searchForStream(
- LdapQueryBuilder.query().base(BASE_NAME).where("objectclass").is("person").and("sn").is("Person2"),
- this.contextMapper).collect(Collectors.toList());
+ List list = this.tested
+ .searchForStream(
+ LdapQueryBuilder.query().base(BASE_NAME).where("objectclass").is("person").and("sn").is("Person2"),
+ this.contextMapper)
+ .collect(Collectors.toList());
assertThat(list).hasSize(1);
}
@@ -378,9 +412,9 @@ public class LdapTemplateSearchResultITests extends AbstractLdapTemplateIntegrat
this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES);
this.contextMapper.setExpectedValues(ALL_VALUES);
List list = this.tested
- .searchForStream(LdapQueryBuilder.query().where("objectclass").is("person").and("sn").is("Person2"),
- this.contextMapper)
- .collect(Collectors.toList());
+ .searchForStream(LdapQueryBuilder.query().where("objectclass").is("person").and("sn").is("Person2"),
+ this.contextMapper)
+ .collect(Collectors.toList());
assertThat(list).hasSize(1);
}
@@ -388,9 +422,13 @@ public class LdapTemplateSearchResultITests extends AbstractLdapTemplateIntegrat
public void testSearch_ContextMapper_LdapQuery_SearchScope() {
this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES);
this.contextMapper.setExpectedValues(ALL_VALUES);
- List list = this.tested.search(LdapQueryBuilder.query().base(BASE_NAME)
- .searchScope(SearchScope.ONELEVEL).where("objectclass").is("person").and("sn").is("Person2"),
- this.contextMapper);
+ List list = this.tested.search(LdapQueryBuilder.query()
+ .base(BASE_NAME)
+ .searchScope(SearchScope.ONELEVEL)
+ .where("objectclass")
+ .is("person")
+ .and("sn")
+ .is("Person2"), this.contextMapper);
assertThat(list).isEmpty();
}
@@ -399,9 +437,14 @@ public class LdapTemplateSearchResultITests extends AbstractLdapTemplateIntegrat
this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES);
this.contextMapper.setExpectedValues(ALL_VALUES);
List list = this.tested
- .searchForStream(LdapQueryBuilder.query().base(BASE_NAME).searchScope(SearchScope.ONELEVEL)
- .where("objectclass").is("person").and("sn").is("Person2"), this.contextMapper)
- .collect(Collectors.toList());
+ .searchForStream(LdapQueryBuilder.query()
+ .base(BASE_NAME)
+ .searchScope(SearchScope.ONELEVEL)
+ .where("objectclass")
+ .is("person")
+ .and("sn")
+ .is("Person2"), this.contextMapper)
+ .collect(Collectors.toList());
assertThat(list).isEmpty();
}
@@ -409,9 +452,13 @@ public class LdapTemplateSearchResultITests extends AbstractLdapTemplateIntegrat
public void testSearch_ContextMapper_LdapQuery_SearchScope_CorrectBase() {
this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES);
this.contextMapper.setExpectedValues(ALL_VALUES);
- List list = this.tested.search(LdapQueryBuilder.query().base("ou=company1,ou=Sweden")
- .searchScope(SearchScope.ONELEVEL).where("objectclass").is("person").and("sn").is("Person2"),
- this.contextMapper);
+ List list = this.tested.search(LdapQueryBuilder.query()
+ .base("ou=company1,ou=Sweden")
+ .searchScope(SearchScope.ONELEVEL)
+ .where("objectclass")
+ .is("person")
+ .and("sn")
+ .is("Person2"), this.contextMapper);
assertThat(list).hasSize(1);
}
@@ -420,17 +467,21 @@ public class LdapTemplateSearchResultITests extends AbstractLdapTemplateIntegrat
this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES);
this.contextMapper.setExpectedValues(ALL_VALUES);
List list = this.tested
- .searchForStream(LdapQueryBuilder.query().base("ou=company1,ou=Sweden")
- .searchScope(SearchScope.ONELEVEL).where("objectclass").is("person").and("sn").is("Person2"),
- this.contextMapper)
- .collect(Collectors.toList());
+ .searchForStream(LdapQueryBuilder.query()
+ .base("ou=company1,ou=Sweden")
+ .searchScope(SearchScope.ONELEVEL)
+ .where("objectclass")
+ .is("person")
+ .and("sn")
+ .is("Person2"), this.contextMapper)
+ .collect(Collectors.toList());
assertThat(list).hasSize(1);
}
@Test
public void testSearchForContext_LdapQuery() {
DirContextOperations result = this.tested
- .searchForContext(LdapQueryBuilder.query().where("objectclass").is("person").and("sn").is("Person2"));
+ .searchForContext(LdapQueryBuilder.query().where("objectclass").is("person").and("sn").is("Person2"));
assertThat(result).isNotNull();
assertThat(result.getStringAttribute("sn")).isEqualTo("Person2");
@@ -438,15 +489,23 @@ public class LdapTemplateSearchResultITests extends AbstractLdapTemplateIntegrat
@Test(expected = EmptyResultDataAccessException.class)
public void testSearchForContext_LdapQuery_SearchScopeNotFound() {
- this.tested.searchForContext(LdapQueryBuilder.query().searchScope(SearchScope.ONELEVEL).where("objectclass")
- .is("person").and("sn").is("Person2"));
+ this.tested.searchForContext(LdapQueryBuilder.query()
+ .searchScope(SearchScope.ONELEVEL)
+ .where("objectclass")
+ .is("person")
+ .and("sn")
+ .is("Person2"));
}
@Test
public void testSearchForContext_LdapQuery_SearchScope_CorrectBase() {
- DirContextOperations result = this.tested
- .searchForContext(LdapQueryBuilder.query().searchScope(SearchScope.ONELEVEL)
- .base("ou=company1,ou=Sweden").where("objectclass").is("person").and("sn").is("Person2"));
+ DirContextOperations result = this.tested.searchForContext(LdapQueryBuilder.query()
+ .searchScope(SearchScope.ONELEVEL)
+ .base("ou=company1,ou=Sweden")
+ .where("objectclass")
+ .is("person")
+ .and("sn")
+ .is("Person2"));
assertThat(result).isNotNull();
assertThat(result.getStringAttribute("sn")).isEqualTo("Person2");
diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateSearchResultNamespaceConfigITests.java b/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateSearchResultNamespaceConfigITests.java
index aef2a5ce..02796569 100644
--- a/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateSearchResultNamespaceConfigITests.java
+++ b/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateSearchResultNamespaceConfigITests.java
@@ -118,7 +118,8 @@ public class LdapTemplateSearchResultNamespaceConfigITests extends AbstractLdapT
List list = this.tested.searchForStream(
LdapQueryBuilder.query().base(BASE_STRING).where("objectclass").is("person").and("sn").is("Person2"),
- this.attributesMapper).collect(Collectors.toList());
+ this.attributesMapper)
+ .collect(Collectors.toList());
assertThat(list).hasSize(1);
}
@@ -127,8 +128,13 @@ public class LdapTemplateSearchResultNamespaceConfigITests extends AbstractLdapT
this.attributesMapper.setExpectedAttributes(new String[] { "cn" });
this.attributesMapper.setExpectedValues(new String[] { "Some Person2" });
- List list = this.tested.search(LdapQueryBuilder.query().base(BASE_STRING).attributes("cn")
- .where("objectclass").is("person").and("sn").is("Person2"), this.attributesMapper);
+ List list = this.tested.search(LdapQueryBuilder.query()
+ .base(BASE_STRING)
+ .attributes("cn")
+ .where("objectclass")
+ .is("person")
+ .and("sn")
+ .is("Person2"), this.attributesMapper);
assertThat(list).hasSize(1);
}
@@ -137,9 +143,15 @@ public class LdapTemplateSearchResultNamespaceConfigITests extends AbstractLdapT
this.attributesMapper.setExpectedAttributes(new String[] { "cn" });
this.attributesMapper.setExpectedValues(new String[] { "Some Person2" });
- List list = this.tested.searchForStream(LdapQueryBuilder.query().base(BASE_STRING).attributes("cn")
- .where("objectclass").is("person").and("sn").is("Person2"), this.attributesMapper)
- .collect(Collectors.toList());
+ List list = this.tested
+ .searchForStream(LdapQueryBuilder.query()
+ .base(BASE_STRING)
+ .attributes("cn")
+ .where("objectclass")
+ .is("person")
+ .and("sn")
+ .is("Person2"), this.attributesMapper)
+ .collect(Collectors.toList());
assertThat(list).hasSize(1);
}
@@ -148,9 +160,13 @@ public class LdapTemplateSearchResultNamespaceConfigITests extends AbstractLdapT
this.attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES);
this.attributesMapper.setExpectedValues(ALL_VALUES);
- List list = this.tested.search(LdapQueryBuilder.query().base(BASE_STRING)
- .searchScope(SearchScope.ONELEVEL).where("objectclass").is("person").and("sn").is("Person2"),
- this.attributesMapper);
+ List list = this.tested.search(LdapQueryBuilder.query()
+ .base(BASE_STRING)
+ .searchScope(SearchScope.ONELEVEL)
+ .where("objectclass")
+ .is("person")
+ .and("sn")
+ .is("Person2"), this.attributesMapper);
assertThat(list).isEmpty();
}
@@ -160,9 +176,14 @@ public class LdapTemplateSearchResultNamespaceConfigITests extends AbstractLdapT
this.attributesMapper.setExpectedValues(ALL_VALUES);
List list = this.tested
- .searchForStream(LdapQueryBuilder.query().base(BASE_STRING).searchScope(SearchScope.ONELEVEL)
- .where("objectclass").is("person").and("sn").is("Person2"), this.attributesMapper)
- .collect(Collectors.toList());
+ .searchForStream(LdapQueryBuilder.query()
+ .base(BASE_STRING)
+ .searchScope(SearchScope.ONELEVEL)
+ .where("objectclass")
+ .is("person")
+ .and("sn")
+ .is("Person2"), this.attributesMapper)
+ .collect(Collectors.toList());
assertThat(list).isEmpty();
}
@@ -171,9 +192,13 @@ public class LdapTemplateSearchResultNamespaceConfigITests extends AbstractLdapT
this.attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES);
this.attributesMapper.setExpectedValues(ALL_VALUES);
- List list = this.tested.search(LdapQueryBuilder.query().base("ou=company1,ou=Sweden")
- .searchScope(SearchScope.ONELEVEL).where("objectclass").is("person").and("sn").is("Person2"),
- this.attributesMapper);
+ List list = this.tested.search(LdapQueryBuilder.query()
+ .base("ou=company1,ou=Sweden")
+ .searchScope(SearchScope.ONELEVEL)
+ .where("objectclass")
+ .is("person")
+ .and("sn")
+ .is("Person2"), this.attributesMapper);
assertThat(list).hasSize(1);
}
@@ -182,9 +207,15 @@ public class LdapTemplateSearchResultNamespaceConfigITests extends AbstractLdapT
this.attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES);
this.attributesMapper.setExpectedValues(ALL_VALUES);
- List list = this.tested.searchForStream(LdapQueryBuilder.query().base("ou=company1,ou=Sweden")
- .searchScope(SearchScope.ONELEVEL).where("objectclass").is("person").and("sn").is("Person2"),
- this.attributesMapper).collect(Collectors.toList());
+ List list = this.tested
+ .searchForStream(LdapQueryBuilder.query()
+ .base("ou=company1,ou=Sweden")
+ .searchScope(SearchScope.ONELEVEL)
+ .where("objectclass")
+ .is("person")
+ .and("sn")
+ .is("Person2"), this.attributesMapper)
+ .collect(Collectors.toList());
assertThat(list).hasSize(1);
}
@@ -205,9 +236,9 @@ public class LdapTemplateSearchResultNamespaceConfigITests extends AbstractLdapT
this.attributesMapper.setExpectedValues(ALL_VALUES);
List list = this.tested
- .searchForStream(LdapQueryBuilder.query().where("objectclass").is("person").and("sn").is("Person2"),
- this.attributesMapper)
- .collect(Collectors.toList());
+ .searchForStream(LdapQueryBuilder.query().where("objectclass").is("person").and("sn").is("Person2"),
+ this.attributesMapper)
+ .collect(Collectors.toList());
assertThat(list).hasSize(1);
}
@@ -229,7 +260,8 @@ public class LdapTemplateSearchResultNamespaceConfigITests extends AbstractLdapT
List list = this.tested.searchForStream(
LdapQueryBuilder.query().base("ou=Norway").where("objectclass").is("person").and("sn").is("Person2"),
- this.attributesMapper).collect(Collectors.toList());
+ this.attributesMapper)
+ .collect(Collectors.toList());
assertThat(list).isEmpty();
}
@@ -355,9 +387,11 @@ public class LdapTemplateSearchResultNamespaceConfigITests extends AbstractLdapT
public void testSearchForStream_ContextMapper_LdapQuery() {
this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES);
this.contextMapper.setExpectedValues(ALL_VALUES);
- List list = this.tested.searchForStream(
- LdapQueryBuilder.query().base(BASE_NAME).where("objectclass").is("person").and("sn").is("Person2"),
- this.contextMapper).collect(Collectors.toList());
+ List list = this.tested
+ .searchForStream(
+ LdapQueryBuilder.query().base(BASE_NAME).where("objectclass").is("person").and("sn").is("Person2"),
+ this.contextMapper)
+ .collect(Collectors.toList());
assertThat(list).hasSize(1);
}
@@ -375,9 +409,9 @@ public class LdapTemplateSearchResultNamespaceConfigITests extends AbstractLdapT
this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES);
this.contextMapper.setExpectedValues(ALL_VALUES);
List list = this.tested
- .searchForStream(LdapQueryBuilder.query().where("objectclass").is("person").and("sn").is("Person2"),
- this.contextMapper)
- .collect(Collectors.toList());
+ .searchForStream(LdapQueryBuilder.query().where("objectclass").is("person").and("sn").is("Person2"),
+ this.contextMapper)
+ .collect(Collectors.toList());
assertThat(list).hasSize(1);
}
@@ -385,9 +419,13 @@ public class LdapTemplateSearchResultNamespaceConfigITests extends AbstractLdapT
public void testSearch_ContextMapper_LdapQuery_SearchScope() {
this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES);
this.contextMapper.setExpectedValues(ALL_VALUES);
- List list = this.tested.search(LdapQueryBuilder.query().base(BASE_NAME)
- .searchScope(SearchScope.ONELEVEL).where("objectclass").is("person").and("sn").is("Person2"),
- this.contextMapper);
+ List list = this.tested.search(LdapQueryBuilder.query()
+ .base(BASE_NAME)
+ .searchScope(SearchScope.ONELEVEL)
+ .where("objectclass")
+ .is("person")
+ .and("sn")
+ .is("Person2"), this.contextMapper);
assertThat(list).isEmpty();
}
@@ -396,9 +434,14 @@ public class LdapTemplateSearchResultNamespaceConfigITests extends AbstractLdapT
this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES);
this.contextMapper.setExpectedValues(ALL_VALUES);
List list = this.tested
- .searchForStream(LdapQueryBuilder.query().base(BASE_NAME).searchScope(SearchScope.ONELEVEL)
- .where("objectclass").is("person").and("sn").is("Person2"), this.contextMapper)
- .collect(Collectors.toList());
+ .searchForStream(LdapQueryBuilder.query()
+ .base(BASE_NAME)
+ .searchScope(SearchScope.ONELEVEL)
+ .where("objectclass")
+ .is("person")
+ .and("sn")
+ .is("Person2"), this.contextMapper)
+ .collect(Collectors.toList());
assertThat(list).isEmpty();
}
@@ -406,9 +449,13 @@ public class LdapTemplateSearchResultNamespaceConfigITests extends AbstractLdapT
public void testSearch_ContextMapper_LdapQuery_SearchScope_CorrectBase() {
this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES);
this.contextMapper.setExpectedValues(ALL_VALUES);
- List list = this.tested.search(LdapQueryBuilder.query().base("ou=company1,ou=Sweden")
- .searchScope(SearchScope.ONELEVEL).where("objectclass").is("person").and("sn").is("Person2"),
- this.contextMapper);
+ List list = this.tested.search(LdapQueryBuilder.query()
+ .base("ou=company1,ou=Sweden")
+ .searchScope(SearchScope.ONELEVEL)
+ .where("objectclass")
+ .is("person")
+ .and("sn")
+ .is("Person2"), this.contextMapper);
assertThat(list).hasSize(1);
}
@@ -417,17 +464,21 @@ public class LdapTemplateSearchResultNamespaceConfigITests extends AbstractLdapT
this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES);
this.contextMapper.setExpectedValues(ALL_VALUES);
List list = this.tested
- .searchForStream(LdapQueryBuilder.query().base("ou=company1,ou=Sweden")
- .searchScope(SearchScope.ONELEVEL).where("objectclass").is("person").and("sn").is("Person2"),
- this.contextMapper)
- .collect(Collectors.toList());
+ .searchForStream(LdapQueryBuilder.query()
+ .base("ou=company1,ou=Sweden")
+ .searchScope(SearchScope.ONELEVEL)
+ .where("objectclass")
+ .is("person")
+ .and("sn")
+ .is("Person2"), this.contextMapper)
+ .collect(Collectors.toList());
assertThat(list).hasSize(1);
}
@Test
public void testSearchForContext_LdapQuery() {
DirContextOperations result = this.tested
- .searchForContext(LdapQueryBuilder.query().where("objectclass").is("person").and("sn").is("Person2"));
+ .searchForContext(LdapQueryBuilder.query().where("objectclass").is("person").and("sn").is("Person2"));
assertThat(result).isNotNull();
assertThat(result.getStringAttribute("sn")).isEqualTo("Person2");
@@ -435,15 +486,23 @@ public class LdapTemplateSearchResultNamespaceConfigITests extends AbstractLdapT
@Test(expected = EmptyResultDataAccessException.class)
public void testSearchForContext_LdapQuery_SearchScopeNotFound() {
- this.tested.searchForContext(LdapQueryBuilder.query().searchScope(SearchScope.ONELEVEL).where("objectclass")
- .is("person").and("sn").is("Person2"));
+ this.tested.searchForContext(LdapQueryBuilder.query()
+ .searchScope(SearchScope.ONELEVEL)
+ .where("objectclass")
+ .is("person")
+ .and("sn")
+ .is("Person2"));
}
@Test
public void testSearchForContext_LdapQuery_SearchScope_CorrectBase() {
- DirContextOperations result = this.tested
- .searchForContext(LdapQueryBuilder.query().searchScope(SearchScope.ONELEVEL)
- .base("ou=company1,ou=Sweden").where("objectclass").is("person").and("sn").is("Person2"));
+ DirContextOperations result = this.tested.searchForContext(LdapQueryBuilder.query()
+ .searchScope(SearchScope.ONELEVEL)
+ .base("ou=company1,ou=Sweden")
+ .where("objectclass")
+ .is("person")
+ .and("sn")
+ .is("Person2"));
assertThat(result).isNotNull();
assertThat(result.getStringAttribute("sn")).isEqualTo("Person2");
diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/itest/control/SupportedControlsITests.java b/test/integration-tests/src/test/java/org/springframework/ldap/itest/control/SupportedControlsITests.java
index 66655371..080a946b 100644
--- a/test/integration-tests/src/test/java/org/springframework/ldap/itest/control/SupportedControlsITests.java
+++ b/test/integration-tests/src/test/java/org/springframework/ldap/itest/control/SupportedControlsITests.java
@@ -75,7 +75,7 @@ public class SupportedControlsITests extends AbstractLdapTemplateIntegrationTest
HashSet controlsSet = new HashSet(Arrays.asList(controls));
assertThat(controlsSet.contains("1.3.6.1.4.1.4203.1.10.1")).as("Entry Change Notification LDAPv3 control,")
- .isTrue();
+ .isTrue();
assertThat(controlsSet.contains("1.3.6.1.4.1.4203.1.10.1")).as("Subentries Control,").isTrue();
assertThat(controlsSet.contains("2.16.840.1.113730.3.4.2")).as("Manage DSA IT LDAPv3 control,").isTrue();
}
diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/itest/core/simple/SimpleLdapTemplateITests.java b/test/integration-tests/src/test/java/org/springframework/ldap/itest/core/simple/SimpleLdapTemplateITests.java
index b9cc0062..aa4a3c06 100644
--- a/test/integration-tests/src/test/java/org/springframework/ldap/itest/core/simple/SimpleLdapTemplateITests.java
+++ b/test/integration-tests/src/test/java/org/springframework/ldap/itest/core/simple/SimpleLdapTemplateITests.java
@@ -142,7 +142,7 @@ public class SimpleLdapTemplateITests extends AbstractLdapTemplateIntegrationTes
@Test
public void testModifyAttributesName() {
DirContextOperations ctx = this.ldapTemplate
- .lookupContext(LdapUtils.newLdapName("cn=Some Person,ou=company1,ou=Sweden"));
+ .lookupContext(LdapUtils.newLdapName("cn=Some Person,ou=company1,ou=Sweden"));
ctx.setAttributeValue("description", "updated description");
ctx.setAttributeValue("telephoneNumber", "0000001");
diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/itest/manager/ContextSourceAndDataSourceTransactionManagerIntegrationTests.java b/test/integration-tests/src/test/java/org/springframework/ldap/itest/manager/ContextSourceAndDataSourceTransactionManagerIntegrationTests.java
index 62303847..83b8561d 100644
--- a/test/integration-tests/src/test/java/org/springframework/ldap/itest/manager/ContextSourceAndDataSourceTransactionManagerIntegrationTests.java
+++ b/test/integration-tests/src/test/java/org/springframework/ldap/itest/manager/ContextSourceAndDataSourceTransactionManagerIntegrationTests.java
@@ -55,7 +55,7 @@ import static org.assertj.core.api.Assertions.fail;
public class ContextSourceAndDataSourceTransactionManagerIntegrationTests extends AbstractLdapTemplateIntegrationTests {
private static Logger log = LoggerFactory
- .getLogger(ContextSourceAndDataSourceTransactionManagerIntegrationTests.class);
+ .getLogger(ContextSourceAndDataSourceTransactionManagerIntegrationTests.class);
@Autowired
@Qualifier("dummyDao")
@@ -75,7 +75,7 @@ public class ContextSourceAndDataSourceTransactionManagerIntegrationTests extend
this.jdbcTemplate.execute("drop table PERSON if exists");
this.jdbcTemplate
- .execute("create table PERSON(fullname VARCHAR(256), lastname VARCHAR(256), description VARCHAR(256))");
+ .execute("create table PERSON(fullname VARCHAR(256), lastname VARCHAR(256), description VARCHAR(256))");
this.jdbcTemplate.update("insert into PERSON values(?, ?, ?)",
new Object[] { "Some Person", "Person", "Sweden, Company1, Some Person" });
}
diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/itest/manager/ContextSourceAndDataSourceTransactionManagerLdap179IntegrationTests.java b/test/integration-tests/src/test/java/org/springframework/ldap/itest/manager/ContextSourceAndDataSourceTransactionManagerLdap179IntegrationTests.java
index 4aca49ad..ba76a914 100644
--- a/test/integration-tests/src/test/java/org/springframework/ldap/itest/manager/ContextSourceAndDataSourceTransactionManagerLdap179IntegrationTests.java
+++ b/test/integration-tests/src/test/java/org/springframework/ldap/itest/manager/ContextSourceAndDataSourceTransactionManagerLdap179IntegrationTests.java
@@ -47,7 +47,7 @@ public class ContextSourceAndDataSourceTransactionManagerLdap179IntegrationTests
extends AbstractJUnit4SpringContextTests {
private static Logger log = LoggerFactory
- .getLogger(ContextSourceAndDataSourceTransactionManagerLdap179IntegrationTests.class);
+ .getLogger(ContextSourceAndDataSourceTransactionManagerLdap179IntegrationTests.class);
@Autowired
@Qualifier("dummyDao")
diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/itest/manager/ContextSourceAndDataSourceTransactionManagerNamespaceITests.java b/test/integration-tests/src/test/java/org/springframework/ldap/itest/manager/ContextSourceAndDataSourceTransactionManagerNamespaceITests.java
index 58ff8270..e83cedba 100644
--- a/test/integration-tests/src/test/java/org/springframework/ldap/itest/manager/ContextSourceAndDataSourceTransactionManagerNamespaceITests.java
+++ b/test/integration-tests/src/test/java/org/springframework/ldap/itest/manager/ContextSourceAndDataSourceTransactionManagerNamespaceITests.java
@@ -56,7 +56,7 @@ import static org.assertj.core.api.Assertions.fail;
public class ContextSourceAndDataSourceTransactionManagerNamespaceITests extends AbstractLdapTemplateIntegrationTests {
private static Logger log = LoggerFactory
- .getLogger(ContextSourceAndDataSourceTransactionManagerNamespaceITests.class);
+ .getLogger(ContextSourceAndDataSourceTransactionManagerNamespaceITests.class);
@Autowired
@Qualifier("dummyDao")
@@ -76,7 +76,7 @@ public class ContextSourceAndDataSourceTransactionManagerNamespaceITests extends
this.jdbcTemplate.execute("drop table PERSON if exists");
this.jdbcTemplate
- .execute("create table PERSON(fullname VARCHAR(256), lastname VARCHAR(256), description VARCHAR(256))");
+ .execute("create table PERSON(fullname VARCHAR(256), lastname VARCHAR(256), description VARCHAR(256))");
this.jdbcTemplate.update("insert into PERSON values(?, ?, ?)",
new Object[] { "Some Person", "Person", "Sweden, Company1, Some Person" });
}
diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/itest/manager/hibernate/ContextSourceAndHibernateTransactionManagerIntegrationTests.java b/test/integration-tests/src/test/java/org/springframework/ldap/itest/manager/hibernate/ContextSourceAndHibernateTransactionManagerIntegrationTests.java
index b6ef21aa..bb844578 100644
--- a/test/integration-tests/src/test/java/org/springframework/ldap/itest/manager/hibernate/ContextSourceAndHibernateTransactionManagerIntegrationTests.java
+++ b/test/integration-tests/src/test/java/org/springframework/ldap/itest/manager/hibernate/ContextSourceAndHibernateTransactionManagerIntegrationTests.java
@@ -57,7 +57,7 @@ import static org.assertj.core.api.Assertions.fail;
public class ContextSourceAndHibernateTransactionManagerIntegrationTests extends AbstractLdapTemplateIntegrationTests {
private static Logger log = LoggerFactory
- .getLogger(ContextSourceAndHibernateTransactionManagerIntegrationTests.class);
+ .getLogger(ContextSourceAndHibernateTransactionManagerIntegrationTests.class);
@Autowired
@Qualifier("dummyDao")
diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/itest/manager/hibernate/ContextSourceAndHibernateTransactionManagerLdap179IntegrationTests.java b/test/integration-tests/src/test/java/org/springframework/ldap/itest/manager/hibernate/ContextSourceAndHibernateTransactionManagerLdap179IntegrationTests.java
index 87ffa84b..0f73056b 100644
--- a/test/integration-tests/src/test/java/org/springframework/ldap/itest/manager/hibernate/ContextSourceAndHibernateTransactionManagerLdap179IntegrationTests.java
+++ b/test/integration-tests/src/test/java/org/springframework/ldap/itest/manager/hibernate/ContextSourceAndHibernateTransactionManagerLdap179IntegrationTests.java
@@ -44,7 +44,7 @@ public class ContextSourceAndHibernateTransactionManagerLdap179IntegrationTests
extends AbstractJUnit4SpringContextTests {
private static Logger log = LoggerFactory
- .getLogger(ContextSourceAndHibernateTransactionManagerLdap179IntegrationTests.class);
+ .getLogger(ContextSourceAndHibernateTransactionManagerLdap179IntegrationTests.class);
@Autowired
@Qualifier("dummyDao")
diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/itest/manager/hibernate/ContextSourceAndHibernateTransactionManagerNamespaceITests.java b/test/integration-tests/src/test/java/org/springframework/ldap/itest/manager/hibernate/ContextSourceAndHibernateTransactionManagerNamespaceITests.java
index 1e841ddc..97f4bf25 100644
--- a/test/integration-tests/src/test/java/org/springframework/ldap/itest/manager/hibernate/ContextSourceAndHibernateTransactionManagerNamespaceITests.java
+++ b/test/integration-tests/src/test/java/org/springframework/ldap/itest/manager/hibernate/ContextSourceAndHibernateTransactionManagerNamespaceITests.java
@@ -58,7 +58,7 @@ import static org.assertj.core.api.Assertions.fail;
public class ContextSourceAndHibernateTransactionManagerNamespaceITests extends AbstractLdapTemplateIntegrationTests {
private static Logger log = LoggerFactory
- .getLogger(ContextSourceAndHibernateTransactionManagerNamespaceITests.class);
+ .getLogger(ContextSourceAndHibernateTransactionManagerNamespaceITests.class);
@Autowired
@Qualifier("dummyDao")
diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/itest/odm/LdapTemplateOdmWithDnAnnotationsITests.java b/test/integration-tests/src/test/java/org/springframework/ldap/itest/odm/LdapTemplateOdmWithDnAnnotationsITests.java
index 70524bb5..b64abe4c 100644
--- a/test/integration-tests/src/test/java/org/springframework/ldap/itest/odm/LdapTemplateOdmWithDnAnnotationsITests.java
+++ b/test/integration-tests/src/test/java/org/springframework/ldap/itest/odm/LdapTemplateOdmWithDnAnnotationsITests.java
@@ -60,8 +60,8 @@ public class LdapTemplateOdmWithDnAnnotationsITests extends AbstractLdapTemplate
@Test
public void testFindByDn() {
- PersonWithDnAnnotations person = this.tested.findByDn(
- LdapUtils.newLdapName("cn=Some Person3,ou=company1,ou=Sweden"), PersonWithDnAnnotations.class);
+ PersonWithDnAnnotations person = this.tested
+ .findByDn(LdapUtils.newLdapName("cn=Some Person3,ou=company1,ou=Sweden"), PersonWithDnAnnotations.class);
assertThat(person).isNotNull();
assertThat(person.getCommonName()).isEqualTo("Some Person3");
@@ -77,8 +77,8 @@ public class LdapTemplateOdmWithDnAnnotationsITests extends AbstractLdapTemplate
@Test
public void testFindInCountry() {
- List persons = this.tested.find(
- LdapQueryBuilder.query().base("ou=Sweden").where("cn").isPresent(), PersonWithDnAnnotations.class);
+ List persons = this.tested
+ .find(LdapQueryBuilder.query().base("ou=Sweden").where("cn").isPresent(), PersonWithDnAnnotations.class);
assertThat(persons).hasSize(4);
@@ -93,9 +93,9 @@ public class LdapTemplateOdmWithDnAnnotationsITests extends AbstractLdapTemplate
@Test
public void testFindForStreamInCountry() {
List persons = this.tested
- .findForStream(LdapQueryBuilder.query().base("ou=Sweden").where("cn").isPresent(),
- PersonWithDnAnnotations.class)
- .collect(Collectors.toList());
+ .findForStream(LdapQueryBuilder.query().base("ou=Sweden").where("cn").isPresent(),
+ PersonWithDnAnnotations.class)
+ .collect(Collectors.toList());
assertThat(persons).hasSize(4);
diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/itest/odm/LdapTemplateOdmWithNoDnAnnotationsITests.java b/test/integration-tests/src/test/java/org/springframework/ldap/itest/odm/LdapTemplateOdmWithNoDnAnnotationsITests.java
index 6a603dbf..24e05e12 100644
--- a/test/integration-tests/src/test/java/org/springframework/ldap/itest/odm/LdapTemplateOdmWithNoDnAnnotationsITests.java
+++ b/test/integration-tests/src/test/java/org/springframework/ldap/itest/odm/LdapTemplateOdmWithNoDnAnnotationsITests.java
@@ -97,8 +97,8 @@ public class LdapTemplateOdmWithNoDnAnnotationsITests extends AbstractLdapTempla
@Test
public void testFindForStream() {
List persons = this.tested
- .findForStream(LdapQueryBuilder.query().where("cn").is("Some Person3"), Person.class)
- .collect(Collectors.toList());
+ .findForStream(LdapQueryBuilder.query().where("cn").is("Some Person3"), Person.class)
+ .collect(Collectors.toList());
assertThat(persons).hasSize(1);
Person person = persons.get(0);
@@ -125,8 +125,8 @@ public class LdapTemplateOdmWithNoDnAnnotationsITests extends AbstractLdapTempla
@Test
public void testFindForStreamInCountry() {
List persons = this.tested
- .findForStream(LdapQueryBuilder.query().base("ou=Sweden").where("cn").isPresent(), Person.class)
- .collect(Collectors.toList());
+ .findForStream(LdapQueryBuilder.query().base("ou=Sweden").where("cn").isPresent(), Person.class)
+ .collect(Collectors.toList());
assertThat(persons).hasSize(4);
Person person = persons.get(0);