diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/itest/AbstractLdapTemplateIntegrationTests.java b/test/integration-tests/src/test/java/org/springframework/ldap/itest/AbstractLdapTemplateIntegrationTests.java index 81fd1346..2f6780d5 100644 --- a/test/integration-tests/src/test/java/org/springframework/ldap/itest/AbstractLdapTemplateIntegrationTests.java +++ b/test/integration-tests/src/test/java/org/springframework/ldap/itest/AbstractLdapTemplateIntegrationTests.java @@ -61,20 +61,20 @@ public abstract class AbstractLdapTemplateIntegrationTests { @Before public void cleanAndSetup() throws NamingException, IOException { Resource ldifResource = getLdifFileResource(); - if (!LdapUtils.newLdapName(base).equals(LdapUtils.newLdapName(DEFAULT_BASE))) { + if (!LdapUtils.newLdapName(this.base).equals(LdapUtils.newLdapName(DEFAULT_BASE))) { List lines = IOUtils.readLines(ldifResource.getInputStream()); StringWriter sw = new StringWriter(); PrintWriter writer = new PrintWriter(sw); for (String line : lines) { - writer.println(StringUtils.replace(line, DEFAULT_BASE, base)); + writer.println(StringUtils.replace(line, DEFAULT_BASE, this.base)); } writer.flush(); ldifResource = new ByteArrayResource(sw.toString().getBytes("UTF8")); } - LdapTestUtils.cleanAndSetup(contextSource, getRoot(), ldifResource); + LdapTestUtils.cleanAndSetup(this.contextSource, getRoot(), ldifResource); } protected Resource getLdifFileResource() { 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 78b2f451..27f36cbb 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 @@ -57,7 +57,7 @@ public class DefaultLdapClientAuthenticationITests extends AbstractLdapTemplateI AndFilter filter = new AndFilter(); filter.and(new EqualsFilter("objectclass", "person")).and(new EqualsFilter("uid", "some.person3")); LdapQuery query = LdapQueryBuilder.query().base(LdapUtils.emptyLdapName()).filter(filter); - tested.authenticate().query(query).password("password").execute(); + this.tested.authenticate().query(query).password("password").execute(); } @Test @@ -66,7 +66,7 @@ public class DefaultLdapClientAuthenticationITests extends AbstractLdapTemplateI AndFilter filter = new AndFilter(); 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"); - tested.authenticate().query(query).password("password").execute(); + this.tested.authenticate().query(query).password("password").execute(); } @Test @@ -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(() -> 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(() -> tested.authenticate().query(query).password("invalidpassword").execute()); + .isThrownBy(() -> this.tested.authenticate().query(query).password("invalidpassword").execute()); } @Test @@ -104,7 +104,7 @@ public class DefaultLdapClientAuthenticationITests extends AbstractLdapTemplateI throw new RuntimeException("Failed to lookup " + entry.getRelativeDn(), e); } }; - tested.authenticate().query(query).password("password").execute((ctx, entry) -> { + this.tested.authenticate().query(query).password("password").execute((ctx, entry) -> { contextCallback.executeWithContext(ctx, entry); return null; }); @@ -114,7 +114,7 @@ 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 = tested.authenticate().query(query).password("password") + DirContextOperations ctx = this.tested.authenticate().query(query).password("password") .execute(new LookupAttemptingCallback()); assertThat(ctx).isNotNull(); @@ -125,7 +125,7 @@ public class DefaultLdapClientAuthenticationITests extends AbstractLdapTemplateI @Category(NoAdTests.class) public void testAuthenticateWithLdapQueryAndMapperAndInvalidPassword() { LdapQuery query = LdapQueryBuilder.query().where("objectclass").is("person").and("uid").is("some.person3"); - assertThatExceptionOfType(AuthenticationException.class).isThrownBy(() -> tested.authenticate().query(query) + assertThatExceptionOfType(AuthenticationException.class).isThrownBy(() -> this.tested.authenticate().query(query) .password("invalidpassword").execute(new LookupAttemptingCallback())); } @@ -136,7 +136,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(() -> tested.authenticate().query(query).password("invalidpassword").execute()); + .isThrownBy(() -> this.tested.authenticate().query(query).password("invalidpassword").execute()); } @Test @@ -147,7 +147,7 @@ public class DefaultLdapClientAuthenticationITests extends AbstractLdapTemplateI .and(new EqualsFilter("uid", "some.person.that.isnt.there")); LdapQuery query = LdapQueryBuilder.query().filter(filter); assertThatExceptionOfType(EmptyResultDataAccessException.class) - .isThrownBy(() -> tested.authenticate().query(query).password("password").execute()); + .isThrownBy(() -> this.tested.authenticate().query(query).password("password").execute()); } @Test @@ -157,7 +157,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(() -> tested.authenticate().query(query).password("password").execute()); + .isThrownBy(() -> this.tested.authenticate().query(query).password("password").execute()); } @Test @@ -167,7 +167,7 @@ public class DefaultLdapClientAuthenticationITests extends AbstractLdapTemplateI filter.and(new EqualsFilter("objectclass", "person")).and(new EqualsFilter("uid", "some.person3")); LdapQuery query = LdapQueryBuilder.query().filter(filter); LookupAttemptingCallback callback = new LookupAttemptingCallback(); - tested.authenticate().query(query).password("password").execute(callback); + this.tested.authenticate().query(query).password("password").execute(callback); } } 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 834e6f6d..c4091bf9 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 @@ -53,9 +53,9 @@ public class DefaultLdapClientBindUnbindITests extends AbstractLdapTemplateInteg @Test public void testBindAndUnbindWithAttributes() { Attributes attributes = setupAttributes(); - tested.bind(DN).attributes(attributes).execute(); + this.tested.bind(DN).attributes(attributes).execute(); verifyBoundCorrectData(); - tested.unbind(DN).execute(); + this.tested.unbind(DN).execute(); verifyCleanup(); } @@ -66,15 +66,15 @@ public class DefaultLdapClientBindUnbindITests extends AbstractLdapTemplateInteg ctx.addAttributeValue("objectclass", "top"); ctx.addAttributeValue("objectclass", "groupOfUniqueNames"); ctx.addAttributeValue("uniqueMember", LdapUtils.newLdapName("cn=Some Person,ou=company1,ou=Sweden," + base)); - tested.bind(ctx.getDn()).object(ctx).execute(); + this.tested.bind(ctx.getDn()).object(ctx).execute(); } @Test public void testBindAndUnbindWithAttributesUsingLdapName() { Attributes attributes = setupAttributes(); - tested.bind(LdapUtils.newLdapName(DN)).attributes(attributes).execute(); + this.tested.bind(LdapUtils.newLdapName(DN)).attributes(attributes).execute(); verifyBoundCorrectData(); - tested.unbind(LdapUtils.newLdapName(DN)).execute(); + this.tested.unbind(LdapUtils.newLdapName(DN)).execute(); verifyCleanup(); } @@ -85,9 +85,9 @@ public class DefaultLdapClientBindUnbindITests extends AbstractLdapTemplateInteg adapter.setAttributeValue("cn", "Some Person4"); adapter.setAttributeValue("sn", "Person4"); - tested.bind(DN).object(adapter).execute(); + this.tested.bind(DN).object(adapter).execute(); verifyBoundCorrectData(); - tested.unbind(DN).execute(); + this.tested.unbind(DN).execute(); verifyCleanup(); } @@ -98,9 +98,9 @@ public class DefaultLdapClientBindUnbindITests extends AbstractLdapTemplateInteg adapter.setAttributeValue("cn", "Some Person4"); adapter.setAttributeValue("sn", "Person4"); - tested.bind(LdapUtils.newLdapName(DN)).object(adapter).execute(); + this.tested.bind(LdapUtils.newLdapName(DN)).object(adapter).execute(); verifyBoundCorrectData(); - tested.unbind(LdapUtils.newLdapName(DN)).execute(); + this.tested.unbind(LdapUtils.newLdapName(DN)).execute(); verifyCleanup(); } @@ -111,9 +111,9 @@ public class DefaultLdapClientBindUnbindITests extends AbstractLdapTemplateInteg adapter.setAttributeValue("cn", "Some Person4"); adapter.setAttributeValue("sn", "Person4"); - tested.bind(DN).object(adapter).execute(); + this.tested.bind(DN).object(adapter).execute(); verifyBoundCorrectData(); - tested.unbind(DN).execute(); + this.tested.unbind(DN).execute(); verifyCleanup(); } @@ -124,12 +124,12 @@ public class DefaultLdapClientBindUnbindITests extends AbstractLdapTemplateInteg adapter.setAttributeValue("cn", "Some Person4"); adapter.setAttributeValue("sn", "Person4"); - tested.bind(DN).object(adapter).execute(); + this.tested.bind(DN).object(adapter).execute(); verifyBoundCorrectData(); adapter.setAttributeValue("sn", "Person4.Changed"); - tested.bind(DN).object(adapter).replaceExisting(true).execute(); + this.tested.bind(DN).object(adapter).replaceExisting(true).execute(); verifyReboundCorrectData(); - tested.unbind(DN).execute(); + this.tested.unbind(DN).execute(); verifyCleanup(); } @@ -145,20 +145,20 @@ public class DefaultLdapClientBindUnbindITests extends AbstractLdapTemplateInteg } private void verifyBoundCorrectData() { - DirContextOperations result = tested.search().name(DN).toEntry(); + DirContextOperations result = this.tested.search().name(DN).toEntry(); assertThat(result.getStringAttribute("cn")).isEqualTo("Some Person4"); assertThat(result.getStringAttribute("sn")).isEqualTo("Person4"); } private void verifyReboundCorrectData() { - DirContextOperations result = tested.search().name(DN).toEntry(); + DirContextOperations result = this.tested.search().name(DN).toEntry(); assertThat(result.getStringAttribute("cn")).isEqualTo("Some Person4"); assertThat(result.getStringAttribute("sn")).isEqualTo("Person4.Changed"); } private void verifyCleanup() { assertThatExceptionOfType(NameNotFoundException.class).describedAs("NameNotFoundException expected") - .isThrownBy(() -> 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 06651163..fbf57998 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 @@ -59,35 +59,35 @@ public class DefaultLdapClientListITests extends AbstractLdapTemplateIntegration @Before public void prepareTestedInstance() throws Exception { - contextMapper = new AttributeCheckContextMapper(); + this.contextMapper = new AttributeCheckContextMapper(); } @After public void tearDown() { - contextMapper = null; + this.contextMapper = null; } @Test public void testListBindings_ContextMapper() { - contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); - contextMapper.setExpectedValues(ALL_VALUES); - List list = tested.listBindings("ou=company2,ou=Sweden" + BASE_STRING).toList(contextMapper); + this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.contextMapper.setExpectedValues(ALL_VALUES); + List list = this.tested.listBindings("ou=company2,ou=Sweden" + BASE_STRING).toList(this.contextMapper); assertThat(list).hasSize(1); } @Test public void testListBindings_ContextMapper_Name() { - contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); - contextMapper.setExpectedValues(ALL_VALUES); + this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.contextMapper.setExpectedValues(ALL_VALUES); LdapName dn = LdapUtils.newLdapName("ou=company2,ou=Sweden"); - List list = tested.listBindings(dn).toList(contextMapper); + List list = this.tested.listBindings(dn).toList(this.contextMapper); assertThat(list).hasSize(1); } @Test public void testListBindings_ContextMapper_MapToPersons() { LdapName dn = LdapUtils.newLdapName("ou=company1,ou=Sweden"); - List list = tested.listBindings(dn).toList(new PersonContextMapper()); + List list = this.tested.listBindings(dn).toList(new PersonContextMapper()); assertThat(list).hasSize(3); String personClass = "org.springframework.ldap.itest.Person"; assertThat(list.get(0).getClass().getName()).isEqualTo(personClass); @@ -97,7 +97,7 @@ public class DefaultLdapClientListITests extends AbstractLdapTemplateIntegration @Test public void testList() { - List list = tested.list(BASE_STRING).toList(NameClassPair::getName); + List list = this.tested.list(BASE_STRING).toList(NameClassPair::getName); assertThat(list).hasSize(3); verifyBindings(list); } @@ -116,7 +116,7 @@ public class DefaultLdapClientListITests extends AbstractLdapTemplateIntegration @Test public void testList_Name() { - List list = tested.list(BASE_NAME).toList(NameClassPair::getName); + List list = this.tested.list(BASE_NAME).toList(NameClassPair::getName); assertThat(list).hasSize(3); verifyBindings(list); } @@ -124,7 +124,7 @@ public class DefaultLdapClientListITests extends AbstractLdapTemplateIntegration @Test public void testList_Handler() { CountNameClassPairCallbackHandler handler = new CountNameClassPairCallbackHandler(); - tested.list(BASE_STRING).toList((result) -> { + this.tested.list(BASE_STRING).toList((result) -> { handler.handleNameClassPair(result); return result; }); @@ -134,7 +134,7 @@ public class DefaultLdapClientListITests extends AbstractLdapTemplateIntegration @Test public void testList_Name_Handler() { CountNameClassPairCallbackHandler handler = new CountNameClassPairCallbackHandler(); - tested.list(BASE_NAME).toList((result) -> { + this.tested.list(BASE_NAME).toList((result) -> { handler.handleNameClassPair(result); return result; }); @@ -143,21 +143,21 @@ public class DefaultLdapClientListITests extends AbstractLdapTemplateIntegration @Test public void testListBindings() { - List list = tested.listBindings(BASE_STRING).toList(NameClassPair::getName); + List list = this.tested.listBindings(BASE_STRING).toList(NameClassPair::getName); assertThat(list).hasSize(3); verifyBindings(list); } @Test public void testListBindings_Name() { - List list = tested.listBindings(BASE_NAME).toList(NameClassPair::getName); + List list = this.tested.listBindings(BASE_NAME).toList(NameClassPair::getName); assertThat(list).hasSize(3); } @Test public void testListBindings_Handler() { CountNameClassPairCallbackHandler handler = new CountNameClassPairCallbackHandler(); - tested.list(BASE_STRING).toList((result) -> { + this.tested.list(BASE_STRING).toList((result) -> { handler.handleNameClassPair(result); return result; }); @@ -167,7 +167,7 @@ public class DefaultLdapClientListITests extends AbstractLdapTemplateIntegration @Test public void testListBindings_Name_Handler() { CountNameClassPairCallbackHandler handler = new CountNameClassPairCallbackHandler(); - tested.list(BASE_NAME).toList((result) -> { + this.tested.list(BASE_NAME).toList((result) -> { handler.handleNameClassPair(result); return result; }); 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 f91f02ee..36850c03 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 @@ -50,7 +50,7 @@ public class DefaultLdapClientLookupITests extends AbstractLdapTemplateIntegrati */ @Test public void testLookup_Plain() { - DirContextOperations result = tested.search().name("cn=Some Person2, ou=company1,ou=Sweden").toEntry(); + DirContextOperations result = this.tested.search().name("cn=Some Person2, ou=company1,ou=Sweden").toEntry(); assertThat(result.getStringAttribute("cn")).isEqualTo("Some Person2"); assertThat(result.getStringAttribute("sn")).isEqualTo("Person2"); @@ -64,7 +64,7 @@ public class DefaultLdapClientLookupITests extends AbstractLdapTemplateIntegrati */ @Test public void testLookupContextRoot() { - DirContextOperations result = tested.search().name("").toEntry(); + DirContextOperations result = this.tested.search().name("").toEntry(); assertThat(result.getDn().toString()).isEqualTo(""); assertThat(result.getNameInNamespace()).isEqualTo(base); @@ -73,7 +73,7 @@ public class DefaultLdapClientLookupITests extends AbstractLdapTemplateIntegrati @Test public void testLookup_AttributesMapper() { AttributesMapper mapper = new PersonAttributesMapper(); - Person person = tested.search().name("cn=Some Person2, ou=company1,ou=Sweden").toObject(mapper); + Person person = this.tested.search().name("cn=Some Person2, ou=company1,ou=Sweden").toObject(mapper); assertThat(person.getFullname()).isEqualTo("Some Person2"); assertThat(person.getLastname()).isEqualTo("Person2"); assertThat(person.getDescription()).isEqualTo("Sweden, Company1, Some Person2"); @@ -82,7 +82,7 @@ public class DefaultLdapClientLookupITests extends AbstractLdapTemplateIntegrati @Test public void testLookup_AttributesMapper_LdapName() { AttributesMapper mapper = new PersonAttributesMapper(); - Person person = tested.search().name(LdapUtils.newLdapName("cn=Some Person2, ou=company1,ou=Sweden")) + Person person = this.tested.search().name(LdapUtils.newLdapName("cn=Some Person2, ou=company1,ou=Sweden")) .toObject(mapper); assertThat(person.getFullname()).isEqualTo("Some Person2"); @@ -122,7 +122,7 @@ public class DefaultLdapClientLookupITests extends AbstractLdapTemplateIntegrati public void testLookup_ReturnAttributes_AttributesMapper() { AttributesMapper mapper = new SubsetPersonAttributesMapper(); - Person person = tested.search() + Person person = this.tested.search() .query((builder) -> builder.base("cn=Some Person2, ou=company1,ou=Sweden").attributes("cn")) .toObject(mapper); @@ -138,7 +138,7 @@ public class DefaultLdapClientLookupITests extends AbstractLdapTemplateIntegrati @Test public void testLookup_ReturnAttributes_AttributesMapper_LdapName() { AttributesMapper mapper = new SubsetPersonAttributesMapper(); - Person person = tested + Person person = this.tested .search().query((builder) -> builder .base(LdapUtils.newLdapName("cn=Some Person2, ou=company1,ou=Sweden")).attributes("cn")) .toObject(mapper); @@ -156,7 +156,7 @@ public class DefaultLdapClientLookupITests extends AbstractLdapTemplateIntegrati @Test public void testLookup_ContextMapper() { ContextMapper mapper = new PersonContextMapper(); - Person person = tested.search().name("cn=Some Person2, ou=company1,ou=Sweden").toObject(mapper); + Person person = this.tested.search().name("cn=Some Person2, ou=company1,ou=Sweden").toObject(mapper); assertThat(person.getFullname()).isEqualTo("Some Person2"); assertThat(person.getLastname()).isEqualTo("Person2"); @@ -171,7 +171,7 @@ public class DefaultLdapClientLookupITests extends AbstractLdapTemplateIntegrati public void testLookup_ReturnAttributes_ContextMapper() { ContextMapper mapper = new PersonContextMapper(); - Person person = tested.search() + Person person = this.tested.search() .query((builder) -> builder.base("cn=Some Person2, ou=company1,ou=Sweden").attributes("cn")) .toObject(mapper); @@ -183,7 +183,7 @@ public class DefaultLdapClientLookupITests extends AbstractLdapTemplateIntegrati @Test public void testLookup_GetNameInNamespace_Plain() { String expectedDn = "cn=Some Person2, ou=company1,ou=Sweden"; - DirContextOperations result = tested.search().name(expectedDn).toEntry(); + DirContextOperations result = this.tested.search().name(expectedDn).toEntry(); LdapName expectedName = LdapUtils.newLdapName(expectedDn); assertThat(result.getDn()).isEqualTo(expectedName); 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 45401e9a..ac63fedd 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 @@ -53,7 +53,7 @@ public class DefaultLdapClientLookupMultiRdnITests extends AbstractLdapTemplateI @Category(NoAdTests.class) public void testLookup_MultiValuedRdn() { AttributesMapper mapper = new PersonAttributesMapper(); - Person person = tested.search().name("cn=Some Person+sn=Person, ou=company1,ou=Norway").toObject(mapper); + Person person = this.tested.search().name("cn=Some Person+sn=Person, ou=company1,ou=Norway").toObject(mapper); assertThat(person.getFullname()).isEqualTo("Some Person"); assertThat(person.getLastname()).isEqualTo("Person"); assertThat(person.getDescription()).isEqualTo("Norway, Company1, Some Person+Person"); @@ -67,7 +67,7 @@ public class DefaultLdapClientLookupMultiRdnITests extends AbstractLdapTemplateI @Test @Category(NoAdTests.class) public void testLookup_MultiValuedRdn_DirContextAdapter() { - LdapDataEntry result = tested.search().name("cn=Some Person+sn=Person, ou=company1,ou=Norway").toEntry(); + LdapDataEntry result = this.tested.search().name("cn=Some Person+sn=Person, ou=company1,ou=Norway").toEntry(); assertThat(result.getStringAttribute("cn")).isEqualTo("Some Person"); assertThat(result.getStringAttribute("sn")).isEqualTo("Person"); assertThat(result.getStringAttribute("description")).isEqualTo("Norway, Company1, Some Person+Person"); @@ -76,7 +76,7 @@ public class DefaultLdapClientLookupMultiRdnITests extends AbstractLdapTemplateI @Test @Category(NoAdTests.class) public void testLookup_GetNameInNamespace_MultiRdn() { - DirContextOperations result = 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/DefaultLdapClientModifyITests.java b/test/integration-tests/src/test/java/org/springframework/ldap/itest/DefaultLdapClientModifyITests.java index ba014203..3842f56d 100644 --- a/test/integration-tests/src/test/java/org/springframework/ldap/itest/DefaultLdapClientModifyITests.java +++ b/test/integration-tests/src/test/java/org/springframework/ldap/itest/DefaultLdapClientModifyITests.java @@ -69,7 +69,7 @@ public class DefaultLdapClientModifyITests extends AbstractLdapTemplateIntegrati adapter.setAttributeValue("sn", "Person4"); adapter.setAttributeValue("description", "Some description"); - tested.bind(PERSON4_DN).object(adapter).execute(); + this.tested.bind(PERSON4_DN).object(adapter).execute(); adapter = new DirContextAdapter(); adapter.setAttributeValues("objectclass", new String[] { "top", "person" }); @@ -77,27 +77,27 @@ public class DefaultLdapClientModifyITests extends AbstractLdapTemplateIntegrati adapter.setAttributeValue("sn", "Person5"); adapter.setAttributeValues("description", new String[] { "qwe", "123", "rty", "uio" }); - tested.bind(PERSON5_DN).object(adapter).execute(); + this.tested.bind(PERSON5_DN).object(adapter).execute(); } @After public void cleanup() throws Exception { - tested.unbind(PERSON4_DN).execute(); - tested.unbind(PERSON5_DN).execute(); + this.tested.unbind(PERSON4_DN).execute(); + this.tested.unbind(PERSON5_DN).execute(); } @Test public void testRebind_Attributes_Plain() { Attributes attributes = setupAttributes(); - tested.bind(PERSON4_DN).attributes(attributes).replaceExisting(true).execute(); + this.tested.bind(PERSON4_DN).attributes(attributes).replaceExisting(true).execute(); verifyBoundCorrectData(); } @Test public void testRebind_Attributes_LdapName() { Attributes attributes = setupAttributes(); - tested.bind(LdapUtils.newLdapName(PERSON4_DN)).attributes(attributes).replaceExisting(true).execute(); + this.tested.bind(LdapUtils.newLdapName(PERSON4_DN)).attributes(attributes).replaceExisting(true).execute(); verifyBoundCorrectData(); } @@ -107,9 +107,9 @@ public class DefaultLdapClientModifyITests extends AbstractLdapTemplateIntegrati attr.add("Another description"); ModificationItem[] mods = new ModificationItem[1]; mods[0] = new ModificationItem(DirContext.REPLACE_ATTRIBUTE, attr); - tested.modify(PERSON4_DN).attributes(mods).execute(); + this.tested.modify(PERSON4_DN).attributes(mods).execute(); - DirContextOperations result = tested.search().name(PERSON4_DN).toEntry(); + DirContextOperations result = this.tested.search().name(PERSON4_DN).toEntry(); List attributes = Arrays.asList(result.getStringAttributes("description")); assertThat(attributes).hasSize(2); assertThat(attributes.contains("Some other description")).isTrue(); @@ -122,8 +122,8 @@ public class DefaultLdapClientModifyITests extends AbstractLdapTemplateIntegrati attr.add("Another description"); ModificationItem[] mods = new ModificationItem[1]; mods[0] = new ModificationItem(DirContext.ADD_ATTRIBUTE, attr); - tested.modify(PERSON4_DN).attributes(mods).execute(); - LdapDataEntry result = tested.search().name(PERSON4_DN).toEntry(); + this.tested.modify(PERSON4_DN).attributes(mods).execute(); + LdapDataEntry result = this.tested.search().name(PERSON4_DN).toEntry(); List attributes = Arrays.asList(result.getStringAttributes("description")); assertThat(attributes).hasSize(3); assertThat(attributes.contains("Some other description")).isTrue(); @@ -133,11 +133,11 @@ public class DefaultLdapClientModifyITests extends AbstractLdapTemplateIntegrati @Test public void testModifyAttributes_AddAttributeValueWithExistingValue() { - DirContextOperations ctx = tested.search().name("cn=ROLE_USER,ou=groups").toEntry(); + DirContextOperations ctx = this.tested.search().name("cn=ROLE_USER,ou=groups").toEntry(); String[] existing = ctx.getStringAttributes("uniqueMember"); ctx.addAttributeValue("uniqueMember", "cn=Some Person,ou=company1,ou=Norway," + base); - tested.modify(ctx.getDn()).attributes(ctx.getModificationItems()).execute(); - ctx = tested.search().name("cn=ROLE_USER,ou=groups").toEntry(); + this.tested.modify(ctx.getDn()).attributes(ctx.getModificationItems()).execute(); + ctx = this.tested.search().name("cn=ROLE_USER,ou=groups").toEntry(); assertThat(ctx.getStringAttributes("uniqueMember")).hasSize(existing.length + 1); assertThat(ctx.getStringAttributes("uniqueMember")).contains("cn=Some Person,ou=company1,ou=Norway," + base); } @@ -149,7 +149,7 @@ public class DefaultLdapClientModifyITests extends AbstractLdapTemplateIntegrati mods[0] = new ModificationItem(DirContext.ADD_ATTRIBUTE, attr); try { - tested.modify(PERSON4_DN).attributes(mods).execute(); + this.tested.modify(PERSON4_DN).attributes(mods).execute(); fail("AttributeInUseException expected"); } catch (AttributeInUseException expected) { @@ -170,8 +170,8 @@ public class DefaultLdapClientModifyITests extends AbstractLdapTemplateIntegrati // attr.add("Some description"); ModificationItem[] mods = new ModificationItem[1]; mods[0] = new ModificationItem(DirContext.ADD_ATTRIBUTE, attr); - tested.modify(PERSON4_DN).attributes(mods).execute(); - LdapDataEntry result = tested.search().name(PERSON4_DN).toEntry(); + this.tested.modify(PERSON4_DN).attributes(mods).execute(); + LdapDataEntry result = this.tested.search().name(PERSON4_DN).toEntry(); List attributes = Arrays.asList(result.getStringAttributes("description")); assertThat(attributes).hasSize(3); assertThat(attributes.contains("Some other description")).isTrue(); @@ -183,7 +183,7 @@ public class DefaultLdapClientModifyITests extends AbstractLdapTemplateIntegrati public void testModifyAttributes_Plain() { ModificationItem item = new ModificationItem(DirContext.REPLACE_ATTRIBUTE, new BasicAttribute("description", "Some other description")); - tested.modify(PERSON4_DN).attributes(item).execute(); + this.tested.modify(PERSON4_DN).attributes(item).execute(); verifyBoundCorrectData(); } @@ -191,18 +191,18 @@ public class DefaultLdapClientModifyITests extends AbstractLdapTemplateIntegrati public void testModifyAttributes_LdapName() { ModificationItem item = new ModificationItem(DirContext.REPLACE_ATTRIBUTE, new BasicAttribute("description", "Some other description")); - tested.modify(LdapUtils.newLdapName(PERSON4_DN)).attributes(item).execute(); + this.tested.modify(LdapUtils.newLdapName(PERSON4_DN)).attributes(item).execute(); verifyBoundCorrectData(); } @Test public void testModifyAttributes_DirContextAdapter_MultiAttributes() { - DirContextOperations adapter = tested.search().name(PERSON5_DN).toEntry(); + DirContextOperations adapter = this.tested.search().name(PERSON5_DN).toEntry(); adapter.setAttributeValues("description", new String[] { "qwe", "123", "klytt", "kalle" }); - tested.modify(adapter.getDn()).attributes(adapter.getModificationItems()).execute(); + this.tested.modify(adapter.getDn()).attributes(adapter.getModificationItems()).execute(); // Verify - adapter = tested.search().name(PERSON5_DN).toEntry(); + adapter = this.tested.search().name(PERSON5_DN).toEntry(); List attributes = Arrays.asList(adapter.getStringAttributes("description")); assertThat(attributes).hasSize(4); assertThat(attributes.contains("qwe")).isTrue(); @@ -218,17 +218,17 @@ public class DefaultLdapClientModifyITests extends AbstractLdapTemplateIntegrati */ @Test public void testModifyAttributes_DirContextAdapter() { - DirContextOperations adapter = tested.search().name(PERSON4_DN).toEntry(); + DirContextOperations adapter = this.tested.search().name(PERSON4_DN).toEntry(); adapter.setAttributeValue("description", "Some other description"); - tested.modify(adapter.getDn()).attributes(adapter.getModificationItems()).execute(); + this.tested.modify(adapter.getDn()).attributes(adapter.getModificationItems()).execute(); verifyBoundCorrectData(); } @Test public void verifyCompleteReplacementOfUniqueMemberAttribute_Ldap119() { - DirContextOperations ctx = tested.search().name("cn=ROLE_USER,ou=groups").toEntry(); + DirContextOperations ctx = this.tested.search().name("cn=ROLE_USER,ou=groups").toEntry(); ctx.setAttributeValues("uniqueMember", new String[] { "cn=Some Person,ou=company1,ou=Norway," + base }, true); - tested.modify(ctx.getDn()).attributes(ctx.getModificationItems()).execute(); + this.tested.modify(ctx.getDn()).attributes(ctx.getModificationItems()).execute(); } private Attributes setupAttributes() { @@ -244,7 +244,7 @@ public class DefaultLdapClientModifyITests extends AbstractLdapTemplateIntegrati } private void verifyBoundCorrectData() { - DirContextOperations result = tested.search().name(PERSON4_DN).toEntry(); + DirContextOperations result = this.tested.search().name(PERSON4_DN).toEntry(); assertThat(result.getStringAttribute("cn")).isEqualTo("Some Person4"); assertThat(result.getStringAttribute("sn")).isEqualTo("Person4"); assertThat(result.getStringAttribute("description")).isEqualTo("Some other description"); 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 9eeab8a2..646b3ea5 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 @@ -61,42 +61,42 @@ public class DefaultLdapClientRecursiveDeleteITests extends AbstractLdapTemplate adapter.setAttributeValue("cn", "Some Person5"); adapter.setAttributeValue("sn", "Person5"); adapter.setAttributeValue("description", "Some description"); - tested.bind(DN).object(adapter).execute(); + this.tested.bind(DN).object(adapter).execute(); - firstSubDn = LdapUtils.newLdapName("cn=subPerson"); - firstSubDn = LdapUtils.prepend(firstSubDn, DN); + this.firstSubDn = LdapUtils.newLdapName("cn=subPerson"); + this.firstSubDn = LdapUtils.prepend(this.firstSubDn, DN); adapter = new DirContextAdapter(); adapter.setAttributeValues("objectclass", new String[] { "top", "person" }); adapter.setAttributeValue("cn", "subPerson"); adapter.setAttributeValue("sn", "subPerson"); adapter.setAttributeValue("description", "Should be recursively deleted"); - tested.bind(firstSubDn).object(adapter).execute(); - secondSubDn = LdapUtils.newLdapName("cn=subPerson2"); - secondSubDn = LdapUtils.prepend(secondSubDn, DN); + this.tested.bind(this.firstSubDn).object(adapter).execute(); + this.secondSubDn = LdapUtils.newLdapName("cn=subPerson2"); + this.secondSubDn = LdapUtils.prepend(this.secondSubDn, DN); adapter = new DirContextAdapter(); adapter.setAttributeValues("objectclass", new String[] { "top", "person" }); adapter.setAttributeValue("cn", "subPerson2"); adapter.setAttributeValue("sn", "subPerson2"); adapter.setAttributeValue("description", "Should be recursively deleted"); - tested.bind(secondSubDn).object(adapter).execute(); + this.tested.bind(this.secondSubDn).object(adapter).execute(); - leafDn = LdapUtils.newLdapName("cn=subSubPerson"); - leafDn = LdapUtils.prepend(leafDn, DN); + this.leafDn = LdapUtils.newLdapName("cn=subSubPerson"); + this.leafDn = LdapUtils.prepend(this.leafDn, DN); adapter = new DirContextAdapter(); adapter.setAttributeValues("objectclass", new String[] { "top", "person" }); adapter.setAttributeValue("cn", "subSubPerson"); adapter.setAttributeValue("sn", "subSubPerson"); adapter.setAttributeValue("description", "Should be recursively deleted"); - tested.bind(leafDn).object(adapter).execute(); + this.tested.bind(this.leafDn).object(adapter).execute(); } @After public void cleanup() throws Exception { try { - tested.unbind(DN).recursive(true).execute(); + this.tested.unbind(DN).recursive(true).execute(); } catch (NameNotFoundException ignore) { // ignore @@ -106,25 +106,25 @@ public class DefaultLdapClientRecursiveDeleteITests extends AbstractLdapTemplate @Test @Category(NoAdTests.class) public void testRecursiveUnbind() { - tested.unbind(DN).recursive(true).execute(); + this.tested.unbind(DN).recursive(true).execute(); verifyDeleted(DN); - verifyDeleted(firstSubDn); - verifyDeleted(secondSubDn); - verifyDeleted(leafDn); + verifyDeleted(this.firstSubDn); + verifyDeleted(this.secondSubDn); + verifyDeleted(this.leafDn); } @Test @Category(NoAdTests.class) public void testRecursiveUnbindOnLeaf() { - tested.unbind(leafDn).recursive(true).execute(); - verifyDeleted(leafDn); + this.tested.unbind(this.leafDn).recursive(true).execute(); + verifyDeleted(this.leafDn); } private void verifyDeleted(Name dn) { assertThatExceptionOfType(NameNotFoundException.class) .describedAs("Expected entry '" + dn + "' to be non-existent") - .isThrownBy(() -> tested.list(dn).toList(NameClassPair::getName)); + .isThrownBy(() -> this.tested.list(dn).toList(NameClassPair::getName)); } } diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/itest/DefaultLdapClientRenameITests.java b/test/integration-tests/src/test/java/org/springframework/ldap/itest/DefaultLdapClientRenameITests.java index f61deff1..7d0d1b16 100644 --- a/test/integration-tests/src/test/java/org/springframework/ldap/itest/DefaultLdapClientRenameITests.java +++ b/test/integration-tests/src/test/java/org/springframework/ldap/itest/DefaultLdapClientRenameITests.java @@ -57,18 +57,18 @@ public class DefaultLdapClientRenameITests extends AbstractLdapTemplateIntegrati adapter.setAttributeValue("sn", "Person6"); adapter.setAttributeValue("description", "Some description"); - tested.bind(DN).object(adapter).execute(); + this.tested.bind(DN).object(adapter).execute(); } @After public void cleanup() throws Exception { - tested.unbind(NEWDN).execute(); - tested.unbind(DN).execute(); + this.tested.unbind(NEWDN).execute(); + this.tested.unbind(DN).execute(); } @Test public void testRename() { - tested.modify(DN).name(NEWDN).execute(); + this.tested.modify(DN).name(NEWDN).execute(); verifyDeleted(LdapUtils.newLdapName(DN)); verifyBoundCorrectData(); } @@ -77,14 +77,14 @@ public class DefaultLdapClientRenameITests extends AbstractLdapTemplateIntegrati public void testRename_LdapName() { Name oldDn = LdapUtils.newLdapName(DN); Name newDn = LdapUtils.newLdapName(NEWDN); - tested.modify(oldDn).name(newDn).execute(); + this.tested.modify(oldDn).name(newDn).execute(); verifyDeleted(oldDn); verifyBoundCorrectData(); } private void verifyDeleted(Name dn) { try { - tested.list(dn).toList(NameClassPair::getName); + this.tested.list(dn).toList(NameClassPair::getName); fail("Expected entry '" + dn + "' to be non-existent"); } catch (NameNotFoundException expected) { @@ -93,7 +93,7 @@ public class DefaultLdapClientRenameITests extends AbstractLdapTemplateIntegrati } private void verifyBoundCorrectData() { - LdapDataEntry result = tested.search().name(NEWDN).toEntry(); + LdapDataEntry result = this.tested.search().name(NEWDN).toEntry(); assertThat(result.getStringAttribute("cn")).isEqualTo("Some Person6"); assertThat(result.getStringAttribute("sn")).isEqualTo("Person6"); assertThat(result.getStringAttribute("description")).isEqualTo("Some description"); 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 214d64f3..e4ecf714 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 @@ -82,232 +82,232 @@ public class DefaultLdapClientSearchResultITests extends AbstractLdapTemplateInt @Before public void prepareTestedInstance() throws Exception { - attributesMapper = new AttributeCheckAttributesMapper(); - contextMapper = new AttributeCheckContextMapper(); + this.attributesMapper = new AttributeCheckAttributesMapper(); + this.contextMapper = new AttributeCheckContextMapper(); } @After public void cleanup() throws Exception { - attributesMapper = null; - contextMapper = null; + this.attributesMapper = null; + this.contextMapper = null; } @Test public void testSearch_AttributesMapper() { - attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); - attributesMapper.setExpectedValues(ALL_VALUES); + this.attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.attributesMapper.setExpectedValues(ALL_VALUES); LdapQuery query = LdapQueryBuilder.query().base(BASE_STRING).filter(FILTER_STRING); - List list = tested.search().query(query).toList(attributesMapper); + List list = this.tested.search().query(query).toList(this.attributesMapper); assertThat(list).hasSize(1); } @Test public void testSearch_LdapQuery_AttributesMapper() { - attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); - attributesMapper.setExpectedValues(ALL_VALUES); + this.attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.attributesMapper.setExpectedValues(ALL_VALUES); - List list = tested.search() + List list = this.tested.search() .query(query().base(BASE_STRING).where("objectclass").is("person").and("sn").is("Person2")) - .toList(attributesMapper); + .toList(this.attributesMapper); assertThat(list).hasSize(1); } @Test public void testSearchForStream_LdapQuery_AttributesMapper() { - attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); - attributesMapper.setExpectedValues(ALL_VALUES); + this.attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.attributesMapper.setExpectedValues(ALL_VALUES); - List list = tested.search() + List list = this.tested.search() .query(query().base(BASE_STRING).where("objectclass").is("person").and("sn").is("Person2")) - .toStream(attributesMapper).collect(Collectors.toList()); + .toStream(this.attributesMapper).collect(Collectors.toList()); assertThat(list).hasSize(1); } @Test public void testSearch_LdapQuery_AttributesMapper_FewerAttributes() { - attributesMapper.setExpectedAttributes(new String[] { "cn" }); - attributesMapper.setExpectedValues(new String[] { "Some Person2" }); + this.attributesMapper.setExpectedAttributes(new String[] { "cn" }); + this.attributesMapper.setExpectedValues(new String[] { "Some Person2" }); - List list = tested.search().query( + List list = this.tested.search().query( query().base(BASE_STRING).attributes("cn").where("objectclass").is("person").and("sn").is("Person2")) - .toList(attributesMapper); + .toList(this.attributesMapper); assertThat(list).hasSize(1); } @Test public void testSearchForStream_LdapQuery_AttributesMapper_FewerAttributes() { - attributesMapper.setExpectedAttributes(new String[] { "cn" }); - attributesMapper.setExpectedValues(new String[] { "Some Person2" }); + this.attributesMapper.setExpectedAttributes(new String[] { "cn" }); + this.attributesMapper.setExpectedValues(new String[] { "Some Person2" }); - List list = tested.search().query( + List list = this.tested.search().query( query().base(BASE_STRING).attributes("cn").where("objectclass").is("person").and("sn").is("Person2")) - .toStream(attributesMapper).collect(Collectors.toList()); + .toStream(this.attributesMapper).collect(Collectors.toList()); assertThat(list).hasSize(1); } @Test public void testSearch_LdapQuery_AttributesMapper_SearchScope() { - attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); - attributesMapper.setExpectedValues(ALL_VALUES); + this.attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.attributesMapper.setExpectedValues(ALL_VALUES); - List list = tested.search().query(query().base(BASE_STRING).searchScope(SearchScope.ONELEVEL) - .where("objectclass").is("person").and("sn").is("Person2")).toList(attributesMapper); + List list = this.tested.search().query(query().base(BASE_STRING).searchScope(SearchScope.ONELEVEL) + .where("objectclass").is("person").and("sn").is("Person2")).toList(this.attributesMapper); assertThat(list).isEmpty(); } @Test public void testSearchForStream_LdapQuery_AttributesMapper_SearchScope() { - attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); - attributesMapper.setExpectedValues(ALL_VALUES); + this.attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.attributesMapper.setExpectedValues(ALL_VALUES); - List list = tested.search().query(query().base(BASE_STRING).searchScope(SearchScope.ONELEVEL) - .where("objectclass").is("person").and("sn").is("Person2")).toStream(attributesMapper) + List list = this.tested.search().query(query().base(BASE_STRING).searchScope(SearchScope.ONELEVEL) + .where("objectclass").is("person").and("sn").is("Person2")).toStream(this.attributesMapper) .collect(Collectors.toList()); assertThat(list).isEmpty(); } @Test public void testSearch_LdapQuery_AttributesMapper_SearchScope_CorrectBase() { - attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); - attributesMapper.setExpectedValues(ALL_VALUES); + this.attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.attributesMapper.setExpectedValues(ALL_VALUES); - List list = tested.search().query(query().base("ou=company1,ou=Sweden") + List list = this.tested.search().query(query().base("ou=company1,ou=Sweden") .searchScope(SearchScope.ONELEVEL).where("objectclass").is("person").and("sn").is("Person2")) - .toList(attributesMapper); + .toList(this.attributesMapper); assertThat(list).hasSize(1); } @Test public void testSearchForStream_LdapQuery_AttributesMapper_SearchScope_CorrectBase() { - attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); - attributesMapper.setExpectedValues(ALL_VALUES); + this.attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.attributesMapper.setExpectedValues(ALL_VALUES); - List list = tested + List list = this.tested .search().query(query().base("ou=company1,ou=Sweden").searchScope(SearchScope.ONELEVEL) .where("objectclass").is("person").and("sn").is("Person2")) - .toStream(attributesMapper).collect(Collectors.toList()); + .toStream(this.attributesMapper).collect(Collectors.toList()); assertThat(list).hasSize(1); } @Test public void testSearch_LdapQuery_AttributesMapper_NoBase() { - attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); - attributesMapper.setExpectedValues(ALL_VALUES); + this.attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.attributesMapper.setExpectedValues(ALL_VALUES); - List list = tested.search().query(query().where("objectclass").is("person").and("sn").is("Person2")) - .toList(attributesMapper); + List list = this.tested.search().query(query().where("objectclass").is("person").and("sn").is("Person2")) + .toList(this.attributesMapper); assertThat(list).hasSize(1); } @Test public void testSearchForStream_LdapQuery_AttributesMapper_NoBase() { - attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); - attributesMapper.setExpectedValues(ALL_VALUES); + this.attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.attributesMapper.setExpectedValues(ALL_VALUES); - List list = tested.search().query(query().where("objectclass").is("person").and("sn").is("Person2")) - .toStream(attributesMapper).collect(Collectors.toList()); + List list = this.tested.search().query(query().where("objectclass").is("person").and("sn").is("Person2")) + .toStream(this.attributesMapper).collect(Collectors.toList()); assertThat(list).hasSize(1); } @Test public void testSearch_LdapQuery_AttributesMapper_DifferentBase() { - attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); - attributesMapper.setExpectedValues(ALL_VALUES); + this.attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.attributesMapper.setExpectedValues(ALL_VALUES); - List list = tested.search() + List list = this.tested.search() .query(query().base("ou=Norway").where("objectclass").is("person").and("sn").is("Person2")) - .toList(attributesMapper); + .toList(this.attributesMapper); assertThat(list).isEmpty(); } @Test public void testSearchForStream_LdapQuery_AttributesMapper_DifferentBase() { - attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); - attributesMapper.setExpectedValues(ALL_VALUES); + this.attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.attributesMapper.setExpectedValues(ALL_VALUES); - List list = tested.search() + List list = this.tested.search() .query(query().base("ou=Norway").where("objectclass").is("person").and("sn").is("Person2")) - .toStream(attributesMapper).collect(Collectors.toList()); + .toStream(this.attributesMapper).collect(Collectors.toList()); assertThat(list).isEmpty(); } @Test public void testSearch_SearchScope_AttributesMapper() { - attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); - attributesMapper.setExpectedValues(ALL_VALUES); - List list = tested.search() + this.attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.attributesMapper.setExpectedValues(ALL_VALUES); + List list = this.tested.search() .query(query().base(BASE_STRING).searchScope(SearchScope.SUBTREE).filter(FILTER_STRING)) - .toList(attributesMapper); + .toList(this.attributesMapper); assertThat(list).hasSize(1); } @Test public void testSearch_SearchScope_LimitedAttrs_AttributesMapper() { - attributesMapper.setExpectedAttributes(CN_SN_ATTRS); - attributesMapper.setExpectedValues(CN_SN_VALUES); - attributesMapper.setAbsentAttributes(ABSENT_ATTRIBUTES); - List list = tested.search().query(query().base(BASE_STRING).searchScope(SearchScope.SUBTREE) - .attributes(CN_SN_ATTRS).filter(FILTER_STRING)).toList(attributesMapper); + this.attributesMapper.setExpectedAttributes(CN_SN_ATTRS); + this.attributesMapper.setExpectedValues(CN_SN_VALUES); + this.attributesMapper.setAbsentAttributes(ABSENT_ATTRIBUTES); + List list = this.tested.search().query(query().base(BASE_STRING).searchScope(SearchScope.SUBTREE) + .attributes(CN_SN_ATTRS).filter(FILTER_STRING)).toList(this.attributesMapper); assertThat(list).hasSize(1); } @Test public void testSearch_AttributesMapper_Name() { - attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); - attributesMapper.setExpectedValues(ALL_VALUES); - List list = tested.search().query(query().base(BASE_NAME).filter(FILTER_STRING)) - .toList(attributesMapper); + this.attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.attributesMapper.setExpectedValues(ALL_VALUES); + List list = this.tested.search().query(query().base(BASE_NAME).filter(FILTER_STRING)) + .toList(this.attributesMapper); assertThat(list).hasSize(1); } @Test public void testSearch_SearchScope_AttributesMapper_Name() { - attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); - attributesMapper.setExpectedValues(ALL_VALUES); - List list = tested.search() + this.attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.attributesMapper.setExpectedValues(ALL_VALUES); + List list = this.tested.search() .query(query().base(BASE_NAME).searchScope(SearchScope.SUBTREE).filter(FILTER_STRING)) - .toList(attributesMapper); + .toList(this.attributesMapper); assertThat(list).hasSize(1); } @Test public void testSearch_SearchScope_LimitedAttrs_AttributesMapper_Name() { - attributesMapper.setExpectedAttributes(CN_SN_ATTRS); - attributesMapper.setExpectedValues(CN_SN_VALUES); - attributesMapper.setAbsentAttributes(ABSENT_ATTRIBUTES); - List list = tested.search().query( + this.attributesMapper.setExpectedAttributes(CN_SN_ATTRS); + this.attributesMapper.setExpectedValues(CN_SN_VALUES); + this.attributesMapper.setAbsentAttributes(ABSENT_ATTRIBUTES); + List list = this.tested.search().query( query().base(BASE_NAME).searchScope(SearchScope.SUBTREE).attributes(CN_SN_ATTRS).filter(FILTER_STRING)) - .toList(attributesMapper); + .toList(this.attributesMapper); assertThat(list).hasSize(1); } @Test public void testSearch_ContextMapper() { - contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); - contextMapper.setExpectedValues(ALL_VALUES); - List list = tested.search().query(query().base(BASE_STRING).filter(FILTER_STRING)) - .toList(contextMapper); + this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.contextMapper.setExpectedValues(ALL_VALUES); + List list = this.tested.search().query(query().base(BASE_STRING).filter(FILTER_STRING)) + .toList(this.contextMapper); assertThat(list).hasSize(1); } @Test public void testSearchForObject() { - contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); - contextMapper.setExpectedValues(ALL_VALUES); - DirContextAdapter result = tested.search().query(query().base(BASE_STRING).filter(FILTER_STRING)) - .toObject(contextMapper); + this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.contextMapper.setExpectedValues(ALL_VALUES); + DirContextAdapter result = this.tested.search().query(query().base(BASE_STRING).filter(FILTER_STRING)) + .toObject(this.contextMapper); assertThat(result).isNotNull(); } @Test(expected = IncorrectResultSizeDataAccessException.class) public void testSearchForObjectWithMultipleHits() { - tested.search().query(query().base(BASE_STRING).filter("(&(objectclass=person)(sn=*))")) + this.tested.search().query(query().base(BASE_STRING).filter("(&(objectclass=person)(sn=*))")) .toObject((Object ctx) -> ctx); } @Test // (expected = EmptyResultDataAccessException.class) public void testSearchForObjectNoHits() { - Object result = tested.search() + Object result = this.tested.search() .query(query().base(BASE_STRING).filter("(&(objectclass=person)(sn=Person does not exist))")) .toObject((Object ctx) -> ctx); assertThat(result).isNull(); @@ -315,116 +315,116 @@ public class DefaultLdapClientSearchResultITests extends AbstractLdapTemplateInt @Test public void testSearch_SearchScope_ContextMapper() { - contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); - contextMapper.setExpectedValues(ALL_VALUES); - List list = tested.search() + this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.contextMapper.setExpectedValues(ALL_VALUES); + List list = this.tested.search() .query(query().base(BASE_STRING).searchScope(SearchScope.SUBTREE).filter(FILTER_STRING)) - .toList(contextMapper); + .toList(this.contextMapper); assertThat(list).hasSize(1); } @Test public void testSearch_SearchScope_LimitedAttrs_ContextMapper() { - contextMapper.setExpectedAttributes(CN_SN_ATTRS); - contextMapper.setExpectedValues(CN_SN_VALUES); - contextMapper.setAbsentAttributes(ABSENT_ATTRIBUTES); - List list = tested.search().query(query().base(BASE_STRING).searchScope(SearchScope.SUBTREE) - .attributes(CN_SN_ATTRS).filter(FILTER_STRING)).toList(contextMapper); + this.contextMapper.setExpectedAttributes(CN_SN_ATTRS); + this.contextMapper.setExpectedValues(CN_SN_VALUES); + this.contextMapper.setAbsentAttributes(ABSENT_ATTRIBUTES); + List list = this.tested.search().query(query().base(BASE_STRING).searchScope(SearchScope.SUBTREE) + .attributes(CN_SN_ATTRS).filter(FILTER_STRING)).toList(this.contextMapper); assertThat(list).hasSize(1); } @Test public void testSearch_ContextMapper_Name() { - contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); - contextMapper.setExpectedValues(ALL_VALUES); - List list = tested.search().query(query().base(BASE_NAME).filter(FILTER_STRING)) - .toList(contextMapper); + this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.contextMapper.setExpectedValues(ALL_VALUES); + List list = this.tested.search().query(query().base(BASE_NAME).filter(FILTER_STRING)) + .toList(this.contextMapper); assertThat(list).hasSize(1); } @Test public void testSearch_ContextMapper_LdapQuery() { - contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); - contextMapper.setExpectedValues(ALL_VALUES); - List list = tested.search() + this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.contextMapper.setExpectedValues(ALL_VALUES); + List list = this.tested.search() .query(query().base(BASE_NAME).where("objectclass").is("person").and("sn").is("Person2")) - .toList(contextMapper); + .toList(this.contextMapper); assertThat(list).hasSize(1); } @Test public void testSearchForStream_ContextMapper_LdapQuery() { - contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); - contextMapper.setExpectedValues(ALL_VALUES); - List list = tested.search() + this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.contextMapper.setExpectedValues(ALL_VALUES); + List list = this.tested.search() .query(query().base(BASE_NAME).where("objectclass").is("person").and("sn").is("Person2")) - .toStream(contextMapper).collect(Collectors.toList()); + .toStream(this.contextMapper).collect(Collectors.toList()); assertThat(list).hasSize(1); } @Test public void testSearch_ContextMapper_LdapQuery_NoBase() { - contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); - contextMapper.setExpectedValues(ALL_VALUES); - List list = tested.search() - .query(query().where("objectclass").is("person").and("sn").is("Person2")).toList(contextMapper); + this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.contextMapper.setExpectedValues(ALL_VALUES); + List list = this.tested.search() + .query(query().where("objectclass").is("person").and("sn").is("Person2")).toList(this.contextMapper); assertThat(list).hasSize(1); } @Test public void testSearchForStream_ContextMapper_LdapQuery_NoBase() { - contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); - contextMapper.setExpectedValues(ALL_VALUES); - List list = tested.search() - .query(query().where("objectclass").is("person").and("sn").is("Person2")).toStream(contextMapper) + this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.contextMapper.setExpectedValues(ALL_VALUES); + List list = this.tested.search() + .query(query().where("objectclass").is("person").and("sn").is("Person2")).toStream(this.contextMapper) .collect(Collectors.toList()); assertThat(list).hasSize(1); } @Test public void testSearch_ContextMapper_LdapQuery_SearchScope() { - contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); - contextMapper.setExpectedValues(ALL_VALUES); - List list = tested.search().query(query().base(BASE_NAME).searchScope(SearchScope.ONELEVEL) - .where("objectclass").is("person").and("sn").is("Person2")).toList(contextMapper); + this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.contextMapper.setExpectedValues(ALL_VALUES); + List list = this.tested.search().query(query().base(BASE_NAME).searchScope(SearchScope.ONELEVEL) + .where("objectclass").is("person").and("sn").is("Person2")).toList(this.contextMapper); assertThat(list).isEmpty(); } @Test public void testSearchForStream_ContextMapper_LdapQuery_SearchScope() { - contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); - contextMapper.setExpectedValues(ALL_VALUES); - List list = tested.search().query(query().base(BASE_NAME).searchScope(SearchScope.ONELEVEL) - .where("objectclass").is("person").and("sn").is("Person2")).toStream(contextMapper) + this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.contextMapper.setExpectedValues(ALL_VALUES); + List list = this.tested.search().query(query().base(BASE_NAME).searchScope(SearchScope.ONELEVEL) + .where("objectclass").is("person").and("sn").is("Person2")).toStream(this.contextMapper) .collect(Collectors.toList()); assertThat(list).isEmpty(); } @Test public void testSearch_ContextMapper_LdapQuery_SearchScope_CorrectBase() { - contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); - contextMapper.setExpectedValues(ALL_VALUES); - List list = tested.search().query(query().base("ou=company1,ou=Sweden") + this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.contextMapper.setExpectedValues(ALL_VALUES); + List list = this.tested.search().query(query().base("ou=company1,ou=Sweden") .searchScope(SearchScope.ONELEVEL).where("objectclass").is("person").and("sn").is("Person2")) - .toList(contextMapper); + .toList(this.contextMapper); assertThat(list).hasSize(1); } @Test public void testSearchForStream_ContextMapper_LdapQuery_SearchScope_CorrectBase() { - contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); - contextMapper.setExpectedValues(ALL_VALUES); - List list = tested + this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.contextMapper.setExpectedValues(ALL_VALUES); + List list = this.tested .search().query(query().base("ou=company1,ou=Sweden").searchScope(SearchScope.ONELEVEL) .where("objectclass").is("person").and("sn").is("Person2")) - .toStream(contextMapper).collect(Collectors.toList()); + .toStream(this.contextMapper).collect(Collectors.toList()); assertThat(list).hasSize(1); } @Test public void testSearchForContext_LdapQuery() { ContextMapper mapper = (result) -> (DirContextOperations) result; - DirContextOperations result = tested.search() + DirContextOperations result = this.tested.search() .query(query().where("objectclass").is("person").and("sn").is("Person2")).toObject(mapper); assertThat(result).isNotNull(); assertThat(result.getStringAttribute("sn")).isEqualTo("Person2"); @@ -432,16 +432,16 @@ public class DefaultLdapClientSearchResultITests extends AbstractLdapTemplateInt @Test // (expected = EmptyResultDataAccessException.class) public void testSearchForContext_LdapQuery_SearchScopeNotFound() { - Object result = tested.search().query( + Object result = this.tested.search().query( query().searchScope(SearchScope.ONELEVEL).where("objectclass").is("person").and("sn").is("Person2")) - .toObject(attributesMapper); + .toObject(this.attributesMapper); assertThat(result).isNull(); } @Test public void testSearchForContext_LdapQuery_SearchScope_CorrectBase() { ContextMapper mapper = (result) -> (DirContextOperations) result; - DirContextOperations result = tested.search().query(query().searchScope(SearchScope.ONELEVEL) + DirContextOperations result = this.tested.search().query(query().searchScope(SearchScope.ONELEVEL) .base("ou=company1,ou=Sweden").where("objectclass").is("person").and("sn").is("Person2")) .toObject(mapper); @@ -451,30 +451,30 @@ public class DefaultLdapClientSearchResultITests extends AbstractLdapTemplateInt @Test public void testSearch_SearchScope_ContextMapper_Name() { - contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); - contextMapper.setExpectedValues(ALL_VALUES); - List list = tested.search() + this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.contextMapper.setExpectedValues(ALL_VALUES); + List list = this.tested.search() .query(query().base(BASE_NAME).searchScope(SearchScope.SUBTREE).filter(FILTER_STRING)) - .toList(contextMapper); + .toList(this.contextMapper); assertThat(list).hasSize(1); } @Test public void testSearch_SearchScope_LimitedAttrs_ContextMapper_Name() { - contextMapper.setExpectedAttributes(CN_SN_ATTRS); - contextMapper.setExpectedValues(CN_SN_VALUES); - contextMapper.setAbsentAttributes(ABSENT_ATTRIBUTES); - List list = tested.search().query( + this.contextMapper.setExpectedAttributes(CN_SN_ATTRS); + this.contextMapper.setExpectedValues(CN_SN_VALUES); + this.contextMapper.setAbsentAttributes(ABSENT_ATTRIBUTES); + List list = this.tested.search().query( query().base(BASE_NAME).searchScope(SearchScope.SUBTREE).attributes(CN_SN_ATTRS).filter(FILTER_STRING)) - .toList(contextMapper); + .toList(this.contextMapper); assertThat(list).hasSize(1); } @Test public void testSearchWithInvalidSearchBaseShouldByDefaultThrowException() { try { - tested.search().query(query().base(BASE_NAME + "ou=unknown").searchScope(SearchScope.SUBTREE) - .attributes(CN_SN_ATTRS).filter(FILTER_STRING)).toObject(contextMapper); + this.tested.search().query(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) { @@ -484,18 +484,18 @@ public class DefaultLdapClientSearchResultITests extends AbstractLdapTemplateInt @Test public void testSearchWithInvalidSearchBaseCanBeConfiguredToSwallowException() { - ReflectionTestUtils.setField(tested, "ignoreNameNotFoundException", true); - contextMapper.setExpectedAttributes(CN_SN_ATTRS); - contextMapper.setExpectedValues(CN_SN_VALUES); - contextMapper.setAbsentAttributes(ABSENT_ATTRIBUTES); - List list = tested.search().query(query().base(BASE_NAME + "ou=unknown") - .searchScope(SearchScope.SUBTREE).attributes(CN_SN_ATTRS).filter(FILTER_STRING)).toList(contextMapper); + ReflectionTestUtils.setField(this.tested, "ignoreNameNotFoundException", true); + this.contextMapper.setExpectedAttributes(CN_SN_ATTRS); + this.contextMapper.setExpectedValues(CN_SN_VALUES); + this.contextMapper.setAbsentAttributes(ABSENT_ATTRIBUTES); + List list = this.tested.search().query(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 = tested.search().query(query().countLimit(3).where("objectclass").is("person")) + List result = this.tested.search().query(query().countLimit(3).where("objectclass").is("person")) .toList((Object ctx) -> new Object()); assertThat(result).hasSize(3); @@ -503,8 +503,8 @@ public class DefaultLdapClientSearchResultITests extends AbstractLdapTemplateInt @Test(expected = SizeLimitExceededException.class) public void verifyThatSearchWithCountLimitWithFlagToFalseThrowsException() { - ReflectionTestUtils.setField(tested, "ignoreSizeLimitExceededException", false); - tested.search().query(query().countLimit(3).where("objectclass").is("person")).toList((Object ctx) -> ctx); + ReflectionTestUtils.setField(this.tested, "ignoreSizeLimitExceededException", false); + this.tested.search().query(query().countLimit(3).where("objectclass").is("person")).toList((Object ctx) -> ctx); } } diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/itest/InvalidBackslashITests.java b/test/integration-tests/src/test/java/org/springframework/ldap/itest/InvalidBackslashITests.java index 25268b04..899bfb16 100644 --- a/test/integration-tests/src/test/java/org/springframework/ldap/itest/InvalidBackslashITests.java +++ b/test/integration-tests/src/test/java/org/springframework/ldap/itest/InvalidBackslashITests.java @@ -58,13 +58,13 @@ public class InvalidBackslashITests extends AbstractLdapTemplateIntegrationTests adapter.setAttributeValue("sn", "Person6"); adapter.setAttributeValue("description", "Some description"); - tested.unbind(DN); - tested.bind(DN, adapter, null); + this.tested.unbind(DN); + this.tested.bind(DN, adapter, null); } @After public void cleanup() throws Exception { - tested.unbind(DN); + this.tested.unbind(DN); } /** @@ -93,7 +93,7 @@ public class InvalidBackslashITests extends AbstractLdapTemplateIntegrationTests @Test @Category(NoAdTests.class) public void testSearchForDnSpoiledByCompositeName() throws InvalidNameException { - List result = tested.search("", "(sn=Person6)", new AbstractContextMapper() { + List result = this.tested.search("", "(sn=Person6)", new AbstractContextMapper() { @Override protected Object doMapFromContext(DirContextOperations ctx) { LdapName dn = (LdapName) ctx.getDn(); diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateAttributesMapperITests.java b/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateAttributesMapperITests.java index fe2fa77e..ed01414c 100644 --- a/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateAttributesMapperITests.java +++ b/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateAttributesMapperITests.java @@ -46,7 +46,7 @@ public class LdapTemplateAttributesMapperITests extends AbstractLdapTemplateInte @Test public void testSearch_AttributeMapper() throws Exception { AttributesMapper mapper = new PersonAttributesMapper(); - List result = tested.search("ou=company1,ou=Sweden", "(&(objectclass=person)(sn=Person2))", mapper); + List result = this.tested.search("ou=company1,ou=Sweden", "(&(objectclass=person)(sn=Person2))", mapper); assertThat(result).hasSize(1); Person person = (Person) result.get(0); @@ -74,7 +74,7 @@ public class LdapTemplateAttributesMapperITests extends AbstractLdapTemplateInte return members; } }; - List result = tested.search("ou=groups", "(&(objectclass=groupOfUniqueNames)(cn=ROLE_USER))", mapper); + List result = this.tested.search("ou=groups", "(&(objectclass=groupOfUniqueNames)(cn=ROLE_USER))", mapper); assertThat(result).hasSize(1); 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 e38e28c8..928d7661 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 @@ -56,7 +56,7 @@ public class LdapTemplateAuthenticationITests extends AbstractLdapTemplateIntegr public void testAuthenticate() { AndFilter filter = new AndFilter(); filter.and(new EqualsFilter("objectclass", "person")).and(new EqualsFilter("uid", "some.person3")); - assertThat(tested.authenticate("", filter.toString(), "password")).isTrue(); + assertThat(this.tested.authenticate("", filter.toString(), "password")).isTrue(); } @Test @@ -64,7 +64,7 @@ public class LdapTemplateAuthenticationITests extends AbstractLdapTemplateIntegr public void testAuthenticateWithLdapQuery() { AndFilter filter = new AndFilter(); filter.and(new EqualsFilter("objectclass", "person")).and(new EqualsFilter("uid", "some.person3")); - tested.authenticate(query().where("objectclass").is("person").and("uid").is("some.person3"), "password"); + this.tested.authenticate(query().where("objectclass").is("person").and("uid").is("some.person3"), "password"); } @Test @@ -72,7 +72,7 @@ public class LdapTemplateAuthenticationITests extends AbstractLdapTemplateIntegr public void testAuthenticateWithInvalidPassword() { AndFilter filter = new AndFilter(); filter.and(new EqualsFilter("objectclass", "person")).and(new EqualsFilter("uid", "some.person3")); - assertThat(tested.authenticate("", filter.toString(), "invalidpassword")).isFalse(); + assertThat(this.tested.authenticate("", filter.toString(), "invalidpassword")).isFalse(); } @Test(expected = AuthenticationException.class) @@ -80,7 +80,7 @@ public class LdapTemplateAuthenticationITests extends AbstractLdapTemplateIntegr public void testAuthenticateWithLdapQueryAndInvalidPassword() { AndFilter filter = new AndFilter(); filter.and(new EqualsFilter("objectclass", "person")).and(new EqualsFilter("uid", "some.person3")); - tested.authenticate(query().where("objectclass").is("person").and("uid").is("some.person3"), "invalidpassword"); + this.tested.authenticate(query().where("objectclass").is("person").and("uid").is("some.person3"), "invalidpassword"); } @Test @@ -99,13 +99,13 @@ public class LdapTemplateAuthenticationITests extends AbstractLdapTemplateIntegr } } }; - assertThat(tested.authenticate("", filter.toString(), "password", contextCallback)).isTrue(); + assertThat(this.tested.authenticate("", filter.toString(), "password", contextCallback)).isTrue(); } @Test @Category(NoAdTests.class) public void testAuthenticateWithLdapQueryAndMapper() { - DirContextOperations ctx = tested.authenticate( + DirContextOperations ctx = this.tested.authenticate( query().where("objectclass").is("person").and("uid").is("some.person3"), "password", new LookupAttemptingCallback()); @@ -116,7 +116,7 @@ public class LdapTemplateAuthenticationITests extends AbstractLdapTemplateIntegr @Test(expected = AuthenticationException.class) @Category(NoAdTests.class) public void testAuthenticateWithLdapQueryAndMapperAndInvalidPassword() { - DirContextOperations ctx = tested.authenticate( + DirContextOperations ctx = this.tested.authenticate( query().where("objectclass").is("person").and("uid").is("some.person3"), "invalidpassword", new LookupAttemptingCallback()); } @@ -127,7 +127,7 @@ public class LdapTemplateAuthenticationITests extends AbstractLdapTemplateIntegr AndFilter filter = new AndFilter(); filter.and(new EqualsFilter("objectclass", "person")).and(new EqualsFilter("uid", "some.person3")); final CollectingAuthenticationErrorCallback errorCallback = new CollectingAuthenticationErrorCallback(); - assertThat(tested.authenticate("", filter.toString(), "invalidpassword", errorCallback)).isFalse(); + assertThat(this.tested.authenticate("", filter.toString(), "invalidpassword", errorCallback)).isFalse(); final Exception error = errorCallback.getError(); assertThat(error).as("collected error should not be null").isNotNull(); assertThat(error instanceof AuthenticationException) @@ -142,7 +142,7 @@ public class LdapTemplateAuthenticationITests extends AbstractLdapTemplateIntegr AndFilter filter = new AndFilter(); filter.and(new EqualsFilter("objectclass", "person")) .and(new EqualsFilter("uid", "some.person.that.isnt.there")); - assertThat(tested.authenticate("", filter.toString(), "password")).isFalse(); + assertThat(this.tested.authenticate("", filter.toString(), "password")).isFalse(); } @Test(expected = IncorrectResultSizeDataAccessException.class) @@ -150,7 +150,7 @@ public class LdapTemplateAuthenticationITests extends AbstractLdapTemplateIntegr public void testAuthenticateWithFilterThatMatchesSeveralEntries() { AndFilter filter = new AndFilter(); filter.and(new EqualsFilter("objectclass", "person")).and(new EqualsFilter("cn", "Some Person")); - tested.authenticate("", filter.toString(), "password"); + this.tested.authenticate("", filter.toString(), "password"); } @Test @@ -159,7 +159,7 @@ public class LdapTemplateAuthenticationITests extends AbstractLdapTemplateIntegr AndFilter filter = new AndFilter(); filter.and(new EqualsFilter("objectclass", "person")).and(new EqualsFilter("uid", "some.person3")); LookupAttemptingCallback callback = new LookupAttemptingCallback(); - assertThat(tested.authenticate("", filter.encode(), "password", callback)).isTrue(); + assertThat(this.tested.authenticate("", filter.encode(), "password", callback)).isTrue(); } } diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateBindUnbindITests.java b/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateBindUnbindITests.java index 67d0ce01..7ed92820 100644 --- a/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateBindUnbindITests.java +++ b/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateBindUnbindITests.java @@ -52,9 +52,9 @@ public class LdapTemplateBindUnbindITests extends AbstractLdapTemplateIntegratio @Test public void testBindAndUnbindWithAttributes() { Attributes attributes = setupAttributes(); - tested.bind(DN, null, attributes); + this.tested.bind(DN, null, attributes); verifyBoundCorrectData(); - tested.unbind(DN); + this.tested.unbind(DN); verifyCleanup(); } @@ -65,15 +65,15 @@ public class LdapTemplateBindUnbindITests extends AbstractLdapTemplateIntegratio ctx.addAttributeValue("objectclass", "top"); ctx.addAttributeValue("objectclass", "groupOfUniqueNames"); ctx.addAttributeValue("uniqueMember", LdapUtils.newLdapName("cn=Some Person,ou=company1,ou=Sweden," + base)); - tested.bind(ctx); + this.tested.bind(ctx); } @Test public void testBindAndUnbindWithAttributesUsingLdapName() { Attributes attributes = setupAttributes(); - tested.bind(LdapUtils.newLdapName(DN), null, attributes); + this.tested.bind(LdapUtils.newLdapName(DN), null, attributes); verifyBoundCorrectData(); - tested.unbind(LdapUtils.newLdapName(DN)); + this.tested.unbind(LdapUtils.newLdapName(DN)); verifyCleanup(); } @@ -84,9 +84,9 @@ public class LdapTemplateBindUnbindITests extends AbstractLdapTemplateIntegratio adapter.setAttributeValue("cn", "Some Person4"); adapter.setAttributeValue("sn", "Person4"); - tested.bind(DN, adapter, null); + this.tested.bind(DN, adapter, null); verifyBoundCorrectData(); - tested.unbind(DN); + this.tested.unbind(DN); verifyCleanup(); } @@ -97,9 +97,9 @@ public class LdapTemplateBindUnbindITests extends AbstractLdapTemplateIntegratio adapter.setAttributeValue("cn", "Some Person4"); adapter.setAttributeValue("sn", "Person4"); - tested.bind(LdapUtils.newLdapName(DN), adapter, null); + this.tested.bind(LdapUtils.newLdapName(DN), adapter, null); verifyBoundCorrectData(); - tested.unbind(LdapUtils.newLdapName(DN)); + this.tested.unbind(LdapUtils.newLdapName(DN)); verifyCleanup(); } @@ -110,9 +110,9 @@ public class LdapTemplateBindUnbindITests extends AbstractLdapTemplateIntegratio adapter.setAttributeValue("cn", "Some Person4"); adapter.setAttributeValue("sn", "Person4"); - tested.bind(adapter); + this.tested.bind(adapter); verifyBoundCorrectData(); - tested.unbind(DN); + this.tested.unbind(DN); verifyCleanup(); } @@ -123,12 +123,12 @@ public class LdapTemplateBindUnbindITests extends AbstractLdapTemplateIntegratio adapter.setAttributeValue("cn", "Some Person4"); adapter.setAttributeValue("sn", "Person4"); - tested.bind(adapter); + this.tested.bind(adapter); verifyBoundCorrectData(); adapter.setAttributeValue("sn", "Person4.Changed"); - tested.rebind(adapter); + this.tested.rebind(adapter); verifyReboundCorrectData(); - tested.unbind(DN); + this.tested.unbind(DN); verifyCleanup(); } @@ -144,20 +144,20 @@ public class LdapTemplateBindUnbindITests extends AbstractLdapTemplateIntegratio } private void verifyBoundCorrectData() { - DirContextAdapter result = (DirContextAdapter) tested.lookup(DN); + DirContextAdapter result = (DirContextAdapter) this.tested.lookup(DN); assertThat(result.getStringAttribute("cn")).isEqualTo("Some Person4"); assertThat(result.getStringAttribute("sn")).isEqualTo("Person4"); } private void verifyReboundCorrectData() { - DirContextAdapter result = (DirContextAdapter) tested.lookup(DN); + DirContextAdapter result = (DirContextAdapter) this.tested.lookup(DN); assertThat(result.getStringAttribute("cn")).isEqualTo("Some Person4"); assertThat(result.getStringAttribute("sn")).isEqualTo("Person4.Changed"); } private void verifyCleanup() { try { - tested.lookup(DN); + this.tested.lookup(DN); fail("NameNotFoundException expected"); } catch (NameNotFoundException expected) { diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateContextExecutorTests.java b/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateContextExecutorTests.java index 8f493dc0..d2caf5ef 100644 --- a/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateContextExecutorTests.java +++ b/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateContextExecutorTests.java @@ -47,7 +47,7 @@ public class LdapTemplateContextExecutorTests extends AbstractLdapTemplateIntegr } }; - Object object = tested.executeReadOnly(executor); + Object object = this.tested.executeReadOnly(executor); assertThat(object instanceof DirContextAdapter).as("Should be a DirContextAdapter").isTrue(); } diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateContextMapperITests.java b/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateContextMapperITests.java index 4091f0d6..211aa664 100644 --- a/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateContextMapperITests.java +++ b/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateContextMapperITests.java @@ -48,7 +48,7 @@ public class LdapTemplateContextMapperITests extends AbstractLdapTemplateIntegra @Test public void testSearch_ContextMapper() { ContextMapper mapper = new PersonContextMapper(); - List result = tested.search("ou=company1,ou=Sweden", "(&(objectclass=person)(sn=Person2))", mapper); + List result = this.tested.search("ou=company1,ou=Sweden", "(&(objectclass=person)(sn=Person2))", mapper); assertThat(result).hasSize(1); Person person = (Person) result.get(0); @@ -71,7 +71,7 @@ public class LdapTemplateContextMapperITests extends AbstractLdapTemplateIntegra return members; } }; - List result = tested.search("ou=groups", "(&(objectclass=groupOfUniqueNames)(cn=ROLE_USER))", mapper); + List result = this.tested.search("ou=groups", "(&(objectclass=groupOfUniqueNames)(cn=ROLE_USER))", mapper); assertThat(result).hasSize(1); assertThat(((String[]) result.get(0)).length).isEqualTo(4); diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateListITests.java b/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateListITests.java index f9a1d14c..9096a4dd 100644 --- a/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateListITests.java +++ b/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateListITests.java @@ -57,35 +57,35 @@ public class LdapTemplateListITests extends AbstractLdapTemplateIntegrationTests @Before public void prepareTestedInstance() throws Exception { - contextMapper = new AttributeCheckContextMapper(); + this.contextMapper = new AttributeCheckContextMapper(); } @After public void tearDown() throws Exception { - contextMapper = null; + this.contextMapper = null; } @Test public void testListBindings_ContextMapper() { - contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); - contextMapper.setExpectedValues(ALL_VALUES); - List list = tested.listBindings("ou=company2,ou=Sweden" + BASE_STRING, contextMapper); + this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.contextMapper.setExpectedValues(ALL_VALUES); + List list = this.tested.listBindings("ou=company2,ou=Sweden" + BASE_STRING, this.contextMapper); assertThat(list).hasSize(1); } @Test public void testListBindings_ContextMapper_Name() { - contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); - contextMapper.setExpectedValues(ALL_VALUES); + this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.contextMapper.setExpectedValues(ALL_VALUES); LdapName dn = LdapUtils.newLdapName("ou=company2,ou=Sweden"); - List list = tested.listBindings(dn, contextMapper); + List list = this.tested.listBindings(dn, this.contextMapper); assertThat(list).hasSize(1); } @Test public void testListBindings_ContextMapper_MapToPersons() { LdapName dn = LdapUtils.newLdapName("ou=company1,ou=Sweden"); - List list = tested.listBindings(dn, new PersonContextMapper()); + List list = this.tested.listBindings(dn, new PersonContextMapper()); assertThat(list).hasSize(3); String personClass = "org.springframework.ldap.itest.Person"; assertThat(list.get(0).getClass().getName()).isEqualTo(personClass); @@ -95,7 +95,7 @@ public class LdapTemplateListITests extends AbstractLdapTemplateIntegrationTests @Test public void testList() { - List list = tested.list(BASE_STRING); + List list = this.tested.list(BASE_STRING); assertThat(list).hasSize(3); verifyBindings(list); } @@ -114,7 +114,7 @@ public class LdapTemplateListITests extends AbstractLdapTemplateIntegrationTests @Test public void testList_Name() { - List list = tested.list(BASE_NAME); + List list = this.tested.list(BASE_NAME); assertThat(list).hasSize(3); verifyBindings(list); } @@ -122,41 +122,41 @@ public class LdapTemplateListITests extends AbstractLdapTemplateIntegrationTests @Test public void testList_Handler() throws Exception { CountNameClassPairCallbackHandler handler = new CountNameClassPairCallbackHandler(); - tested.list(BASE_STRING, handler); + this.tested.list(BASE_STRING, handler); assertThat(handler.getNoOfRows()).isEqualTo(3); } @Test public void testList_Name_Handler() throws Exception { CountNameClassPairCallbackHandler handler = new CountNameClassPairCallbackHandler(); - tested.list(BASE_NAME, handler); + this.tested.list(BASE_NAME, handler); assertThat(handler.getNoOfRows()).isEqualTo(3); } @Test public void testListBindings() { - List list = tested.listBindings(BASE_STRING); + List list = this.tested.listBindings(BASE_STRING); assertThat(list).hasSize(3); verifyBindings(list); } @Test public void testListBindings_Name() { - List list = tested.listBindings(BASE_NAME); + List list = this.tested.listBindings(BASE_NAME); assertThat(list).hasSize(3); } @Test public void testListBindings_Handler() throws Exception { CountNameClassPairCallbackHandler handler = new CountNameClassPairCallbackHandler(); - tested.listBindings(BASE_STRING, handler); + this.tested.listBindings(BASE_STRING, handler); assertThat(handler.getNoOfRows()).isEqualTo(3); } @Test public void testListBindings_Name_Handler() throws Exception { CountNameClassPairCallbackHandler handler = new CountNameClassPairCallbackHandler(); - tested.listBindings(BASE_NAME, handler); + this.tested.listBindings(BASE_NAME, handler); assertThat(handler.getNoOfRows()).isEqualTo(3); } diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateLookupITests.java b/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateLookupITests.java index c14d3227..4786f0e3 100644 --- a/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateLookupITests.java +++ b/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateLookupITests.java @@ -51,7 +51,7 @@ public class LdapTemplateLookupITests extends AbstractLdapTemplateIntegrationTes */ @Test public void testLookup_Plain() { - DirContextAdapter result = (DirContextAdapter) tested.lookup("cn=Some Person2, ou=company1,ou=Sweden"); + DirContextAdapter result = (DirContextAdapter) this.tested.lookup("cn=Some Person2, ou=company1,ou=Sweden"); assertThat(result.getStringAttribute("cn")).isEqualTo("Some Person2"); assertThat(result.getStringAttribute("sn")).isEqualTo("Person2"); @@ -65,7 +65,7 @@ public class LdapTemplateLookupITests extends AbstractLdapTemplateIntegrationTes */ @Test public void testLookupContextRoot() { - DirContextAdapter result = (DirContextAdapter) tested.lookup(""); + DirContextAdapter result = (DirContextAdapter) this.tested.lookup(""); assertThat(result.getDn().toString()).isEqualTo(""); assertThat(result.getNameInNamespace()).isEqualTo(base); @@ -74,7 +74,7 @@ public class LdapTemplateLookupITests extends AbstractLdapTemplateIntegrationTes @Test public void testLookup_AttributesMapper() { AttributesMapper mapper = new PersonAttributesMapper(); - Person person = (Person) tested.lookup("cn=Some Person2, ou=company1,ou=Sweden", mapper); + Person person = (Person) this.tested.lookup("cn=Some Person2, ou=company1,ou=Sweden", mapper); assertThat(person.getFullname()).isEqualTo("Some Person2"); assertThat(person.getLastname()).isEqualTo("Person2"); @@ -84,7 +84,7 @@ public class LdapTemplateLookupITests extends AbstractLdapTemplateIntegrationTes @Test public void testLookup_AttributesMapper_LdapName() { AttributesMapper mapper = new PersonAttributesMapper(); - Person person = (Person) tested.lookup(LdapUtils.newLdapName("cn=Some Person2, ou=company1,ou=Sweden"), mapper); + Person person = (Person) this.tested.lookup(LdapUtils.newLdapName("cn=Some Person2, ou=company1,ou=Sweden"), mapper); assertThat(person.getFullname()).isEqualTo("Some Person2"); assertThat(person.getLastname()).isEqualTo("Person2"); @@ -123,7 +123,7 @@ public class LdapTemplateLookupITests extends AbstractLdapTemplateIntegrationTes public void testLookup_ReturnAttributes_AttributesMapper() { AttributesMapper mapper = new SubsetPersonAttributesMapper(); - Person person = (Person) tested.lookup("cn=Some Person2, ou=company1,ou=Sweden", new String[] { "cn" }, mapper); + Person person = (Person) this.tested.lookup("cn=Some Person2, ou=company1,ou=Sweden", new String[] { "cn" }, mapper); assertThat(person.getFullname()).isEqualTo("Some Person2"); assertThat(person.getLastname()).as("lastName should not be set").isNull(); @@ -137,7 +137,7 @@ public class LdapTemplateLookupITests extends AbstractLdapTemplateIntegrationTes @Test public void testLookup_ReturnAttributes_AttributesMapper_LdapName() { AttributesMapper mapper = new SubsetPersonAttributesMapper(); - Person person = (Person) tested.lookup(LdapUtils.newLdapName("cn=Some Person2, ou=company1,ou=Sweden"), + Person person = (Person) this.tested.lookup(LdapUtils.newLdapName("cn=Some Person2, ou=company1,ou=Sweden"), new String[] { "cn" }, mapper); assertThat(person.getFullname()).isEqualTo("Some Person2"); @@ -153,7 +153,7 @@ public class LdapTemplateLookupITests extends AbstractLdapTemplateIntegrationTes @Test public void testLookup_ContextMapper() { ContextMapper mapper = new PersonContextMapper(); - Person person = (Person) tested.lookup("cn=Some Person2, ou=company1,ou=Sweden", mapper); + Person person = (Person) this.tested.lookup("cn=Some Person2, ou=company1,ou=Sweden", mapper); assertThat(person.getFullname()).isEqualTo("Some Person2"); assertThat(person.getLastname()).isEqualTo("Person2"); @@ -168,7 +168,7 @@ public class LdapTemplateLookupITests extends AbstractLdapTemplateIntegrationTes public void testLookup_ReturnAttributes_ContextMapper() { ContextMapper mapper = new PersonContextMapper(); - Person person = (Person) tested.lookup("cn=Some Person2, ou=company1,ou=Sweden", new String[] { "cn" }, mapper); + Person person = (Person) this.tested.lookup("cn=Some Person2, ou=company1,ou=Sweden", new String[] { "cn" }, mapper); assertThat(person.getFullname()).isEqualTo("Some Person2"); assertThat(person.getLastname()).as("lastName should not be set").isNull(); @@ -178,7 +178,7 @@ public class LdapTemplateLookupITests extends AbstractLdapTemplateIntegrationTes @Test public void testLookup_GetNameInNamespace_Plain() { String expectedDn = "cn=Some Person2, ou=company1,ou=Sweden"; - DirContextAdapter result = (DirContextAdapter) tested.lookup(expectedDn); + DirContextAdapter result = (DirContextAdapter) this.tested.lookup(expectedDn); LdapName expectedName = LdapUtils.newLdapName(expectedDn); assertThat(result.getDn()).isEqualTo(expectedName); 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 72ef32c0..4d60b39f 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 @@ -53,7 +53,7 @@ public class LdapTemplateLookupMultiRdnITests extends AbstractLdapTemplateIntegr @Category(NoAdTests.class) public void testLookup_MultiValuedRdn() { AttributesMapper mapper = new PersonAttributesMapper(); - Person person = (Person) tested.lookup("cn=Some Person+sn=Person, ou=company1,ou=Norway", mapper); + Person person = (Person) this.tested.lookup("cn=Some Person+sn=Person, ou=company1,ou=Norway", mapper); assertThat(person.getFullname()).isEqualTo("Some Person"); assertThat(person.getLastname()).isEqualTo("Person"); @@ -68,7 +68,7 @@ public class LdapTemplateLookupMultiRdnITests extends AbstractLdapTemplateIntegr @Test @Category(NoAdTests.class) public void testLookup_MultiValuedRdn_DirContextAdapter() { - DirContextAdapter result = (DirContextAdapter) tested.lookup("cn=Some Person+sn=Person, ou=company1,ou=Norway"); + DirContextAdapter result = (DirContextAdapter) this.tested.lookup("cn=Some Person+sn=Person, ou=company1,ou=Norway"); assertThat(result.getStringAttribute("cn")).isEqualTo("Some Person"); assertThat(result.getStringAttribute("sn")).isEqualTo("Person"); @@ -78,7 +78,7 @@ public class LdapTemplateLookupMultiRdnITests extends AbstractLdapTemplateIntegr @Test @Category(NoAdTests.class) public void testLookup_GetNameInNamespace_MultiRdn() { - DirContextAdapter result = (DirContextAdapter) tested.lookup("cn=Some Person+sn=Person,ou=company1,ou=Norway"); + DirContextAdapter result = (DirContextAdapter) this.tested.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/LdapTemplateModifyITests.java b/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateModifyITests.java index 86338505..0721250c 100644 --- a/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateModifyITests.java +++ b/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateModifyITests.java @@ -70,7 +70,7 @@ public class LdapTemplateModifyITests extends AbstractLdapTemplateIntegrationTes adapter.setAttributeValue("sn", "Person4"); adapter.setAttributeValue("description", "Some description"); - tested.bind(PERSON4_DN, adapter, null); + this.tested.bind(PERSON4_DN, adapter, null); adapter = new DirContextAdapter(); adapter.setAttributeValues("objectclass", new String[] { "top", "person" }); @@ -78,21 +78,21 @@ public class LdapTemplateModifyITests extends AbstractLdapTemplateIntegrationTes adapter.setAttributeValue("sn", "Person5"); adapter.setAttributeValues("description", new String[] { "qwe", "123", "rty", "uio" }); - tested.bind(PERSON5_DN, adapter, null); + this.tested.bind(PERSON5_DN, adapter, null); } @After public void cleanup() throws Exception { - tested.unbind(PERSON4_DN); - tested.unbind(PERSON5_DN); + this.tested.unbind(PERSON4_DN); + this.tested.unbind(PERSON5_DN); } @Test public void testRebind_Attributes_Plain() { Attributes attributes = setupAttributes(); - tested.rebind(PERSON4_DN, null, attributes); + this.tested.rebind(PERSON4_DN, null, attributes); verifyBoundCorrectData(); } @@ -101,7 +101,7 @@ public class LdapTemplateModifyITests extends AbstractLdapTemplateIntegrationTes public void testRebind_Attributes_LdapName() { Attributes attributes = setupAttributes(); - tested.rebind(LdapUtils.newLdapName(PERSON4_DN), null, attributes); + this.tested.rebind(LdapUtils.newLdapName(PERSON4_DN), null, attributes); verifyBoundCorrectData(); } @@ -113,9 +113,9 @@ public class LdapTemplateModifyITests extends AbstractLdapTemplateIntegrationTes ModificationItem[] mods = new ModificationItem[1]; mods[0] = new ModificationItem(DirContext.REPLACE_ATTRIBUTE, attr); - tested.modifyAttributes(PERSON4_DN, mods); + this.tested.modifyAttributes(PERSON4_DN, mods); - DirContextAdapter result = (DirContextAdapter) tested.lookup(PERSON4_DN); + DirContextAdapter result = (DirContextAdapter) this.tested.lookup(PERSON4_DN); List attributes = Arrays.asList(result.getStringAttributes("description")); assertThat(attributes).hasSize(2); assertThat(attributes.contains("Some other description")).isTrue(); @@ -129,9 +129,9 @@ public class LdapTemplateModifyITests extends AbstractLdapTemplateIntegrationTes ModificationItem[] mods = new ModificationItem[1]; mods[0] = new ModificationItem(DirContext.ADD_ATTRIBUTE, attr); - tested.modifyAttributes(PERSON4_DN, mods); + this.tested.modifyAttributes(PERSON4_DN, mods); - DirContextAdapter result = (DirContextAdapter) tested.lookup(PERSON4_DN); + DirContextAdapter result = (DirContextAdapter) this.tested.lookup(PERSON4_DN); List attributes = Arrays.asList(result.getStringAttributes("description")); assertThat(attributes).hasSize(3); assertThat(attributes.contains("Some other description")).isTrue(); @@ -141,9 +141,9 @@ public class LdapTemplateModifyITests extends AbstractLdapTemplateIntegrationTes @Test public void testModifyAttributes_AddAttributeValueWithExistingValue() { - DirContextOperations ctx = tested.lookupContext("cn=ROLE_USER,ou=groups"); + DirContextOperations ctx = this.tested.lookupContext("cn=ROLE_USER,ou=groups"); ctx.addAttributeValue("uniqueMember", "cn=Some Person,ou=company1,ou=Norway," + base); - tested.modifyAttributes(ctx); + this.tested.modifyAttributes(ctx); assertThat(true).isTrue(); } @@ -154,7 +154,7 @@ public class LdapTemplateModifyITests extends AbstractLdapTemplateIntegrationTes mods[0] = new ModificationItem(DirContext.ADD_ATTRIBUTE, attr); try { - tested.modifyAttributes(PERSON4_DN, mods); + this.tested.modifyAttributes(PERSON4_DN, mods); fail("AttributeInUseException expected"); } catch (AttributeInUseException expected) { @@ -176,9 +176,9 @@ public class LdapTemplateModifyITests extends AbstractLdapTemplateIntegrationTes ModificationItem[] mods = new ModificationItem[1]; mods[0] = new ModificationItem(DirContext.ADD_ATTRIBUTE, attr); - tested.modifyAttributes(PERSON4_DN, mods); + this.tested.modifyAttributes(PERSON4_DN, mods); - DirContextAdapter result = (DirContextAdapter) tested.lookup(PERSON4_DN); + DirContextAdapter result = (DirContextAdapter) this.tested.lookup(PERSON4_DN); List attributes = Arrays.asList(result.getStringAttributes("description")); assertThat(attributes).hasSize(3); assertThat(attributes.contains("Some other description")).isTrue(); @@ -191,7 +191,7 @@ public class LdapTemplateModifyITests extends AbstractLdapTemplateIntegrationTes ModificationItem item = new ModificationItem(DirContext.REPLACE_ATTRIBUTE, new BasicAttribute("description", "Some other description")); - tested.modifyAttributes(PERSON4_DN, new ModificationItem[] { item }); + this.tested.modifyAttributes(PERSON4_DN, new ModificationItem[] { item }); verifyBoundCorrectData(); } @@ -201,20 +201,20 @@ public class LdapTemplateModifyITests extends AbstractLdapTemplateIntegrationTes ModificationItem item = new ModificationItem(DirContext.REPLACE_ATTRIBUTE, new BasicAttribute("description", "Some other description")); - tested.modifyAttributes(LdapUtils.newLdapName(PERSON4_DN), new ModificationItem[] { item }); + this.tested.modifyAttributes(LdapUtils.newLdapName(PERSON4_DN), new ModificationItem[] { item }); verifyBoundCorrectData(); } @Test public void testModifyAttributes_DirContextAdapter_MultiAttributes() { - DirContextAdapter adapter = (DirContextAdapter) tested.lookup(PERSON5_DN); + DirContextAdapter adapter = (DirContextAdapter) this.tested.lookup(PERSON5_DN); adapter.setAttributeValues("description", new String[] { "qwe", "123", "klytt", "kalle" }); - tested.modifyAttributes(PERSON5_DN, adapter.getModificationItems()); + this.tested.modifyAttributes(PERSON5_DN, adapter.getModificationItems()); // Verify - adapter = (DirContextAdapter) tested.lookup(PERSON5_DN); + adapter = (DirContextAdapter) this.tested.lookup(PERSON5_DN); List attributes = Arrays.asList(adapter.getStringAttributes("description")); assertThat(attributes).hasSize(4); assertThat(attributes.contains("qwe")).isTrue(); @@ -230,23 +230,23 @@ public class LdapTemplateModifyITests extends AbstractLdapTemplateIntegrationTes */ @Test public void testModifyAttributes_DirContextAdapter() throws Exception { - DirContextAdapter adapter = (DirContextAdapter) tested.lookup(PERSON4_DN); + DirContextAdapter adapter = (DirContextAdapter) this.tested.lookup(PERSON4_DN); adapter.setAttributeValue("description", "Some other description"); ModificationItem[] modificationItems = adapter.getModificationItems(); - tested.modifyAttributes(PERSON4_DN, modificationItems); + this.tested.modifyAttributes(PERSON4_DN, modificationItems); verifyBoundCorrectData(); } @Test public void verifyCompleteReplacementOfUniqueMemberAttribute_Ldap119Workaround() { - DirContextOperations ctx = tested.lookupContext("cn=ROLE_USER,ou=groups"); + DirContextOperations ctx = this.tested.lookupContext("cn=ROLE_USER,ou=groups"); ctx.setAttributeValues("uniqueMember", new String[] { "cn=Some Person,ou=company1,ou=Norway," + base }, true); ctx.getModificationItems(); - tested.modifyAttributes(ctx); + this.tested.modifyAttributes(ctx); } /** @@ -255,11 +255,11 @@ public class LdapTemplateModifyITests extends AbstractLdapTemplateIntegrationTes */ @Test public void verifyCompleteReplacementOfUniqueMemberAttribute_Ldap119() { - DirContextOperations ctx = tested.lookupContext("cn=ROLE_USER,ou=groups"); + DirContextOperations ctx = this.tested.lookupContext("cn=ROLE_USER,ou=groups"); ctx.setAttributeValues("uniqueMember", new String[] { "cn=Some Person,ou=company1,ou=Norway," + base }); ctx.getModificationItems(); - tested.modifyAttributes(ctx); + this.tested.modifyAttributes(ctx); } private Attributes setupAttributes() { @@ -275,7 +275,7 @@ public class LdapTemplateModifyITests extends AbstractLdapTemplateIntegrationTes } private void verifyBoundCorrectData() { - DirContextAdapter result = (DirContextAdapter) tested.lookup(PERSON4_DN); + DirContextAdapter result = (DirContextAdapter) this.tested.lookup(PERSON4_DN); assertThat(result.getStringAttribute("cn")).isEqualTo("Some Person4"); assertThat(result.getStringAttribute("sn")).isEqualTo("Person4"); assertThat(result.getStringAttribute("description")).isEqualTo("Some other description"); 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 94d60d52..beddd3f7 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 @@ -59,7 +59,7 @@ public class LdapTemplateNoBaseSuffixITests extends AbstractLdapTemplateIntegrat @Test public void testLookup_Plain() { String expectedDn = "cn=Some Person2, ou=company1, ou=Sweden," + base; - DirContextAdapter result = (DirContextAdapter) tested.lookup(expectedDn); + DirContextAdapter result = (DirContextAdapter) this.tested.lookup(expectedDn); assertThat(result.getStringAttribute("cn")).isEqualTo("Some Person2"); assertThat(result.getStringAttribute("sn")).isEqualTo("Person2"); @@ -74,7 +74,7 @@ public class LdapTemplateNoBaseSuffixITests extends AbstractLdapTemplateIntegrat public void testSearch_Plain() { CountNameClassPairCallbackHandler handler = new CountNameClassPairCallbackHandler(); - tested.search(base, "(objectclass=person)", handler); + this.tested.search(base, "(objectclass=person)", handler); assertThat(handler.getNoOfRows()).isEqualTo(5); } @@ -84,17 +84,17 @@ public class LdapTemplateNoBaseSuffixITests extends AbstractLdapTemplateIntegrat adapter.setAttributeValues("objectclass", new String[] { "top", "person" }); adapter.setAttributeValue("cn", "Some Person4"); adapter.setAttributeValue("sn", "Person4"); - tested.bind("cn=Some Person4, ou=company1, ou=Sweden," + base, adapter, null); + this.tested.bind("cn=Some Person4, ou=company1, ou=Sweden," + base, adapter, null); - DirContextAdapter result = (DirContextAdapter) tested.lookup("cn=Some Person4, ou=company1, ou=Sweden," + base); + DirContextAdapter result = (DirContextAdapter) this.tested.lookup("cn=Some Person4, ou=company1, ou=Sweden," + base); assertThat(result.getStringAttribute("cn")).isEqualTo("Some Person4"); assertThat(result.getStringAttribute("sn")).isEqualTo("Person4"); assertThat(result.getDn()).isEqualTo(LdapUtils.newLdapName("cn=Some Person4,ou=company1,ou=Sweden," + base)); - tested.unbind("cn=Some Person4,ou=company1,ou=Sweden," + base); + this.tested.unbind("cn=Some Person4,ou=company1,ou=Sweden," + base); try { - tested.lookup("cn=Some Person4, ou=company1, ou=Sweden," + base); + this.tested.lookup("cn=Some Person4, ou=company1, ou=Sweden," + base); fail("NameNotFoundException expected"); } catch (NameNotFoundException expected) { diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplatePooledITests.java b/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplatePooledITests.java index 0479e54c..270ad946 100644 --- a/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplatePooledITests.java +++ b/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplatePooledITests.java @@ -62,10 +62,10 @@ public class LdapTemplatePooledITests extends AbstractJUnit4SpringContextTests { @Test public void verifyThatInvalidConnectionIsAutomaticallyPurged() throws Exception { LdapTestUtils.startEmbeddedServer(1888, "dc=261consulting,dc=com", "jayway"); - LdapTestUtils.cleanAndSetup(contextSource, LdapUtils.emptyLdapName(), + LdapTestUtils.cleanAndSetup(this.contextSource, LdapUtils.emptyLdapName(), new ClassPathResource("/setup_data.ldif")); - DirContextOperations result = tested.lookupContext("cn=Some Person2, ou=company1,ou=Sweden"); + DirContextOperations result = this.tested.lookupContext("cn=Some Person2, ou=company1,ou=Sweden"); assertThat(result.getStringAttribute("cn")).isEqualTo("Some Person2"); assertThat(result.getStringAttribute("sn")).isEqualTo("Person2"); assertThat(result.getStringAttribute("description")).isEqualTo("Sweden, Company1, Some Person2"); @@ -75,7 +75,7 @@ public class LdapTemplatePooledITests extends AbstractJUnit4SpringContextTests { LdapTestUtils.startEmbeddedServer(1888, "dc=261consulting,dc=com", "jayway"); try { - tested.lookup("cn=Some Person2, ou=company1,ou=Sweden"); + this.tested.lookup("cn=Some Person2, ou=company1,ou=Sweden"); fail("Exception expected"); } catch (Exception expected) { @@ -83,11 +83,11 @@ public class LdapTemplatePooledITests extends AbstractJUnit4SpringContextTests { assertThat(true).isTrue(); } - LdapTestUtils.cleanAndSetup(contextSource, LdapUtils.emptyLdapName(), + LdapTestUtils.cleanAndSetup(this.contextSource, LdapUtils.emptyLdapName(), new ClassPathResource("/setup_data.ldif")); // But this should be OK, because the dirty connection should have been // automatically purged. - tested.lookup("cn=Some Person2, ou=company1,ou=Sweden"); + this.tested.lookup("cn=Some Person2, ou=company1,ou=Sweden"); } } diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateRecursiveDeleteITests.java b/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateRecursiveDeleteITests.java index b3d6b2f0..04f607ff 100644 --- a/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateRecursiveDeleteITests.java +++ b/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateRecursiveDeleteITests.java @@ -61,42 +61,42 @@ public class LdapTemplateRecursiveDeleteITests extends AbstractLdapTemplateInteg adapter.setAttributeValue("cn", "Some Person5"); adapter.setAttributeValue("sn", "Person5"); adapter.setAttributeValue("description", "Some description"); - tested.bind(DN, adapter, null); + this.tested.bind(DN, adapter, null); - firstSubDn = LdapUtils.newLdapName("cn=subPerson"); - firstSubDn = LdapUtils.prepend(firstSubDn, DN); + this.firstSubDn = LdapUtils.newLdapName("cn=subPerson"); + this.firstSubDn = LdapUtils.prepend(this.firstSubDn, DN); adapter = new DirContextAdapter(); adapter.setAttributeValues("objectclass", new String[] { "top", "person" }); adapter.setAttributeValue("cn", "subPerson"); adapter.setAttributeValue("sn", "subPerson"); adapter.setAttributeValue("description", "Should be recursively deleted"); - tested.bind(firstSubDn, adapter, null); - secondSubDn = LdapUtils.newLdapName("cn=subPerson2"); - secondSubDn = LdapUtils.prepend(secondSubDn, DN); + this.tested.bind(this.firstSubDn, adapter, null); + this.secondSubDn = LdapUtils.newLdapName("cn=subPerson2"); + this.secondSubDn = LdapUtils.prepend(this.secondSubDn, DN); adapter = new DirContextAdapter(); adapter.setAttributeValues("objectclass", new String[] { "top", "person" }); adapter.setAttributeValue("cn", "subPerson2"); adapter.setAttributeValue("sn", "subPerson2"); adapter.setAttributeValue("description", "Should be recursively deleted"); - tested.bind(secondSubDn, adapter, null); + this.tested.bind(this.secondSubDn, adapter, null); - leafDn = LdapUtils.newLdapName("cn=subSubPerson"); - leafDn = LdapUtils.prepend(leafDn, DN); + this.leafDn = LdapUtils.newLdapName("cn=subSubPerson"); + this.leafDn = LdapUtils.prepend(this.leafDn, DN); adapter = new DirContextAdapter(); adapter.setAttributeValues("objectclass", new String[] { "top", "person" }); adapter.setAttributeValue("cn", "subSubPerson"); adapter.setAttributeValue("sn", "subSubPerson"); adapter.setAttributeValue("description", "Should be recursively deleted"); - tested.bind(leafDn, adapter, null); + this.tested.bind(this.leafDn, adapter, null); } @After public void cleanup() throws Exception { try { - tested.unbind(DN, true); + this.tested.unbind(DN, true); } catch (NameNotFoundException ignore) { // ignore @@ -106,24 +106,24 @@ public class LdapTemplateRecursiveDeleteITests extends AbstractLdapTemplateInteg @Test @Category(NoAdTests.class) public void testRecursiveUnbind() { - tested.unbind(DN, true); + this.tested.unbind(DN, true); verifyDeleted(DN); - verifyDeleted(firstSubDn); - verifyDeleted(secondSubDn); - verifyDeleted(leafDn); + verifyDeleted(this.firstSubDn); + verifyDeleted(this.secondSubDn); + verifyDeleted(this.leafDn); } @Test @Category(NoAdTests.class) public void testRecursiveUnbindOnLeaf() { - tested.unbind(leafDn, true); - verifyDeleted(leafDn); + this.tested.unbind(this.leafDn, true); + verifyDeleted(this.leafDn); } private void verifyDeleted(Name dn) { try { - tested.lookup(dn); + this.tested.lookup(dn); fail("Expected entry '" + dn + "' to be non-existent"); } catch (NameNotFoundException expected) { diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateRenameITests.java b/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateRenameITests.java index ec72c861..5e7a4ba0 100644 --- a/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateRenameITests.java +++ b/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateRenameITests.java @@ -58,18 +58,18 @@ public class LdapTemplateRenameITests extends AbstractLdapTemplateIntegrationTes adapter.setAttributeValue("sn", "Person6"); adapter.setAttributeValue("description", "Some description"); - tested.bind(DN, adapter, null); + this.tested.bind(DN, adapter, null); } @After public void cleanup() throws Exception { - tested.unbind(NEWDN); - tested.unbind(DN); + this.tested.unbind(NEWDN); + this.tested.unbind(DN); } @Test public void testRename() { - tested.rename(DN, NEWDN); + this.tested.rename(DN, NEWDN); verifyDeleted(LdapUtils.newLdapName(DN)); verifyBoundCorrectData(); @@ -79,7 +79,7 @@ public class LdapTemplateRenameITests extends AbstractLdapTemplateIntegrationTes public void testRename_LdapName() throws Exception { Name oldDn = LdapUtils.newLdapName(DN); Name newDn = LdapUtils.newLdapName(NEWDN); - tested.rename(oldDn, newDn); + this.tested.rename(oldDn, newDn); verifyDeleted(oldDn); verifyBoundCorrectData(); @@ -87,7 +87,7 @@ public class LdapTemplateRenameITests extends AbstractLdapTemplateIntegrationTes private void verifyDeleted(Name dn) { try { - tested.lookup(dn); + this.tested.lookup(dn); fail("Expected entry '" + dn + "' to be non-existent"); } catch (NameNotFoundException expected) { @@ -96,7 +96,7 @@ public class LdapTemplateRenameITests extends AbstractLdapTemplateIntegrationTes } private void verifyBoundCorrectData() { - DirContextAdapter result = (DirContextAdapter) tested.lookup(NEWDN); + DirContextAdapter result = (DirContextAdapter) this.tested.lookup(NEWDN); assertThat(result.getStringAttribute("cn")).isEqualTo("Some Person6"); assertThat(result.getStringAttribute("sn")).isEqualTo("Person6"); assertThat(result.getStringAttribute("description")).isEqualTo("Some description"); 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 ad306e2f..1801f540 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 @@ -84,218 +84,218 @@ public class LdapTemplateSearchResultITests extends AbstractLdapTemplateIntegrat @Before public void prepareTestedInstance() throws Exception { - attributesMapper = new AttributeCheckAttributesMapper(); - contextMapper = new AttributeCheckContextMapper(); + this.attributesMapper = new AttributeCheckAttributesMapper(); + this.contextMapper = new AttributeCheckContextMapper(); } @After public void cleanup() throws Exception { - attributesMapper = null; - contextMapper = null; + this.attributesMapper = null; + this.contextMapper = null; } @Test public void testSearch_AttributesMapper() { - attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); - attributesMapper.setExpectedValues(ALL_VALUES); - List list = tested.search(BASE_STRING, FILTER_STRING, attributesMapper); + this.attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.attributesMapper.setExpectedValues(ALL_VALUES); + List list = this.tested.search(BASE_STRING, FILTER_STRING, this.attributesMapper); assertThat(list).hasSize(1); } @Test public void testSearch_LdapQuery_AttributesMapper() { - attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); - attributesMapper.setExpectedValues(ALL_VALUES); + this.attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.attributesMapper.setExpectedValues(ALL_VALUES); - List list = tested.search( - query().base(BASE_STRING).where("objectclass").is("person").and("sn").is("Person2"), attributesMapper); + List list = this.tested.search( + query().base(BASE_STRING).where("objectclass").is("person").and("sn").is("Person2"), this.attributesMapper); assertThat(list).hasSize(1); } @Test public void testSearchForStream_LdapQuery_AttributesMapper() { - attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); - attributesMapper.setExpectedValues(ALL_VALUES); + this.attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.attributesMapper.setExpectedValues(ALL_VALUES); - List list = tested + List list = this.tested .searchForStream(query().base(BASE_STRING).where("objectclass").is("person").and("sn").is("Person2"), - attributesMapper) + this.attributesMapper) .collect(Collectors.toList()); assertThat(list).hasSize(1); } @Test public void testSearch_LdapQuery_AttributesMapper_FewerAttributes() { - attributesMapper.setExpectedAttributes(new String[] { "cn" }); - attributesMapper.setExpectedValues(new String[] { "Some Person2" }); + this.attributesMapper.setExpectedAttributes(new String[] { "cn" }); + this.attributesMapper.setExpectedValues(new String[] { "Some Person2" }); - List list = tested.search( + List list = this.tested.search( query().base(BASE_STRING).attributes("cn").where("objectclass").is("person").and("sn").is("Person2"), - attributesMapper); + this.attributesMapper); assertThat(list).hasSize(1); } @Test public void testSearchForStream_LdapQuery_AttributesMapper_FewerAttributes() { - attributesMapper.setExpectedAttributes(new String[] { "cn" }); - attributesMapper.setExpectedValues(new String[] { "Some Person2" }); + this.attributesMapper.setExpectedAttributes(new String[] { "cn" }); + this.attributesMapper.setExpectedValues(new String[] { "Some Person2" }); - List list = tested.searchForStream( + List list = this.tested.searchForStream( query().base(BASE_STRING).attributes("cn").where("objectclass").is("person").and("sn").is("Person2"), - attributesMapper).collect(Collectors.toList()); + this.attributesMapper).collect(Collectors.toList()); assertThat(list).hasSize(1); } @Test public void testSearch_LdapQuery_AttributesMapper_SearchScope() { - attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); - attributesMapper.setExpectedValues(ALL_VALUES); + this.attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.attributesMapper.setExpectedValues(ALL_VALUES); - List list = tested.search(query().base(BASE_STRING).searchScope(SearchScope.ONELEVEL) - .where("objectclass").is("person").and("sn").is("Person2"), attributesMapper); + List list = this.tested.search(query().base(BASE_STRING).searchScope(SearchScope.ONELEVEL) + .where("objectclass").is("person").and("sn").is("Person2"), this.attributesMapper); assertThat(list).isEmpty(); } @Test public void testSearchForStream_LdapQuery_AttributesMapper_SearchScope() { - attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); - attributesMapper.setExpectedValues(ALL_VALUES); + this.attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.attributesMapper.setExpectedValues(ALL_VALUES); - List list = tested.searchForStream(query().base(BASE_STRING).searchScope(SearchScope.ONELEVEL) - .where("objectclass").is("person").and("sn").is("Person2"), attributesMapper) + List list = this.tested.searchForStream(query().base(BASE_STRING).searchScope(SearchScope.ONELEVEL) + .where("objectclass").is("person").and("sn").is("Person2"), this.attributesMapper) .collect(Collectors.toList()); assertThat(list).isEmpty(); } @Test public void testSearch_LdapQuery_AttributesMapper_SearchScope_CorrectBase() { - attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); - attributesMapper.setExpectedValues(ALL_VALUES); + this.attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.attributesMapper.setExpectedValues(ALL_VALUES); - List list = tested.search(query().base("ou=company1,ou=Sweden").searchScope(SearchScope.ONELEVEL) - .where("objectclass").is("person").and("sn").is("Person2"), attributesMapper); + List list = this.tested.search(query().base("ou=company1,ou=Sweden").searchScope(SearchScope.ONELEVEL) + .where("objectclass").is("person").and("sn").is("Person2"), this.attributesMapper); assertThat(list).hasSize(1); } @Test public void testSearchForStream_LdapQuery_AttributesMapper_SearchScope_CorrectBase() { - attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); - attributesMapper.setExpectedValues(ALL_VALUES); + this.attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.attributesMapper.setExpectedValues(ALL_VALUES); - List list = tested + List list = this.tested .searchForStream(query().base("ou=company1,ou=Sweden").searchScope(SearchScope.ONELEVEL) - .where("objectclass").is("person").and("sn").is("Person2"), attributesMapper) + .where("objectclass").is("person").and("sn").is("Person2"), this.attributesMapper) .collect(Collectors.toList()); assertThat(list).hasSize(1); } @Test public void testSearch_LdapQuery_AttributesMapper_NoBase() { - attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); - attributesMapper.setExpectedValues(ALL_VALUES); + this.attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.attributesMapper.setExpectedValues(ALL_VALUES); - List list = tested.search(query().where("objectclass").is("person").and("sn").is("Person2"), - attributesMapper); + List list = this.tested.search(query().where("objectclass").is("person").and("sn").is("Person2"), + this.attributesMapper); assertThat(list).hasSize(1); } @Test public void testSearchForStream_LdapQuery_AttributesMapper_NoBase() { - attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); - attributesMapper.setExpectedValues(ALL_VALUES); + this.attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.attributesMapper.setExpectedValues(ALL_VALUES); - List list = tested - .searchForStream(query().where("objectclass").is("person").and("sn").is("Person2"), attributesMapper) + List list = this.tested + .searchForStream(query().where("objectclass").is("person").and("sn").is("Person2"), this.attributesMapper) .collect(Collectors.toList()); assertThat(list).hasSize(1); } @Test public void testSearch_LdapQuery_AttributesMapper_DifferentBase() { - attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); - attributesMapper.setExpectedValues(ALL_VALUES); + this.attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.attributesMapper.setExpectedValues(ALL_VALUES); - List list = tested.search( - query().base("ou=Norway").where("objectclass").is("person").and("sn").is("Person2"), attributesMapper); + List list = this.tested.search( + query().base("ou=Norway").where("objectclass").is("person").and("sn").is("Person2"), this.attributesMapper); assertThat(list).isEmpty(); } @Test public void testSearchForStream_LdapQuery_AttributesMapper_DifferentBase() { - attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); - attributesMapper.setExpectedValues(ALL_VALUES); + this.attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.attributesMapper.setExpectedValues(ALL_VALUES); - List list = tested + List list = this.tested .searchForStream(query().base("ou=Norway").where("objectclass").is("person").and("sn").is("Person2"), - attributesMapper) + this.attributesMapper) .collect(Collectors.toList()); assertThat(list).isEmpty(); } @Test public void testSearch_SearchScope_AttributesMapper() { - attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); - attributesMapper.setExpectedValues(ALL_VALUES); - List list = tested.search(BASE_STRING, FILTER_STRING, SearchControls.SUBTREE_SCOPE, attributesMapper); + this.attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.attributesMapper.setExpectedValues(ALL_VALUES); + List list = this.tested.search(BASE_STRING, FILTER_STRING, SearchControls.SUBTREE_SCOPE, this.attributesMapper); assertThat(list).hasSize(1); } @Test public void testSearch_SearchScope_LimitedAttrs_AttributesMapper() { - attributesMapper.setExpectedAttributes(CN_SN_ATTRS); - attributesMapper.setExpectedValues(CN_SN_VALUES); - attributesMapper.setAbsentAttributes(ABSENT_ATTRIBUTES); - List list = tested.search(BASE_STRING, FILTER_STRING, SearchControls.SUBTREE_SCOPE, CN_SN_ATTRS, - attributesMapper); + this.attributesMapper.setExpectedAttributes(CN_SN_ATTRS); + this.attributesMapper.setExpectedValues(CN_SN_VALUES); + this.attributesMapper.setAbsentAttributes(ABSENT_ATTRIBUTES); + List list = this.tested.search(BASE_STRING, FILTER_STRING, SearchControls.SUBTREE_SCOPE, CN_SN_ATTRS, + this.attributesMapper); assertThat(list).hasSize(1); } @Test public void testSearch_AttributesMapper_Name() { - attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); - attributesMapper.setExpectedValues(ALL_VALUES); - List list = tested.search(BASE_NAME, FILTER_STRING, attributesMapper); + this.attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.attributesMapper.setExpectedValues(ALL_VALUES); + List list = this.tested.search(BASE_NAME, FILTER_STRING, this.attributesMapper); assertThat(list).hasSize(1); } @Test public void testSearch_SearchScope_AttributesMapper_Name() { - attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); - attributesMapper.setExpectedValues(ALL_VALUES); - List list = tested.search(BASE_NAME, FILTER_STRING, SearchControls.SUBTREE_SCOPE, attributesMapper); + this.attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.attributesMapper.setExpectedValues(ALL_VALUES); + List list = this.tested.search(BASE_NAME, FILTER_STRING, SearchControls.SUBTREE_SCOPE, this.attributesMapper); assertThat(list).hasSize(1); } @Test public void testSearch_SearchScope_LimitedAttrs_AttributesMapper_Name() { - attributesMapper.setExpectedAttributes(CN_SN_ATTRS); - attributesMapper.setExpectedValues(CN_SN_VALUES); - attributesMapper.setAbsentAttributes(ABSENT_ATTRIBUTES); - List list = tested.search(BASE_NAME, FILTER_STRING, SearchControls.SUBTREE_SCOPE, CN_SN_ATTRS, - attributesMapper); + this.attributesMapper.setExpectedAttributes(CN_SN_ATTRS); + this.attributesMapper.setExpectedValues(CN_SN_VALUES); + this.attributesMapper.setAbsentAttributes(ABSENT_ATTRIBUTES); + List list = this.tested.search(BASE_NAME, FILTER_STRING, SearchControls.SUBTREE_SCOPE, CN_SN_ATTRS, + this.attributesMapper); assertThat(list).hasSize(1); } @Test public void testSearch_ContextMapper() { - contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); - contextMapper.setExpectedValues(ALL_VALUES); - List list = tested.search(BASE_STRING, FILTER_STRING, contextMapper); + this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.contextMapper.setExpectedValues(ALL_VALUES); + List list = this.tested.search(BASE_STRING, FILTER_STRING, this.contextMapper); assertThat(list).hasSize(1); } @Test public void testSearchForObject() { - contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); - contextMapper.setExpectedValues(ALL_VALUES); - DirContextAdapter result = (DirContextAdapter) tested.searchForObject(BASE_STRING, FILTER_STRING, - contextMapper); + this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.contextMapper.setExpectedValues(ALL_VALUES); + DirContextAdapter result = (DirContextAdapter) this.tested.searchForObject(BASE_STRING, FILTER_STRING, + this.contextMapper); assertThat(result).isNotNull(); } @Test(expected = IncorrectResultSizeDataAccessException.class) public void testSearchForObjectWithMultipleHits() { - tested.searchForObject(BASE_STRING, "(&(objectclass=person)(sn=*))", new AbstractContextMapper() { + this.tested.searchForObject(BASE_STRING, "(&(objectclass=person)(sn=*))", new AbstractContextMapper() { @Override protected Object doMapFromContext(DirContextOperations ctx) { return ctx; @@ -305,7 +305,7 @@ public class LdapTemplateSearchResultITests extends AbstractLdapTemplateIntegrat @Test(expected = EmptyResultDataAccessException.class) public void testSearchForObjectNoHits() { - tested.searchForObject(BASE_STRING, "(&(objectclass=person)(sn=Person does not exist))", + this.tested.searchForObject(BASE_STRING, "(&(objectclass=person)(sn=Person does not exist))", new AbstractContextMapper() { @Override protected Object doMapFromContext(DirContextOperations ctx) { @@ -316,110 +316,110 @@ public class LdapTemplateSearchResultITests extends AbstractLdapTemplateIntegrat @Test public void testSearch_SearchScope_ContextMapper() { - contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); - contextMapper.setExpectedValues(ALL_VALUES); - List list = tested.search(BASE_STRING, FILTER_STRING, SearchControls.SUBTREE_SCOPE, contextMapper); + this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.contextMapper.setExpectedValues(ALL_VALUES); + List list = this.tested.search(BASE_STRING, FILTER_STRING, SearchControls.SUBTREE_SCOPE, this.contextMapper); assertThat(list).hasSize(1); } @Test public void testSearch_SearchScope_LimitedAttrs_ContextMapper() { - contextMapper.setExpectedAttributes(CN_SN_ATTRS); - contextMapper.setExpectedValues(CN_SN_VALUES); - contextMapper.setAbsentAttributes(ABSENT_ATTRIBUTES); - List list = tested.search(BASE_STRING, FILTER_STRING, SearchControls.SUBTREE_SCOPE, CN_SN_ATTRS, contextMapper); + this.contextMapper.setExpectedAttributes(CN_SN_ATTRS); + this.contextMapper.setExpectedValues(CN_SN_VALUES); + this.contextMapper.setAbsentAttributes(ABSENT_ATTRIBUTES); + List list = this.tested.search(BASE_STRING, FILTER_STRING, SearchControls.SUBTREE_SCOPE, CN_SN_ATTRS, this.contextMapper); assertThat(list).hasSize(1); } @Test public void testSearch_ContextMapper_Name() { - contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); - contextMapper.setExpectedValues(ALL_VALUES); - List list = tested.search(BASE_NAME, FILTER_STRING, contextMapper); + this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.contextMapper.setExpectedValues(ALL_VALUES); + List list = this.tested.search(BASE_NAME, FILTER_STRING, this.contextMapper); assertThat(list).hasSize(1); } @Test public void testSearch_ContextMapper_LdapQuery() { - contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); - contextMapper.setExpectedValues(ALL_VALUES); - List list = tested.search( - query().base(BASE_NAME).where("objectclass").is("person").and("sn").is("Person2"), contextMapper); + this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.contextMapper.setExpectedValues(ALL_VALUES); + List list = this.tested.search( + query().base(BASE_NAME).where("objectclass").is("person").and("sn").is("Person2"), this.contextMapper); assertThat(list).hasSize(1); } @Test public void testSearchForStream_ContextMapper_LdapQuery() { - contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); - contextMapper.setExpectedValues(ALL_VALUES); - List list = tested + this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.contextMapper.setExpectedValues(ALL_VALUES); + List list = this.tested .searchForStream(query().base(BASE_NAME).where("objectclass").is("person").and("sn").is("Person2"), - contextMapper) + this.contextMapper) .collect(Collectors.toList()); assertThat(list).hasSize(1); } @Test public void testSearch_ContextMapper_LdapQuery_NoBase() { - contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); - contextMapper.setExpectedValues(ALL_VALUES); - List list = tested.search(query().where("objectclass").is("person").and("sn").is("Person2"), - contextMapper); + this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.contextMapper.setExpectedValues(ALL_VALUES); + List list = this.tested.search(query().where("objectclass").is("person").and("sn").is("Person2"), + this.contextMapper); assertThat(list).hasSize(1); } @Test public void testSearchForStream_ContextMapper_LdapQuery_NoBase() { - contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); - contextMapper.setExpectedValues(ALL_VALUES); - List list = tested - .searchForStream(query().where("objectclass").is("person").and("sn").is("Person2"), contextMapper) + this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.contextMapper.setExpectedValues(ALL_VALUES); + List list = this.tested + .searchForStream(query().where("objectclass").is("person").and("sn").is("Person2"), this.contextMapper) .collect(Collectors.toList()); assertThat(list).hasSize(1); } @Test public void testSearch_ContextMapper_LdapQuery_SearchScope() { - contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); - contextMapper.setExpectedValues(ALL_VALUES); - List list = tested.search(query().base(BASE_NAME).searchScope(SearchScope.ONELEVEL) - .where("objectclass").is("person").and("sn").is("Person2"), contextMapper); + this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.contextMapper.setExpectedValues(ALL_VALUES); + List list = this.tested.search(query().base(BASE_NAME).searchScope(SearchScope.ONELEVEL) + .where("objectclass").is("person").and("sn").is("Person2"), this.contextMapper); assertThat(list).isEmpty(); } @Test public void testSearchForStream_ContextMapper_LdapQuery_SearchScope() { - contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); - contextMapper.setExpectedValues(ALL_VALUES); - List list = tested.searchForStream(query().base(BASE_NAME).searchScope(SearchScope.ONELEVEL) - .where("objectclass").is("person").and("sn").is("Person2"), contextMapper).collect(Collectors.toList()); + this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.contextMapper.setExpectedValues(ALL_VALUES); + List list = this.tested.searchForStream(query().base(BASE_NAME).searchScope(SearchScope.ONELEVEL) + .where("objectclass").is("person").and("sn").is("Person2"), this.contextMapper).collect(Collectors.toList()); assertThat(list).isEmpty(); } @Test public void testSearch_ContextMapper_LdapQuery_SearchScope_CorrectBase() { - contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); - contextMapper.setExpectedValues(ALL_VALUES); - List list = tested.search(query().base("ou=company1,ou=Sweden") + this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.contextMapper.setExpectedValues(ALL_VALUES); + List list = this.tested.search(query().base("ou=company1,ou=Sweden") .searchScope(SearchScope.ONELEVEL).where("objectclass").is("person").and("sn").is("Person2"), - contextMapper); + this.contextMapper); assertThat(list).hasSize(1); } @Test public void testSearchForStream_ContextMapper_LdapQuery_SearchScope_CorrectBase() { - contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); - contextMapper.setExpectedValues(ALL_VALUES); - List list = tested + this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.contextMapper.setExpectedValues(ALL_VALUES); + List list = this.tested .searchForStream(query().base("ou=company1,ou=Sweden").searchScope(SearchScope.ONELEVEL) - .where("objectclass").is("person").and("sn").is("Person2"), contextMapper) + .where("objectclass").is("person").and("sn").is("Person2"), this.contextMapper) .collect(Collectors.toList()); assertThat(list).hasSize(1); } @Test public void testSearchForContext_LdapQuery() { - DirContextOperations result = tested + DirContextOperations result = this.tested .searchForContext(query().where("objectclass").is("person").and("sn").is("Person2")); assertThat(result).isNotNull(); @@ -428,13 +428,13 @@ public class LdapTemplateSearchResultITests extends AbstractLdapTemplateIntegrat @Test(expected = EmptyResultDataAccessException.class) public void testSearchForContext_LdapQuery_SearchScopeNotFound() { - tested.searchForContext( + this.tested.searchForContext( query().searchScope(SearchScope.ONELEVEL).where("objectclass").is("person").and("sn").is("Person2")); } @Test public void testSearchForContext_LdapQuery_SearchScope_CorrectBase() { - DirContextOperations result = tested.searchForContext(query().searchScope(SearchScope.ONELEVEL) + DirContextOperations result = this.tested.searchForContext(query().searchScope(SearchScope.ONELEVEL) .base("ou=company1,ou=Sweden").where("objectclass").is("person").and("sn").is("Person2")); assertThat(result).isNotNull(); @@ -443,26 +443,26 @@ public class LdapTemplateSearchResultITests extends AbstractLdapTemplateIntegrat @Test public void testSearch_SearchScope_ContextMapper_Name() { - contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); - contextMapper.setExpectedValues(ALL_VALUES); - List list = tested.search(BASE_NAME, FILTER_STRING, SearchControls.SUBTREE_SCOPE, contextMapper); + this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.contextMapper.setExpectedValues(ALL_VALUES); + List list = this.tested.search(BASE_NAME, FILTER_STRING, SearchControls.SUBTREE_SCOPE, this.contextMapper); assertThat(list).hasSize(1); } @Test public void testSearch_SearchScope_LimitedAttrs_ContextMapper_Name() { - contextMapper.setExpectedAttributes(CN_SN_ATTRS); - contextMapper.setExpectedValues(CN_SN_VALUES); - contextMapper.setAbsentAttributes(ABSENT_ATTRIBUTES); - List list = tested.search(BASE_NAME, FILTER_STRING, SearchControls.SUBTREE_SCOPE, CN_SN_ATTRS, contextMapper); + this.contextMapper.setExpectedAttributes(CN_SN_ATTRS); + this.contextMapper.setExpectedValues(CN_SN_VALUES); + this.contextMapper.setAbsentAttributes(ABSENT_ATTRIBUTES); + List list = this.tested.search(BASE_NAME, FILTER_STRING, SearchControls.SUBTREE_SCOPE, CN_SN_ATTRS, this.contextMapper); assertThat(list).hasSize(1); } @Test public void testSearchWithInvalidSearchBaseShouldByDefaultThrowException() { try { - tested.search(BASE_NAME + "ou=unknown", FILTER_STRING, SearchControls.SUBTREE_SCOPE, CN_SN_ATTRS, - contextMapper); + this.tested.search(BASE_NAME + "ou=unknown", FILTER_STRING, SearchControls.SUBTREE_SCOPE, CN_SN_ATTRS, + this.contextMapper); fail("NameNotFoundException expected"); } catch (NameNotFoundException expected) { @@ -472,18 +472,18 @@ public class LdapTemplateSearchResultITests extends AbstractLdapTemplateIntegrat @Test public void testSearchWithInvalidSearchBaseCanBeConfiguredToSwallowException() { - tested.setIgnoreNameNotFoundException(true); - contextMapper.setExpectedAttributes(CN_SN_ATTRS); - contextMapper.setExpectedValues(CN_SN_VALUES); - contextMapper.setAbsentAttributes(ABSENT_ATTRIBUTES); - List list = tested.search(BASE_NAME + "ou=unknown", FILTER_STRING, SearchControls.SUBTREE_SCOPE, CN_SN_ATTRS, - contextMapper); + this.tested.setIgnoreNameNotFoundException(true); + this.contextMapper.setExpectedAttributes(CN_SN_ATTRS); + this.contextMapper.setExpectedValues(CN_SN_VALUES); + this.contextMapper.setAbsentAttributes(ABSENT_ATTRIBUTES); + List list = this.tested.search(BASE_NAME + "ou=unknown", FILTER_STRING, SearchControls.SUBTREE_SCOPE, CN_SN_ATTRS, + this.contextMapper); assertThat(list).isEmpty(); } @Test public void verifyThatSearchWithCountLimitReturnsTheEntriesFoundSoFar() { - List result = tested.search(query().countLimit(3).where("objectclass").is("person"), + List result = this.tested.search(query().countLimit(3).where("objectclass").is("person"), new ContextMapper() { @Override public Object mapFromContext(Object ctx) throws NamingException { @@ -496,8 +496,8 @@ public class LdapTemplateSearchResultITests extends AbstractLdapTemplateIntegrat @Test(expected = SizeLimitExceededException.class) public void verifyThatSearchWithCountLimitWithFlagToFalseThrowsException() { - tested.setIgnoreSizeLimitExceededException(false); - tested.search(query().countLimit(3).where("objectclass").is("person"), new ContextMapper() { + this.tested.setIgnoreSizeLimitExceededException(false); + this.tested.search(query().countLimit(3).where("objectclass").is("person"), new ContextMapper() { @Override public Object mapFromContext(Object ctx) throws NamingException { return new Object(); 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 91c2b94e..633917c2 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 @@ -81,218 +81,218 @@ public class LdapTemplateSearchResultNamespaceConfigITests extends AbstractLdapT @Before public void prepareTestedInstance() throws Exception { - attributesMapper = new AttributeCheckAttributesMapper(); - contextMapper = new AttributeCheckContextMapper(); + this.attributesMapper = new AttributeCheckAttributesMapper(); + this.contextMapper = new AttributeCheckContextMapper(); } @After public void cleanup() throws Exception { - attributesMapper = null; - contextMapper = null; + this.attributesMapper = null; + this.contextMapper = null; } @Test public void testSearch_AttributesMapper() { - attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); - attributesMapper.setExpectedValues(ALL_VALUES); - List list = tested.search(BASE_STRING, FILTER_STRING, attributesMapper); + this.attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.attributesMapper.setExpectedValues(ALL_VALUES); + List list = this.tested.search(BASE_STRING, FILTER_STRING, this.attributesMapper); assertThat(list).hasSize(1); } @Test public void testSearch_LdapQuery_AttributesMapper() { - attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); - attributesMapper.setExpectedValues(ALL_VALUES); + this.attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.attributesMapper.setExpectedValues(ALL_VALUES); - List list = tested.search( - query().base(BASE_STRING).where("objectclass").is("person").and("sn").is("Person2"), attributesMapper); + List list = this.tested.search( + query().base(BASE_STRING).where("objectclass").is("person").and("sn").is("Person2"), this.attributesMapper); assertThat(list).hasSize(1); } @Test public void testSearchForStream_LdapQuery_AttributesMapper() { - attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); - attributesMapper.setExpectedValues(ALL_VALUES); + this.attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.attributesMapper.setExpectedValues(ALL_VALUES); - List list = tested + List list = this.tested .searchForStream(query().base(BASE_STRING).where("objectclass").is("person").and("sn").is("Person2"), - attributesMapper) + this.attributesMapper) .collect(Collectors.toList()); assertThat(list).hasSize(1); } @Test public void testSearch_LdapQuery_AttributesMapper_FewerAttributes() { - attributesMapper.setExpectedAttributes(new String[] { "cn" }); - attributesMapper.setExpectedValues(new String[] { "Some Person2" }); + this.attributesMapper.setExpectedAttributes(new String[] { "cn" }); + this.attributesMapper.setExpectedValues(new String[] { "Some Person2" }); - List list = tested.search( + List list = this.tested.search( query().base(BASE_STRING).attributes("cn").where("objectclass").is("person").and("sn").is("Person2"), - attributesMapper); + this.attributesMapper); assertThat(list).hasSize(1); } @Test public void testSearchForStream_LdapQuery_AttributesMapper_FewerAttributes() { - attributesMapper.setExpectedAttributes(new String[] { "cn" }); - attributesMapper.setExpectedValues(new String[] { "Some Person2" }); + this.attributesMapper.setExpectedAttributes(new String[] { "cn" }); + this.attributesMapper.setExpectedValues(new String[] { "Some Person2" }); - List list = tested.searchForStream( + List list = this.tested.searchForStream( query().base(BASE_STRING).attributes("cn").where("objectclass").is("person").and("sn").is("Person2"), - attributesMapper).collect(Collectors.toList()); + this.attributesMapper).collect(Collectors.toList()); assertThat(list).hasSize(1); } @Test public void testSearch_LdapQuery_AttributesMapper_SearchScope() { - attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); - attributesMapper.setExpectedValues(ALL_VALUES); + this.attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.attributesMapper.setExpectedValues(ALL_VALUES); - List list = tested.search(query().base(BASE_STRING).searchScope(SearchScope.ONELEVEL) - .where("objectclass").is("person").and("sn").is("Person2"), attributesMapper); + List list = this.tested.search(query().base(BASE_STRING).searchScope(SearchScope.ONELEVEL) + .where("objectclass").is("person").and("sn").is("Person2"), this.attributesMapper); assertThat(list).isEmpty(); } @Test public void testSearchForStream_LdapQuery_AttributesMapper_SearchScope() { - attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); - attributesMapper.setExpectedValues(ALL_VALUES); + this.attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.attributesMapper.setExpectedValues(ALL_VALUES); - List list = tested.searchForStream(query().base(BASE_STRING).searchScope(SearchScope.ONELEVEL) - .where("objectclass").is("person").and("sn").is("Person2"), attributesMapper) + List list = this.tested.searchForStream(query().base(BASE_STRING).searchScope(SearchScope.ONELEVEL) + .where("objectclass").is("person").and("sn").is("Person2"), this.attributesMapper) .collect(Collectors.toList()); assertThat(list).isEmpty(); } @Test public void testSearch_LdapQuery_AttributesMapper_SearchScope_CorrectBase() { - attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); - attributesMapper.setExpectedValues(ALL_VALUES); + this.attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.attributesMapper.setExpectedValues(ALL_VALUES); - List list = tested.search(query().base("ou=company1,ou=Sweden").searchScope(SearchScope.ONELEVEL) - .where("objectclass").is("person").and("sn").is("Person2"), attributesMapper); + List list = this.tested.search(query().base("ou=company1,ou=Sweden").searchScope(SearchScope.ONELEVEL) + .where("objectclass").is("person").and("sn").is("Person2"), this.attributesMapper); assertThat(list).hasSize(1); } @Test public void testSearchForStream_LdapQuery_AttributesMapper_SearchScope_CorrectBase() { - attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); - attributesMapper.setExpectedValues(ALL_VALUES); + this.attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.attributesMapper.setExpectedValues(ALL_VALUES); - List list = tested + List list = this.tested .searchForStream(query().base("ou=company1,ou=Sweden").searchScope(SearchScope.ONELEVEL) - .where("objectclass").is("person").and("sn").is("Person2"), attributesMapper) + .where("objectclass").is("person").and("sn").is("Person2"), this.attributesMapper) .collect(Collectors.toList()); assertThat(list).hasSize(1); } @Test public void testSearch_LdapQuery_AttributesMapper_NoBase() { - attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); - attributesMapper.setExpectedValues(ALL_VALUES); + this.attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.attributesMapper.setExpectedValues(ALL_VALUES); - List list = tested.search(query().where("objectclass").is("person").and("sn").is("Person2"), - attributesMapper); + List list = this.tested.search(query().where("objectclass").is("person").and("sn").is("Person2"), + this.attributesMapper); assertThat(list).hasSize(1); } @Test public void testSearchForStream_LdapQuery_AttributesMapper_NoBase() { - attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); - attributesMapper.setExpectedValues(ALL_VALUES); + this.attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.attributesMapper.setExpectedValues(ALL_VALUES); - List list = tested - .searchForStream(query().where("objectclass").is("person").and("sn").is("Person2"), attributesMapper) + List list = this.tested + .searchForStream(query().where("objectclass").is("person").and("sn").is("Person2"), this.attributesMapper) .collect(Collectors.toList()); assertThat(list).hasSize(1); } @Test public void testSearch_LdapQuery_AttributesMapper_DifferentBase() { - attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); - attributesMapper.setExpectedValues(ALL_VALUES); + this.attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.attributesMapper.setExpectedValues(ALL_VALUES); - List list = tested.search( - query().base("ou=Norway").where("objectclass").is("person").and("sn").is("Person2"), attributesMapper); + List list = this.tested.search( + query().base("ou=Norway").where("objectclass").is("person").and("sn").is("Person2"), this.attributesMapper); assertThat(list).isEmpty(); } @Test public void testSearchForStream_LdapQuery_AttributesMapper_DifferentBase() { - attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); - attributesMapper.setExpectedValues(ALL_VALUES); + this.attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.attributesMapper.setExpectedValues(ALL_VALUES); - List list = tested + List list = this.tested .searchForStream(query().base("ou=Norway").where("objectclass").is("person").and("sn").is("Person2"), - attributesMapper) + this.attributesMapper) .collect(Collectors.toList()); assertThat(list).isEmpty(); } @Test public void testSearch_SearchScope_AttributesMapper() { - attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); - attributesMapper.setExpectedValues(ALL_VALUES); - List list = tested.search(BASE_STRING, FILTER_STRING, SearchControls.SUBTREE_SCOPE, attributesMapper); + this.attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.attributesMapper.setExpectedValues(ALL_VALUES); + List list = this.tested.search(BASE_STRING, FILTER_STRING, SearchControls.SUBTREE_SCOPE, this.attributesMapper); assertThat(list).hasSize(1); } @Test public void testSearch_SearchScope_LimitedAttrs_AttributesMapper() { - attributesMapper.setExpectedAttributes(CN_SN_ATTRS); - attributesMapper.setExpectedValues(CN_SN_VALUES); - attributesMapper.setAbsentAttributes(ABSENT_ATTRIBUTES); - List list = tested.search(BASE_STRING, FILTER_STRING, SearchControls.SUBTREE_SCOPE, CN_SN_ATTRS, - attributesMapper); + this.attributesMapper.setExpectedAttributes(CN_SN_ATTRS); + this.attributesMapper.setExpectedValues(CN_SN_VALUES); + this.attributesMapper.setAbsentAttributes(ABSENT_ATTRIBUTES); + List list = this.tested.search(BASE_STRING, FILTER_STRING, SearchControls.SUBTREE_SCOPE, CN_SN_ATTRS, + this.attributesMapper); assertThat(list).hasSize(1); } @Test public void testSearch_AttributesMapper_Name() { - attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); - attributesMapper.setExpectedValues(ALL_VALUES); - List list = tested.search(BASE_NAME, FILTER_STRING, attributesMapper); + this.attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.attributesMapper.setExpectedValues(ALL_VALUES); + List list = this.tested.search(BASE_NAME, FILTER_STRING, this.attributesMapper); assertThat(list).hasSize(1); } @Test public void testSearch_SearchScope_AttributesMapper_Name() { - attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); - attributesMapper.setExpectedValues(ALL_VALUES); - List list = tested.search(BASE_NAME, FILTER_STRING, SearchControls.SUBTREE_SCOPE, attributesMapper); + this.attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.attributesMapper.setExpectedValues(ALL_VALUES); + List list = this.tested.search(BASE_NAME, FILTER_STRING, SearchControls.SUBTREE_SCOPE, this.attributesMapper); assertThat(list).hasSize(1); } @Test public void testSearch_SearchScope_LimitedAttrs_AttributesMapper_Name() { - attributesMapper.setExpectedAttributes(CN_SN_ATTRS); - attributesMapper.setExpectedValues(CN_SN_VALUES); - attributesMapper.setAbsentAttributes(ABSENT_ATTRIBUTES); - List list = tested.search(BASE_NAME, FILTER_STRING, SearchControls.SUBTREE_SCOPE, CN_SN_ATTRS, - attributesMapper); + this.attributesMapper.setExpectedAttributes(CN_SN_ATTRS); + this.attributesMapper.setExpectedValues(CN_SN_VALUES); + this.attributesMapper.setAbsentAttributes(ABSENT_ATTRIBUTES); + List list = this.tested.search(BASE_NAME, FILTER_STRING, SearchControls.SUBTREE_SCOPE, CN_SN_ATTRS, + this.attributesMapper); assertThat(list).hasSize(1); } @Test public void testSearch_ContextMapper() { - contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); - contextMapper.setExpectedValues(ALL_VALUES); - List list = tested.search(BASE_STRING, FILTER_STRING, contextMapper); + this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.contextMapper.setExpectedValues(ALL_VALUES); + List list = this.tested.search(BASE_STRING, FILTER_STRING, this.contextMapper); assertThat(list).hasSize(1); } @Test public void testSearchForObject() { - contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); - contextMapper.setExpectedValues(ALL_VALUES); - DirContextAdapter result = (DirContextAdapter) tested.searchForObject(BASE_STRING, FILTER_STRING, - contextMapper); + this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.contextMapper.setExpectedValues(ALL_VALUES); + DirContextAdapter result = (DirContextAdapter) this.tested.searchForObject(BASE_STRING, FILTER_STRING, + this.contextMapper); assertThat(result).isNotNull(); } @Test(expected = IncorrectResultSizeDataAccessException.class) public void testSearchForObjectWithMultipleHits() { - tested.searchForObject(BASE_STRING, "(&(objectclass=person)(sn=*))", new AbstractContextMapper() { + this.tested.searchForObject(BASE_STRING, "(&(objectclass=person)(sn=*))", new AbstractContextMapper() { @Override protected Object doMapFromContext(DirContextOperations ctx) { return ctx; @@ -302,7 +302,7 @@ public class LdapTemplateSearchResultNamespaceConfigITests extends AbstractLdapT @Test(expected = EmptyResultDataAccessException.class) public void testSearchForObjectNoHits() { - tested.searchForObject(BASE_STRING, "(&(objectclass=person)(sn=Person does not exist))", + this.tested.searchForObject(BASE_STRING, "(&(objectclass=person)(sn=Person does not exist))", new AbstractContextMapper() { @Override protected Object doMapFromContext(DirContextOperations ctx) { @@ -313,110 +313,110 @@ public class LdapTemplateSearchResultNamespaceConfigITests extends AbstractLdapT @Test public void testSearch_SearchScope_ContextMapper() { - contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); - contextMapper.setExpectedValues(ALL_VALUES); - List list = tested.search(BASE_STRING, FILTER_STRING, SearchControls.SUBTREE_SCOPE, contextMapper); + this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.contextMapper.setExpectedValues(ALL_VALUES); + List list = this.tested.search(BASE_STRING, FILTER_STRING, SearchControls.SUBTREE_SCOPE, this.contextMapper); assertThat(list).hasSize(1); } @Test public void testSearch_SearchScope_LimitedAttrs_ContextMapper() { - contextMapper.setExpectedAttributes(CN_SN_ATTRS); - contextMapper.setExpectedValues(CN_SN_VALUES); - contextMapper.setAbsentAttributes(ABSENT_ATTRIBUTES); - List list = tested.search(BASE_STRING, FILTER_STRING, SearchControls.SUBTREE_SCOPE, CN_SN_ATTRS, contextMapper); + this.contextMapper.setExpectedAttributes(CN_SN_ATTRS); + this.contextMapper.setExpectedValues(CN_SN_VALUES); + this.contextMapper.setAbsentAttributes(ABSENT_ATTRIBUTES); + List list = this.tested.search(BASE_STRING, FILTER_STRING, SearchControls.SUBTREE_SCOPE, CN_SN_ATTRS, this.contextMapper); assertThat(list).hasSize(1); } @Test public void testSearch_ContextMapper_Name() { - contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); - contextMapper.setExpectedValues(ALL_VALUES); - List list = tested.search(BASE_NAME, FILTER_STRING, contextMapper); + this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.contextMapper.setExpectedValues(ALL_VALUES); + List list = this.tested.search(BASE_NAME, FILTER_STRING, this.contextMapper); assertThat(list).hasSize(1); } @Test public void testSearch_ContextMapper_LdapQuery() { - contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); - contextMapper.setExpectedValues(ALL_VALUES); - List list = tested.search( - query().base(BASE_NAME).where("objectclass").is("person").and("sn").is("Person2"), contextMapper); + this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.contextMapper.setExpectedValues(ALL_VALUES); + List list = this.tested.search( + query().base(BASE_NAME).where("objectclass").is("person").and("sn").is("Person2"), this.contextMapper); assertThat(list).hasSize(1); } @Test public void testSearchForStream_ContextMapper_LdapQuery() { - contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); - contextMapper.setExpectedValues(ALL_VALUES); - List list = tested + this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.contextMapper.setExpectedValues(ALL_VALUES); + List list = this.tested .searchForStream(query().base(BASE_NAME).where("objectclass").is("person").and("sn").is("Person2"), - contextMapper) + this.contextMapper) .collect(Collectors.toList()); assertThat(list).hasSize(1); } @Test public void testSearch_ContextMapper_LdapQuery_NoBase() { - contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); - contextMapper.setExpectedValues(ALL_VALUES); - List list = tested.search(query().where("objectclass").is("person").and("sn").is("Person2"), - contextMapper); + this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.contextMapper.setExpectedValues(ALL_VALUES); + List list = this.tested.search(query().where("objectclass").is("person").and("sn").is("Person2"), + this.contextMapper); assertThat(list).hasSize(1); } @Test public void testSearchForStream_ContextMapper_LdapQuery_NoBase() { - contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); - contextMapper.setExpectedValues(ALL_VALUES); - List list = tested - .searchForStream(query().where("objectclass").is("person").and("sn").is("Person2"), contextMapper) + this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.contextMapper.setExpectedValues(ALL_VALUES); + List list = this.tested + .searchForStream(query().where("objectclass").is("person").and("sn").is("Person2"), this.contextMapper) .collect(Collectors.toList()); assertThat(list).hasSize(1); } @Test public void testSearch_ContextMapper_LdapQuery_SearchScope() { - contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); - contextMapper.setExpectedValues(ALL_VALUES); - List list = tested.search(query().base(BASE_NAME).searchScope(SearchScope.ONELEVEL) - .where("objectclass").is("person").and("sn").is("Person2"), contextMapper); + this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.contextMapper.setExpectedValues(ALL_VALUES); + List list = this.tested.search(query().base(BASE_NAME).searchScope(SearchScope.ONELEVEL) + .where("objectclass").is("person").and("sn").is("Person2"), this.contextMapper); assertThat(list).isEmpty(); } @Test public void testSearchForStream_ContextMapper_LdapQuery_SearchScope() { - contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); - contextMapper.setExpectedValues(ALL_VALUES); - List list = tested.searchForStream(query().base(BASE_NAME).searchScope(SearchScope.ONELEVEL) - .where("objectclass").is("person").and("sn").is("Person2"), contextMapper).collect(Collectors.toList()); + this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.contextMapper.setExpectedValues(ALL_VALUES); + List list = this.tested.searchForStream(query().base(BASE_NAME).searchScope(SearchScope.ONELEVEL) + .where("objectclass").is("person").and("sn").is("Person2"), this.contextMapper).collect(Collectors.toList()); assertThat(list).isEmpty(); } @Test public void testSearch_ContextMapper_LdapQuery_SearchScope_CorrectBase() { - contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); - contextMapper.setExpectedValues(ALL_VALUES); - List list = tested.search(query().base("ou=company1,ou=Sweden") + this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.contextMapper.setExpectedValues(ALL_VALUES); + List list = this.tested.search(query().base("ou=company1,ou=Sweden") .searchScope(SearchScope.ONELEVEL).where("objectclass").is("person").and("sn").is("Person2"), - contextMapper); + this.contextMapper); assertThat(list).hasSize(1); } @Test public void testSearchForStream_ContextMapper_LdapQuery_SearchScope_CorrectBase() { - contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); - contextMapper.setExpectedValues(ALL_VALUES); - List list = tested + this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.contextMapper.setExpectedValues(ALL_VALUES); + List list = this.tested .searchForStream(query().base("ou=company1,ou=Sweden").searchScope(SearchScope.ONELEVEL) - .where("objectclass").is("person").and("sn").is("Person2"), contextMapper) + .where("objectclass").is("person").and("sn").is("Person2"), this.contextMapper) .collect(Collectors.toList()); assertThat(list).hasSize(1); } @Test public void testSearchForContext_LdapQuery() { - DirContextOperations result = tested + DirContextOperations result = this.tested .searchForContext(query().where("objectclass").is("person").and("sn").is("Person2")); assertThat(result).isNotNull(); @@ -425,13 +425,13 @@ public class LdapTemplateSearchResultNamespaceConfigITests extends AbstractLdapT @Test(expected = EmptyResultDataAccessException.class) public void testSearchForContext_LdapQuery_SearchScopeNotFound() { - tested.searchForContext( + this.tested.searchForContext( query().searchScope(SearchScope.ONELEVEL).where("objectclass").is("person").and("sn").is("Person2")); } @Test public void testSearchForContext_LdapQuery_SearchScope_CorrectBase() { - DirContextOperations result = tested.searchForContext(query().searchScope(SearchScope.ONELEVEL) + DirContextOperations result = this.tested.searchForContext(query().searchScope(SearchScope.ONELEVEL) .base("ou=company1,ou=Sweden").where("objectclass").is("person").and("sn").is("Person2")); assertThat(result).isNotNull(); @@ -440,26 +440,26 @@ public class LdapTemplateSearchResultNamespaceConfigITests extends AbstractLdapT @Test public void testSearch_SearchScope_ContextMapper_Name() { - contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); - contextMapper.setExpectedValues(ALL_VALUES); - List list = tested.search(BASE_NAME, FILTER_STRING, SearchControls.SUBTREE_SCOPE, contextMapper); + this.contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); + this.contextMapper.setExpectedValues(ALL_VALUES); + List list = this.tested.search(BASE_NAME, FILTER_STRING, SearchControls.SUBTREE_SCOPE, this.contextMapper); assertThat(list).hasSize(1); } @Test public void testSearch_SearchScope_LimitedAttrs_ContextMapper_Name() { - contextMapper.setExpectedAttributes(CN_SN_ATTRS); - contextMapper.setExpectedValues(CN_SN_VALUES); - contextMapper.setAbsentAttributes(ABSENT_ATTRIBUTES); - List list = tested.search(BASE_NAME, FILTER_STRING, SearchControls.SUBTREE_SCOPE, CN_SN_ATTRS, contextMapper); + this.contextMapper.setExpectedAttributes(CN_SN_ATTRS); + this.contextMapper.setExpectedValues(CN_SN_VALUES); + this.contextMapper.setAbsentAttributes(ABSENT_ATTRIBUTES); + List list = this.tested.search(BASE_NAME, FILTER_STRING, SearchControls.SUBTREE_SCOPE, CN_SN_ATTRS, this.contextMapper); assertThat(list).hasSize(1); } @Test public void testSearchWithInvalidSearchBaseShouldByDefaultThrowException() { try { - tested.search(BASE_NAME + "ou=unknown", FILTER_STRING, SearchControls.SUBTREE_SCOPE, CN_SN_ATTRS, - contextMapper); + this.tested.search(BASE_NAME + "ou=unknown", FILTER_STRING, SearchControls.SUBTREE_SCOPE, CN_SN_ATTRS, + this.contextMapper); fail("NameNotFoundException expected"); } catch (NameNotFoundException expected) { @@ -469,12 +469,12 @@ public class LdapTemplateSearchResultNamespaceConfigITests extends AbstractLdapT @Test public void testSearchWithInvalidSearchBaseCanBeConfiguredToSwallowException() { - tested.setIgnoreNameNotFoundException(true); - contextMapper.setExpectedAttributes(CN_SN_ATTRS); - contextMapper.setExpectedValues(CN_SN_VALUES); - contextMapper.setAbsentAttributes(ABSENT_ATTRIBUTES); - List list = tested.search(BASE_NAME + "ou=unknown", FILTER_STRING, SearchControls.SUBTREE_SCOPE, CN_SN_ATTRS, - contextMapper); + this.tested.setIgnoreNameNotFoundException(true); + this.contextMapper.setExpectedAttributes(CN_SN_ATTRS); + this.contextMapper.setExpectedValues(CN_SN_VALUES); + this.contextMapper.setAbsentAttributes(ABSENT_ATTRIBUTES); + List list = this.tested.search(BASE_NAME + "ou=unknown", FILTER_STRING, SearchControls.SUBTREE_SCOPE, CN_SN_ATTRS, + this.contextMapper); assertThat(list).isEmpty(); } 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 40020d4d..66655371 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 @@ -69,7 +69,7 @@ public class SupportedControlsITests extends AbstractLdapTemplateIntegrationTest }; - String[] controls = (String[]) tested.lookup("", new String[] { SUPPORTED_CONTROL }, mapper); + String[] controls = (String[]) this.tested.lookup("", new String[] { SUPPORTED_CONTROL }, mapper); System.out.println(Arrays.toString(controls)); HashSet controlsSet = new HashSet(Arrays.asList(controls)); diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/itest/core/DistinguishedNameEditorITests.java b/test/integration-tests/src/test/java/org/springframework/ldap/itest/core/DistinguishedNameEditorITests.java index df04b5c7..862927bf 100644 --- a/test/integration-tests/src/test/java/org/springframework/ldap/itest/core/DistinguishedNameEditorITests.java +++ b/test/integration-tests/src/test/java/org/springframework/ldap/itest/core/DistinguishedNameEditorITests.java @@ -37,8 +37,8 @@ public class DistinguishedNameEditorITests extends AbstractJUnit4SpringContextTe @Test public void testDistinguishedNameEditor() throws Exception { - assertThat(distinguishedNameConsumer).isNotNull(); - DistinguishedName name = distinguishedNameConsumer.getDistinguishedName(); + assertThat(this.distinguishedNameConsumer).isNotNull(); + DistinguishedName name = this.distinguishedNameConsumer.getDistinguishedName(); assertThat(name).isEqualTo(new DistinguishedName("dc=jayway, dc=se")); } 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 e1cb8541..9657308d 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 @@ -54,20 +54,20 @@ public class SimpleLdapTemplateITests extends AbstractLdapTemplateIntegrationTes @Test public void testLookup() { - String result = ldapTemplate.lookup("cn=Some Person,ou=company1,ou=Sweden", new CnContextMapper()); + String result = this.ldapTemplate.lookup("cn=Some Person,ou=company1,ou=Sweden", new CnContextMapper()); assertThat(result).isEqualTo("Some Person"); } @Test public void testLookupName() { - String result = ldapTemplate.lookup(LdapUtils.newLdapName("cn=Some Person,ou=company1,ou=Sweden"), + String result = this.ldapTemplate.lookup(LdapUtils.newLdapName("cn=Some Person,ou=company1,ou=Sweden"), new CnContextMapper()); assertThat(result).isEqualTo("Some Person"); } @Test public void testSearch() { - List cns = ldapTemplate.search("", "(&(objectclass=person)(sn=Person3))", new CnContextMapper()); + List cns = this.ldapTemplate.search("", "(&(objectclass=person)(sn=Person3))", new CnContextMapper()); assertThat(cns).hasSize(1); assertThat(cns.get(0)).isEqualTo("Some Person3"); @@ -75,7 +75,7 @@ public class SimpleLdapTemplateITests extends AbstractLdapTemplateIntegrationTes @Test public void testSearchForObject() { - String cn = ldapTemplate.searchForObject("", "(&(objectclass=person)(sn=Person3))", new CnContextMapper()); + String cn = this.ldapTemplate.searchForObject("", "(&(objectclass=person)(sn=Person3))", new CnContextMapper()); assertThat(cn).isEqualTo("Some Person3"); } @@ -85,7 +85,7 @@ public class SimpleLdapTemplateITests extends AbstractLdapTemplateIntegrationTes searchControls.setSearchScope(SearchControls.SUBTREE_SCOPE); DummyDirContextProcessor processor = new DummyDirContextProcessor(); - List cns = ldapTemplate.search("", "(&(objectclass=person)(sn=Person3))", searchControls, + List cns = this.ldapTemplate.search("", "(&(objectclass=person)(sn=Person3))", searchControls, new CnContextMapper(), processor); assertThat(cns).hasSize(1); @@ -100,7 +100,7 @@ public class SimpleLdapTemplateITests extends AbstractLdapTemplateIntegrationTes searchControls.setSearchScope(SearchControls.SUBTREE_SCOPE); DummyDirContextProcessor processor = new DummyDirContextProcessor(); - List cns = ldapTemplate.search(LdapUtils.emptyLdapName(), "(&(objectclass=person)(sn=Person3))", + List cns = this.ldapTemplate.search(LdapUtils.emptyLdapName(), "(&(objectclass=person)(sn=Person3))", searchControls, new CnContextMapper(), processor); assertThat(cns).hasSize(1); @@ -111,7 +111,7 @@ public class SimpleLdapTemplateITests extends AbstractLdapTemplateIntegrationTes @Test public void testSearchName() { - List cns = ldapTemplate.search(LdapUtils.emptyLdapName(), "(&(objectclass=person)(sn=Person3))", + List cns = this.ldapTemplate.search(LdapUtils.emptyLdapName(), "(&(objectclass=person)(sn=Person3))", new CnContextMapper()); assertThat(cns).hasSize(1); @@ -120,15 +120,15 @@ public class SimpleLdapTemplateITests extends AbstractLdapTemplateIntegrationTes @Test public void testModifyAttributes() { - DirContextOperations ctx = ldapTemplate.lookupContext("cn=Some Person,ou=company1,ou=Sweden"); + DirContextOperations ctx = this.ldapTemplate.lookupContext("cn=Some Person,ou=company1,ou=Sweden"); ctx.setAttributeValue("description", "updated description"); ctx.setAttributeValue("telephoneNumber", "0000001"); - ldapTemplate.modifyAttributes(ctx); + this.ldapTemplate.modifyAttributes(ctx); // verify that the data was properly updated. - ldapTemplate.lookup("cn=Some Person,ou=company1,ou=Sweden", new ContextMapper() { + this.ldapTemplate.lookup("cn=Some Person,ou=company1,ou=Sweden", new ContextMapper() { public Object mapFromContext(Object ctx) { DirContextAdapter adapter = (DirContextAdapter) ctx; assertThat(adapter.getStringAttribute("description")).isEqualTo("updated description"); @@ -140,16 +140,16 @@ public class SimpleLdapTemplateITests extends AbstractLdapTemplateIntegrationTes @Test public void testModifyAttributesName() { - DirContextOperations ctx = ldapTemplate + DirContextOperations ctx = this.ldapTemplate .lookupContext(LdapUtils.newLdapName("cn=Some Person,ou=company1,ou=Sweden")); ctx.setAttributeValue("description", "updated description"); ctx.setAttributeValue("telephoneNumber", "0000001"); - ldapTemplate.modifyAttributes(ctx); + this.ldapTemplate.modifyAttributes(ctx); // verify that the data was properly updated. - ldapTemplate.lookup("cn=Some Person,ou=company1,ou=Sweden", new ContextMapper() { + this.ldapTemplate.lookup("cn=Some Person,ou=company1,ou=Sweden", new ContextMapper() { public Object mapFromContext(Object ctx) { DirContextAdapter adapter = (DirContextAdapter) ctx; assertThat(adapter.getStringAttribute("description")).isEqualTo("updated description"); @@ -166,9 +166,9 @@ public class SimpleLdapTemplateITests extends AbstractLdapTemplateIntegrationTes adapter.setAttributeValue("cn", "Some Person4"); adapter.setAttributeValue("sn", "Person4"); - ldapTemplate.bind(DN_STRING, adapter, null); + this.ldapTemplate.bind(DN_STRING, adapter, null); verifyBoundCorrectData(); - ldapTemplate.unbind(DN_STRING); + this.ldapTemplate.unbind(DN_STRING); verifyCleanup(); } @@ -179,9 +179,9 @@ public class SimpleLdapTemplateITests extends AbstractLdapTemplateIntegrationTes adapter.setAttributeValue("cn", "Some Person4"); adapter.setAttributeValue("sn", "Person4"); - ldapTemplate.bind(DN, adapter, null); + this.ldapTemplate.bind(DN, adapter, null); verifyBoundCorrectData(); - ldapTemplate.unbind(DN); + this.ldapTemplate.unbind(DN); verifyCleanup(); } @@ -192,9 +192,9 @@ public class SimpleLdapTemplateITests extends AbstractLdapTemplateIntegrationTes adapter.setAttributeValue("cn", "Some Person4"); adapter.setAttributeValue("sn", "Person4"); - ldapTemplate.bind(adapter); + this.ldapTemplate.bind(adapter); verifyBoundCorrectData(); - ldapTemplate.unbind(DN); + this.ldapTemplate.unbind(DN); verifyCleanup(); } @@ -203,18 +203,18 @@ public class SimpleLdapTemplateITests extends AbstractLdapTemplateIntegrationTes public void testAuthenticate() { AndFilter filter = new AndFilter(); filter.and(new EqualsFilter("objectclass", "person")).and(new EqualsFilter("uid", "some.person3")); - assertThat(ldapTemplate.authenticate("", filter.toString(), "password")).isTrue(); + assertThat(this.ldapTemplate.authenticate("", filter.toString(), "password")).isTrue(); } private void verifyBoundCorrectData() { - DirContextOperations result = ldapTemplate.lookupContext(DN_STRING); + DirContextOperations result = this.ldapTemplate.lookupContext(DN_STRING); assertThat(result.getStringAttribute("cn")).isEqualTo("Some Person4"); assertThat(result.getStringAttribute("sn")).isEqualTo("Person4"); } private void verifyCleanup() { try { - ldapTemplate.lookupContext(DN_STRING); + this.ldapTemplate.lookupContext(DN_STRING); fail("NameNotFoundException expected"); } catch (NameNotFoundException expected) { @@ -239,19 +239,19 @@ public class SimpleLdapTemplateITests extends AbstractLdapTemplateIntegrationTes private boolean postProcessCalled; public boolean isPreProcessCalled() { - return preProcessCalled; + return this.preProcessCalled; } public boolean isPostProcessCalled() { - return postProcessCalled; + return this.postProcessCalled; } public void postProcess(DirContext ctx) throws NamingException { - preProcessCalled = true; + this.preProcessCalled = true; } public void preProcess(DirContext ctx) throws NamingException { - postProcessCalled = true; + this.postProcessCalled = true; } } diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/itest/core/support/LdapContextSourceIntegrationTests.java b/test/integration-tests/src/test/java/org/springframework/ldap/itest/core/support/LdapContextSourceIntegrationTests.java index 01f566be..c416f828 100644 --- a/test/integration-tests/src/test/java/org/springframework/ldap/itest/core/support/LdapContextSourceIntegrationTests.java +++ b/test/integration-tests/src/test/java/org/springframework/ldap/itest/core/support/LdapContextSourceIntegrationTests.java @@ -63,7 +63,7 @@ public class LdapContextSourceIntegrationTests extends AbstractLdapTemplateInteg DirContext ctx = null; try { - ctx = tested.getReadOnlyContext(); + ctx = this.tested.getReadOnlyContext(); assertThat(ctx).isNotNull(); Hashtable environment = ctx.getEnvironment(); assertThat(environment.containsKey(LdapContextSource.SUN_LDAP_POOLING_FLAG)).isFalse(); @@ -88,7 +88,7 @@ public class LdapContextSourceIntegrationTests extends AbstractLdapTemplateInteg DirContext ctx = null; try { - ctx = tested.getReadWriteContext(); + ctx = this.tested.getReadWriteContext(); assertThat(ctx).isNotNull(); // Double check to see that we are authenticated. Hashtable environment = ctx.getEnvironment(); @@ -116,7 +116,7 @@ public class LdapContextSourceIntegrationTests extends AbstractLdapTemplateInteg try { String expectedPrincipal = "cn=Some Person,ou=company1,ou=Sweden," + base; String expectedCredentials = "password"; - ctx = tested.getContext(expectedPrincipal, expectedCredentials); + ctx = this.tested.getContext(expectedPrincipal, expectedCredentials); assertThat(ctx).isNotNull(); // Double check to see that we are authenticated, and that we did not receive // a connection eligible for connection pooling. @@ -143,14 +143,14 @@ public class LdapContextSourceIntegrationTests extends AbstractLdapTemplateInteg @Category(NoAdTests.class) public void verifyAuthenticate() { EqualsFilter filter = new EqualsFilter("cn", "Some Person2"); - List results = ldapTemplate.search("", filter.toString(), new DnContextMapper()); + List results = this.ldapTemplate.search("", filter.toString(), new DnContextMapper()); if (results.size() != 1) { throw new IncorrectResultSizeDataAccessException(1, results.size()); } DirContext ctx = null; try { - ctx = tested.getContext(results.get(0), "password"); + ctx = this.tested.getContext(results.get(0), "password"); assertThat(true).isTrue(); } catch (Exception e) { diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/itest/core/support/LdapContextSourceMultiServerIntegrationTests.java b/test/integration-tests/src/test/java/org/springframework/ldap/itest/core/support/LdapContextSourceMultiServerIntegrationTests.java index b694a3cb..80edb1bb 100644 --- a/test/integration-tests/src/test/java/org/springframework/ldap/itest/core/support/LdapContextSourceMultiServerIntegrationTests.java +++ b/test/integration-tests/src/test/java/org/springframework/ldap/itest/core/support/LdapContextSourceMultiServerIntegrationTests.java @@ -39,8 +39,8 @@ public class LdapContextSourceMultiServerIntegrationTests extends AbstractJUnit4 @Test public void testUrls() throws NamingException { - String[] urls = tested.getUrls(); - String string = tested.assembleProviderUrlString(urls); + String[] urls = this.tested.getUrls(); + String string = this.tested.assembleProviderUrlString(urls); assertThat(string).isEqualTo("ldap://127.0.0.1:389 ldap://127.0.0.2:389"); } diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/itest/filter/HardcodedFilterIntegrationTests.java b/test/integration-tests/src/test/java/org/springframework/ldap/itest/filter/HardcodedFilterIntegrationTests.java index 0dc10a28..d1397a09 100644 --- a/test/integration-tests/src/test/java/org/springframework/ldap/itest/filter/HardcodedFilterIntegrationTests.java +++ b/test/integration-tests/src/test/java/org/springframework/ldap/itest/filter/HardcodedFilterIntegrationTests.java @@ -42,7 +42,7 @@ public class HardcodedFilterIntegrationTests extends AbstractLdapTemplateIntegra @Test public void verifyThatFilterEditorWorks() { - Filter filter = dummyFilterConsumer.getFilter(); + Filter filter = this.dummyFilterConsumer.getFilter(); assertThat(filter instanceof HardcodedFilter).isTrue(); assertThat(filter.toString()).isEqualTo("(&(objectclass=person)(!(objectclass=computer))"); } @@ -51,7 +51,7 @@ public class HardcodedFilterIntegrationTests extends AbstractLdapTemplateIntegra public void verifyThatWildcardsAreUnescaped() { HardcodedFilter filter = new HardcodedFilter("cn=Some*"); CountNameClassPairCallbackHandler handler = new CountNameClassPairCallbackHandler(); - ldapTemplate.search(LdapUtils.emptyLdapName(), filter.encode(), handler); + this.ldapTemplate.search(LdapUtils.emptyLdapName(), filter.encode(), handler); int hits = handler.getNoOfRows(); assertThat(hits > 1).isTrue(); } diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/itest/integration/JiraLdap247ITests.java b/test/integration-tests/src/test/java/org/springframework/ldap/itest/integration/JiraLdap247ITests.java index 0039bbcc..303c39ca 100644 --- a/test/integration-tests/src/test/java/org/springframework/ldap/itest/integration/JiraLdap247ITests.java +++ b/test/integration-tests/src/test/java/org/springframework/ldap/itest/integration/JiraLdap247ITests.java @@ -39,13 +39,13 @@ public class JiraLdap247ITests extends AbstractLdapTemplateIntegrationTests { @Test public void verifyThatBasePathIsProperlyPopulated() { - assertThat(ldapGroupDao).isNotNull(); + assertThat(this.ldapGroupDao).isNotNull(); // The base path should be automatically populated by // BaseLdapPathBeanPostProcessor, // but it doesn't unless it implements Ordered, which caused the assertion below // to fail. - assertThat(ldapGroupDao.getBasePath()).isNotNull(); + assertThat(this.ldapGroupDao.getBasePath()).isNotNull(); } } diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/itest/ldap321/Ldap321Tests.java b/test/integration-tests/src/test/java/org/springframework/ldap/itest/ldap321/Ldap321Tests.java index 25083412..52d66f7d 100644 --- a/test/integration-tests/src/test/java/org/springframework/ldap/itest/ldap321/Ldap321Tests.java +++ b/test/integration-tests/src/test/java/org/springframework/ldap/itest/ldap321/Ldap321Tests.java @@ -42,7 +42,7 @@ public class Ldap321Tests { @Test public void testQueryRoleMap() throws Exception { - Map roleMap = roleRepo.queryRoleMap(); + Map roleMap = this.roleRepo.queryRoleMap(); assertThat(roleMap).isNotNull(); for (String roleName : roleMap.keySet()) { diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/itest/ldap473/Ldap473Tests.java b/test/integration-tests/src/test/java/org/springframework/ldap/itest/ldap473/Ldap473Tests.java index 72833a93..a1f61ff4 100644 --- a/test/integration-tests/src/test/java/org/springframework/ldap/itest/ldap473/Ldap473Tests.java +++ b/test/integration-tests/src/test/java/org/springframework/ldap/itest/ldap473/Ldap473Tests.java @@ -42,7 +42,7 @@ public class Ldap473Tests { @Test public void anonymous() { - DirContext readOnlyContext = contextSource.getReadOnlyContext(); + DirContext readOnlyContext = this.contextSource.getReadOnlyContext(); assertThat(readOnlyContext).isNotNull(); } 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 7b87e630..27d14246 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 @@ -72,22 +72,22 @@ public class ContextSourceAndDataSourceTransactionManagerIntegrationTests extend TransactionSynchronizationManager.clearSynchronization(); } - jdbcTemplate.execute("drop table PERSON if exists"); - jdbcTemplate + this.jdbcTemplate.execute("drop table PERSON if exists"); + this.jdbcTemplate .execute("create table PERSON(fullname VARCHAR(256), lastname VARCHAR(256), description VARCHAR(256))"); - jdbcTemplate.update("insert into PERSON values(?, ?, ?)", + this.jdbcTemplate.update("insert into PERSON values(?, ?, ?)", new Object[] { "Some Person", "Person", "Sweden, Company1, Some Person" }); } @After public void cleanup() throws Exception { - jdbcTemplate.execute("drop table PERSON if exists"); + this.jdbcTemplate.execute("drop table PERSON if exists"); } @Test public void testCreateWithException() { try { - dummyDao.createWithException("Sweden", "company1", "some testperson", "testperson", "some description"); + this.dummyDao.createWithException("Sweden", "company1", "some testperson", "testperson", "some description"); fail("DummyException expected"); } catch (DummyException expected) { @@ -98,7 +98,7 @@ public class ContextSourceAndDataSourceTransactionManagerIntegrationTests extend // Verify that no entry was created try { - ldapTemplate.lookup("cn=some testperson, ou=company1, ou=Sweden"); + this.ldapTemplate.lookup("cn=some testperson, ou=company1, ou=Sweden"); fail("NameNotFoundException expected"); } catch (NameNotFoundException expected) { @@ -106,7 +106,7 @@ public class ContextSourceAndDataSourceTransactionManagerIntegrationTests extend } try { - jdbcTemplate.queryForObject("select * from PERSON where fullname='some testperson'", new RowMapper() { + this.jdbcTemplate.queryForObject("select * from PERSON where fullname='some testperson'", new RowMapper() { public Object mapRow(ResultSet rs, int rowNum) throws SQLException { return null; } @@ -120,11 +120,11 @@ public class ContextSourceAndDataSourceTransactionManagerIntegrationTests extend @Test public void testCreate() { - dummyDao.create("Sweden", "company1", "some testperson", "testperson", "some description"); + this.dummyDao.create("Sweden", "company1", "some testperson", "testperson", "some description"); log.debug("Verifying result"); - Object ldapResult = ldapTemplate.lookup("cn=some testperson, ou=company1, ou=Sweden"); - Object dbResult = jdbcTemplate.queryForObject("select * from PERSON where fullname='some testperson'", + Object ldapResult = this.ldapTemplate.lookup("cn=some testperson, ou=company1, ou=Sweden"); + Object dbResult = this.jdbcTemplate.queryForObject("select * from PERSON where fullname='some testperson'", new RowMapper() { public Object mapRow(ResultSet rs, int rowNum) throws SQLException { return new Object(); @@ -133,14 +133,14 @@ public class ContextSourceAndDataSourceTransactionManagerIntegrationTests extend assertThat(ldapResult).isNotNull(); assertThat(dbResult).isNotNull(); - ldapTemplate.unbind("cn=some testperson, ou=company1, ou=Sweden"); + this.ldapTemplate.unbind("cn=some testperson, ou=company1, ou=Sweden"); } @Test public void testUpdateWithException() { String dn = "cn=Some Person,ou=company1,ou=Sweden"; try { - dummyDao.updateWithException(dn, "Some Person", "Updated Person", "Updated description"); + this.dummyDao.updateWithException(dn, "Some Person", "Updated Person", "Updated description"); fail("DummyException expected"); } catch (DummyException expected) { @@ -149,7 +149,7 @@ public class ContextSourceAndDataSourceTransactionManagerIntegrationTests extend log.debug("Verifying result"); - Object ldapResult = ldapTemplate.lookup(dn, new AttributesMapper() { + Object ldapResult = this.ldapTemplate.lookup(dn, new AttributesMapper() { public Object mapFromAttributes(Attributes attributes) throws NamingException { assertThat(attributes.get("sn").get()).isEqualTo("Person"); assertThat(attributes.get("description").get()).isEqualTo("Sweden, Company1, Some Person"); @@ -157,7 +157,7 @@ public class ContextSourceAndDataSourceTransactionManagerIntegrationTests extend } }); - Object jdbcResult = jdbcTemplate.queryForObject("select * from PERSON where fullname=?", + Object jdbcResult = this.jdbcTemplate.queryForObject("select * from PERSON where fullname=?", new Object[] { "Some Person" }, new RowMapper() { public Object mapRow(ResultSet rs, int rowNum) throws SQLException { assertThat(rs.getString("lastname")).isEqualTo("Person"); @@ -173,10 +173,10 @@ public class ContextSourceAndDataSourceTransactionManagerIntegrationTests extend @Test public void testUpdate() { String dn = "cn=Some Person,ou=company1,ou=Sweden"; - dummyDao.update(dn, "Some Person", "Updated Person", "Updated description"); + this.dummyDao.update(dn, "Some Person", "Updated Person", "Updated description"); log.debug("Verifying result"); - Object ldapResult = ldapTemplate.lookup(dn, new AttributesMapper() { + Object ldapResult = this.ldapTemplate.lookup(dn, new AttributesMapper() { public Object mapFromAttributes(Attributes attributes) throws NamingException { assertThat(attributes.get("sn").get()).isEqualTo("Updated Person"); assertThat(attributes.get("description").get()).isEqualTo("Updated description"); @@ -184,7 +184,7 @@ public class ContextSourceAndDataSourceTransactionManagerIntegrationTests extend } }); - Object jdbcResult = jdbcTemplate.queryForObject("select * from PERSON where fullname=?", + Object jdbcResult = this.jdbcTemplate.queryForObject("select * from PERSON where fullname=?", new Object[] { "Some Person" }, new RowMapper() { public Object mapRow(ResultSet rs, int rowNum) throws SQLException { assertThat(rs.getString("lastname")).isEqualTo("Updated Person"); @@ -195,7 +195,7 @@ public class ContextSourceAndDataSourceTransactionManagerIntegrationTests extend assertThat(ldapResult).isNotNull(); assertThat(jdbcResult).isNotNull(); - dummyDao.update(dn, "Some Person", "Person", "Sweden, Company1, Some Person"); + this.dummyDao.update(dn, "Some Person", "Person", "Sweden, Company1, Some Person"); } @Test @@ -204,7 +204,7 @@ public class ContextSourceAndDataSourceTransactionManagerIntegrationTests extend String newDn = "cn=Some Person2,ou=company2,ou=Sweden"; try { // Perform test - dummyDao.updateAndRenameWithException(dn, newDn, "Updated description"); + this.dummyDao.updateAndRenameWithException(dn, newDn, "Updated description"); fail("DummyException expected"); } catch (DummyException expected) { @@ -213,7 +213,7 @@ public class ContextSourceAndDataSourceTransactionManagerIntegrationTests extend // Verify that entry was not moved. try { - ldapTemplate.lookup(newDn); + this.ldapTemplate.lookup(newDn); fail("NameNotFoundException expected"); } catch (NameNotFoundException expected) { @@ -221,7 +221,7 @@ public class ContextSourceAndDataSourceTransactionManagerIntegrationTests extend } // Verify that original entry was not updated. - Object object = ldapTemplate.lookup(dn, new AttributesMapper() { + Object object = this.ldapTemplate.lookup(dn, new AttributesMapper() { public Object mapFromAttributes(Attributes attributes) throws NamingException { assertThat(attributes.get("description").get()).isEqualTo("Sweden, Company1, Some Person2"); return new Object(); @@ -235,10 +235,10 @@ public class ContextSourceAndDataSourceTransactionManagerIntegrationTests extend String dn = "cn=Some Person2,ou=company1,ou=Sweden"; String newDn = "cn=Some Person2,ou=company2,ou=Sweden"; // Perform test - dummyDao.updateAndRename(dn, newDn, "Updated description"); + this.dummyDao.updateAndRename(dn, newDn, "Updated description"); // Verify that entry was moved and updated. - Object object = ldapTemplate.lookup(newDn, new AttributesMapper() { + Object object = this.ldapTemplate.lookup(newDn, new AttributesMapper() { public Object mapFromAttributes(Attributes attributes) throws NamingException { assertThat(attributes.get("description").get()).isEqualTo("Updated description"); return new Object(); @@ -246,7 +246,7 @@ public class ContextSourceAndDataSourceTransactionManagerIntegrationTests extend }); assertThat(object).isNotNull(); - dummyDao.updateAndRename(newDn, dn, "Sweden, Company1, Some Person2"); + this.dummyDao.updateAndRename(newDn, dn, "Sweden, Company1, Some Person2"); } @Test @@ -254,7 +254,7 @@ public class ContextSourceAndDataSourceTransactionManagerIntegrationTests extend String dn = "cn=Some Person,ou=company1,ou=Sweden"; try { // Perform test - dummyDao.modifyAttributesWithException(dn, "Updated lastname", "Updated description"); + this.dummyDao.modifyAttributesWithException(dn, "Updated lastname", "Updated description"); fail("DummyException expected"); } catch (DummyException expected) { @@ -262,7 +262,7 @@ public class ContextSourceAndDataSourceTransactionManagerIntegrationTests extend } // Verify result - check that the operation was properly rolled back - Object result = ldapTemplate.lookup(dn, new AttributesMapper() { + Object result = this.ldapTemplate.lookup(dn, new AttributesMapper() { public Object mapFromAttributes(Attributes attributes) throws NamingException { assertThat(attributes.get("sn").get()).isEqualTo("Person"); assertThat(attributes.get("description").get()).isEqualTo("Sweden, Company1, Some Person"); @@ -277,10 +277,10 @@ public class ContextSourceAndDataSourceTransactionManagerIntegrationTests extend public void testModifyAttributes() { String dn = "cn=Some Person,ou=company1,ou=Sweden"; // Perform test - dummyDao.modifyAttributes(dn, "Updated lastname", "Updated description"); + this.dummyDao.modifyAttributes(dn, "Updated lastname", "Updated description"); // Verify result - check that the operation was not rolled back - Object result = ldapTemplate.lookup(dn, new AttributesMapper() { + Object result = this.ldapTemplate.lookup(dn, new AttributesMapper() { public Object mapFromAttributes(Attributes attributes) throws NamingException { assertThat(attributes.get("sn").get()).isEqualTo("Updated lastname"); assertThat(attributes.get("description").get()).isEqualTo("Updated description"); @@ -289,7 +289,7 @@ public class ContextSourceAndDataSourceTransactionManagerIntegrationTests extend }); assertThat(result).isNotNull(); - dummyDao.update(dn, "Some Person", "Person", "Sweden, Company1, Some Person"); + this.dummyDao.update(dn, "Some Person", "Person", "Sweden, Company1, Some Person"); } @Test @@ -297,7 +297,7 @@ public class ContextSourceAndDataSourceTransactionManagerIntegrationTests extend String dn = "cn=Some Person,ou=company1,ou=Sweden"; try { // Perform test - dummyDao.unbindWithException(dn, "Some Person"); + this.dummyDao.unbindWithException(dn, "Some Person"); fail("DummyException expected"); } catch (DummyException expected) { @@ -305,14 +305,14 @@ public class ContextSourceAndDataSourceTransactionManagerIntegrationTests extend } // Verify result - check that the operation was properly rolled back - Object ldapResult = ldapTemplate.lookup(dn, new AttributesMapper() { + Object ldapResult = this.ldapTemplate.lookup(dn, new AttributesMapper() { public Object mapFromAttributes(Attributes attributes) throws NamingException { // Just verify that the entry still exists. return new Object(); } }); - Object jdbcResult = jdbcTemplate.queryForObject("select * from PERSON where fullname=?", + Object jdbcResult = this.jdbcTemplate.queryForObject("select * from PERSON where fullname=?", new Object[] { "Some Person" }, new RowMapper() { public Object mapRow(ResultSet rs, int rowNum) throws SQLException { // Just verify that the entry still exists. @@ -328,11 +328,11 @@ public class ContextSourceAndDataSourceTransactionManagerIntegrationTests extend public void testUnbind() { String dn = "cn=Some Person,ou=company1,ou=Sweden"; // Perform test - dummyDao.unbind(dn, "Some Person"); + this.dummyDao.unbind(dn, "Some Person"); try { // Verify result - check that the operation was not rolled back - ldapTemplate.lookup(dn); + this.ldapTemplate.lookup(dn); fail("NameNotFoundException expected"); } catch (NameNotFoundException expected) { @@ -340,7 +340,7 @@ public class ContextSourceAndDataSourceTransactionManagerIntegrationTests extend } try { - jdbcTemplate.queryForObject("select * from PERSON where fullname=?", new Object[] { "Some Person" }, + this.jdbcTemplate.queryForObject("select * from PERSON where fullname=?", new Object[] { "Some Person" }, new RowMapper() { public Object mapRow(ResultSet rs, int rowNum) throws SQLException { return null; 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 32e051f6..4aca49ad 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 @@ -68,13 +68,13 @@ public class ContextSourceAndDataSourceTransactionManagerLdap179IntegrationTests @After public void cleanup() throws Exception { - jdbcTemplate.execute("drop table PERSON if exists"); + this.jdbcTemplate.execute("drop table PERSON if exists"); } @Test public void verifyThatJdbcTransactionIsClosedIfLdapServerUnavailable_ldap179() { try { - dummyDao.create("Sweden", "company1", "some testperson", "testperson", "some description"); + this.dummyDao.create("Sweden", "company1", "some testperson", "testperson", "some description"); fail("CannotCreateTransactionException expected"); } catch (CannotCreateTransactionException expected) { @@ -85,7 +85,7 @@ public class ContextSourceAndDataSourceTransactionManagerLdap179IntegrationTests assertThat(TransactionSynchronizationManager.isSynchronizationActive()).isFalse(); try { - dummyDao.create("Sweden", "company1", "some testperson", "testperson", "some description"); + this.dummyDao.create("Sweden", "company1", "some testperson", "testperson", "some description"); fail("CannotCreateTransactionException expected"); } catch (CannotCreateTransactionException expected) { 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 ab97fa7b..5004acd9 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 @@ -74,22 +74,22 @@ public class ContextSourceAndDataSourceTransactionManagerNamespaceITests extends TransactionSynchronizationManager.clearSynchronization(); } - jdbcTemplate.execute("drop table PERSON if exists"); - jdbcTemplate + this.jdbcTemplate.execute("drop table PERSON if exists"); + this.jdbcTemplate .execute("create table PERSON(fullname VARCHAR(256), lastname VARCHAR(256), description VARCHAR(256))"); - jdbcTemplate.update("insert into PERSON values(?, ?, ?)", + this.jdbcTemplate.update("insert into PERSON values(?, ?, ?)", new Object[] { "Some Person", "Person", "Sweden, Company1, Some Person" }); } @After public void cleanup() throws Exception { - jdbcTemplate.execute("drop table PERSON if exists"); + this.jdbcTemplate.execute("drop table PERSON if exists"); } @Test public void testCreateWithException() { try { - dummyDao.createWithException("Sweden", "company1", "some testperson", "testperson", "some description"); + this.dummyDao.createWithException("Sweden", "company1", "some testperson", "testperson", "some description"); fail("DummyException expected"); } catch (DummyException expected) { @@ -100,7 +100,7 @@ public class ContextSourceAndDataSourceTransactionManagerNamespaceITests extends // Verify that no entry was created try { - ldapTemplate.lookup("cn=some testperson, ou=company1, ou=Sweden"); + this.ldapTemplate.lookup("cn=some testperson, ou=company1, ou=Sweden"); fail("NameNotFoundException expected"); } catch (NameNotFoundException expected) { @@ -108,7 +108,7 @@ public class ContextSourceAndDataSourceTransactionManagerNamespaceITests extends } try { - jdbcTemplate.queryForObject("select * from PERSON where fullname='some testperson'", new RowMapper() { + this.jdbcTemplate.queryForObject("select * from PERSON where fullname='some testperson'", new RowMapper() { public Object mapRow(ResultSet rs, int rowNum) throws SQLException { return null; } @@ -122,11 +122,11 @@ public class ContextSourceAndDataSourceTransactionManagerNamespaceITests extends @Test public void testCreate() { - dummyDao.create("Sweden", "company1", "some testperson", "testperson", "some description"); + this.dummyDao.create("Sweden", "company1", "some testperson", "testperson", "some description"); log.debug("Verifying result"); - Object ldapResult = ldapTemplate.lookup("cn=some testperson, ou=company1, ou=Sweden"); - Object dbResult = jdbcTemplate.queryForObject("select * from PERSON where fullname='some testperson'", + Object ldapResult = this.ldapTemplate.lookup("cn=some testperson, ou=company1, ou=Sweden"); + Object dbResult = this.jdbcTemplate.queryForObject("select * from PERSON where fullname='some testperson'", new RowMapper() { public Object mapRow(ResultSet rs, int rowNum) throws SQLException { return new Object(); @@ -135,14 +135,14 @@ public class ContextSourceAndDataSourceTransactionManagerNamespaceITests extends assertThat(ldapResult).isNotNull(); assertThat(dbResult).isNotNull(); - ldapTemplate.unbind("cn=some testperson, ou=company1, ou=Sweden"); + this.ldapTemplate.unbind("cn=some testperson, ou=company1, ou=Sweden"); } @Test public void testUpdateWithException() { String dn = "cn=Some Person,ou=company1,ou=Sweden"; try { - dummyDao.updateWithException(dn, "Some Person", "Updated Person", "Updated description"); + this.dummyDao.updateWithException(dn, "Some Person", "Updated Person", "Updated description"); fail("DummyException expected"); } catch (DummyException expected) { @@ -151,7 +151,7 @@ public class ContextSourceAndDataSourceTransactionManagerNamespaceITests extends log.debug("Verifying result"); - Object ldapResult = ldapTemplate.lookup(dn, new AttributesMapper() { + Object ldapResult = this.ldapTemplate.lookup(dn, new AttributesMapper() { public Object mapFromAttributes(Attributes attributes) throws NamingException { assertThat(attributes.get("sn").get()).isEqualTo("Person"); assertThat(attributes.get("description").get()).isEqualTo("Sweden, Company1, Some Person"); @@ -159,7 +159,7 @@ public class ContextSourceAndDataSourceTransactionManagerNamespaceITests extends } }); - Object jdbcResult = jdbcTemplate.queryForObject("select * from PERSON where fullname=?", + Object jdbcResult = this.jdbcTemplate.queryForObject("select * from PERSON where fullname=?", new Object[] { "Some Person" }, new RowMapper() { public Object mapRow(ResultSet rs, int rowNum) throws SQLException { assertThat(rs.getString("lastname")).isEqualTo("Person"); @@ -175,10 +175,10 @@ public class ContextSourceAndDataSourceTransactionManagerNamespaceITests extends @Test public void testUpdate() { String dn = "cn=Some Person,ou=company1,ou=Sweden"; - dummyDao.update(dn, "Some Person", "Updated Person", "Updated description"); + this.dummyDao.update(dn, "Some Person", "Updated Person", "Updated description"); log.debug("Verifying result"); - Object ldapResult = ldapTemplate.lookup(dn, new AttributesMapper() { + Object ldapResult = this.ldapTemplate.lookup(dn, new AttributesMapper() { public Object mapFromAttributes(Attributes attributes) throws NamingException { assertThat(attributes.get("sn").get()).isEqualTo("Updated Person"); assertThat(attributes.get("description").get()).isEqualTo("Updated description"); @@ -186,7 +186,7 @@ public class ContextSourceAndDataSourceTransactionManagerNamespaceITests extends } }); - Object jdbcResult = jdbcTemplate.queryForObject("select * from PERSON where fullname=?", + Object jdbcResult = this.jdbcTemplate.queryForObject("select * from PERSON where fullname=?", new Object[] { "Some Person" }, new RowMapper() { public Object mapRow(ResultSet rs, int rowNum) throws SQLException { assertThat(rs.getString("lastname")).isEqualTo("Updated Person"); @@ -197,7 +197,7 @@ public class ContextSourceAndDataSourceTransactionManagerNamespaceITests extends assertThat(ldapResult).isNotNull(); assertThat(jdbcResult).isNotNull(); - dummyDao.update(dn, "Some Person", "Person", "Sweden, Company1, Some Person"); + this.dummyDao.update(dn, "Some Person", "Person", "Sweden, Company1, Some Person"); } @Test @@ -206,7 +206,7 @@ public class ContextSourceAndDataSourceTransactionManagerNamespaceITests extends String newDn = "cn=Some Person2,ou=company2,ou=Sweden"; try { // Perform test - dummyDao.updateAndRenameWithException(dn, newDn, "Updated description"); + this.dummyDao.updateAndRenameWithException(dn, newDn, "Updated description"); fail("DummyException expected"); } catch (DummyException expected) { @@ -215,7 +215,7 @@ public class ContextSourceAndDataSourceTransactionManagerNamespaceITests extends // Verify that entry was not moved. try { - ldapTemplate.lookup(newDn); + this.ldapTemplate.lookup(newDn); fail("NameNotFoundException expected"); } catch (NameNotFoundException expected) { @@ -223,7 +223,7 @@ public class ContextSourceAndDataSourceTransactionManagerNamespaceITests extends } // Verify that original entry was not updated. - Object object = ldapTemplate.lookup(dn, new AttributesMapper() { + Object object = this.ldapTemplate.lookup(dn, new AttributesMapper() { public Object mapFromAttributes(Attributes attributes) throws NamingException { assertThat(attributes.get("description").get()).isEqualTo("Sweden, Company1, Some Person2"); return new Object(); @@ -237,10 +237,10 @@ public class ContextSourceAndDataSourceTransactionManagerNamespaceITests extends String dn = "cn=Some Person2,ou=company1,ou=Sweden"; String newDn = "cn=Some Person2,ou=company2,ou=Sweden"; // Perform test - dummyDao.updateAndRename(dn, newDn, "Updated description"); + this.dummyDao.updateAndRename(dn, newDn, "Updated description"); // Verify that entry was moved and updated. - Object object = ldapTemplate.lookup(newDn, new AttributesMapper() { + Object object = this.ldapTemplate.lookup(newDn, new AttributesMapper() { public Object mapFromAttributes(Attributes attributes) throws NamingException { assertThat(attributes.get("description").get()).isEqualTo("Updated description"); return new Object(); @@ -248,7 +248,7 @@ public class ContextSourceAndDataSourceTransactionManagerNamespaceITests extends }); assertThat(object).isNotNull(); - dummyDao.updateAndRename(newDn, dn, "Sweden, Company1, Some Person2"); + this.dummyDao.updateAndRename(newDn, dn, "Sweden, Company1, Some Person2"); } @Test @@ -256,7 +256,7 @@ public class ContextSourceAndDataSourceTransactionManagerNamespaceITests extends String dn = "cn=Some Person,ou=company1,ou=Sweden"; try { // Perform test - dummyDao.modifyAttributesWithException(dn, "Updated lastname", "Updated description"); + this.dummyDao.modifyAttributesWithException(dn, "Updated lastname", "Updated description"); fail("DummyException expected"); } catch (DummyException expected) { @@ -264,7 +264,7 @@ public class ContextSourceAndDataSourceTransactionManagerNamespaceITests extends } // Verify result - check that the operation was properly rolled back - Object result = ldapTemplate.lookup(dn, new AttributesMapper() { + Object result = this.ldapTemplate.lookup(dn, new AttributesMapper() { public Object mapFromAttributes(Attributes attributes) throws NamingException { assertThat(attributes.get("sn").get()).isEqualTo("Person"); assertThat(attributes.get("description").get()).isEqualTo("Sweden, Company1, Some Person"); @@ -279,10 +279,10 @@ public class ContextSourceAndDataSourceTransactionManagerNamespaceITests extends public void testModifyAttributes() { String dn = "cn=Some Person,ou=company1,ou=Sweden"; // Perform test - dummyDao.modifyAttributes(dn, "Updated lastname", "Updated description"); + this.dummyDao.modifyAttributes(dn, "Updated lastname", "Updated description"); // Verify result - check that the operation was not rolled back - Object result = ldapTemplate.lookup(dn, new AttributesMapper() { + Object result = this.ldapTemplate.lookup(dn, new AttributesMapper() { public Object mapFromAttributes(Attributes attributes) throws NamingException { assertThat(attributes.get("sn").get()).isEqualTo("Updated lastname"); assertThat(attributes.get("description").get()).isEqualTo("Updated description"); @@ -291,7 +291,7 @@ public class ContextSourceAndDataSourceTransactionManagerNamespaceITests extends }); assertThat(result).isNotNull(); - dummyDao.update(dn, "Some Person", "Person", "Sweden, Company1, Some Person"); + this.dummyDao.update(dn, "Some Person", "Person", "Sweden, Company1, Some Person"); } @Test @@ -299,7 +299,7 @@ public class ContextSourceAndDataSourceTransactionManagerNamespaceITests extends String dn = "cn=Some Person,ou=company1,ou=Sweden"; try { // Perform test - dummyDao.unbindWithException(dn, "Some Person"); + this.dummyDao.unbindWithException(dn, "Some Person"); fail("DummyException expected"); } catch (DummyException expected) { @@ -307,14 +307,14 @@ public class ContextSourceAndDataSourceTransactionManagerNamespaceITests extends } // Verify result - check that the operation was properly rolled back - Object ldapResult = ldapTemplate.lookup(dn, new AttributesMapper() { + Object ldapResult = this.ldapTemplate.lookup(dn, new AttributesMapper() { public Object mapFromAttributes(Attributes attributes) throws NamingException { // Just verify that the entry still exists. return new Object(); } }); - Object jdbcResult = jdbcTemplate.queryForObject("select * from PERSON where fullname=?", + Object jdbcResult = this.jdbcTemplate.queryForObject("select * from PERSON where fullname=?", new Object[] { "Some Person" }, new RowMapper() { public Object mapRow(ResultSet rs, int rowNum) throws SQLException { // Just verify that the entry still exists. @@ -330,11 +330,11 @@ public class ContextSourceAndDataSourceTransactionManagerNamespaceITests extends public void testUnbind() { String dn = "cn=Some Person,ou=company1,ou=Sweden"; // Perform test - dummyDao.unbind(dn, "Some Person"); + this.dummyDao.unbind(dn, "Some Person"); try { // Verify result - check that the operation was not rolled back - ldapTemplate.lookup(dn); + this.ldapTemplate.lookup(dn); fail("NameNotFoundException expected"); } catch (NameNotFoundException expected) { @@ -342,7 +342,7 @@ public class ContextSourceAndDataSourceTransactionManagerNamespaceITests extends } try { - jdbcTemplate.queryForObject("select * from PERSON where fullname=?", new Object[] { "Some Person" }, + this.jdbcTemplate.queryForObject("select * from PERSON where fullname=?", new Object[] { "Some Person" }, new RowMapper() { public Object mapRow(ResultSet rs, int rowNum) throws SQLException { return null; diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/itest/manager/ContextSourceTransactionManagerIntegrationTests.java b/test/integration-tests/src/test/java/org/springframework/ldap/itest/manager/ContextSourceTransactionManagerIntegrationTests.java index 12a6a6bb..4faed9b0 100644 --- a/test/integration-tests/src/test/java/org/springframework/ldap/itest/manager/ContextSourceTransactionManagerIntegrationTests.java +++ b/test/integration-tests/src/test/java/org/springframework/ldap/itest/manager/ContextSourceTransactionManagerIntegrationTests.java @@ -65,7 +65,7 @@ public class ContextSourceTransactionManagerIntegrationTests extends AbstractLda @Test public void testCreateWithException() { try { - dummyDao.createWithException("Sweden", "company1", "some testperson", "testperson", "some description"); + this.dummyDao.createWithException("Sweden", "company1", "some testperson", "testperson", "some description"); fail("DummyException expected"); } catch (DummyException expected) { @@ -76,7 +76,7 @@ public class ContextSourceTransactionManagerIntegrationTests extends AbstractLda // Verify that no entry was created try { - ldapTemplate.lookup("cn=some testperson, ou=company1, ou=Sweden"); + this.ldapTemplate.lookup("cn=some testperson, ou=company1, ou=Sweden"); fail("NameNotFoundException expected"); } catch (NameNotFoundException expected) { @@ -86,21 +86,21 @@ public class ContextSourceTransactionManagerIntegrationTests extends AbstractLda @Test public void testCreate() { - dummyDao.create("Sweden", "company1", "some testperson", "testperson", "some description"); + this.dummyDao.create("Sweden", "company1", "some testperson", "testperson", "some description"); log.debug("Verifying result"); String expectedDn = "cn=some testperson, ou=company1, ou=Sweden"; - Object ldapResult = ldapTemplate.lookup(expectedDn); + Object ldapResult = this.ldapTemplate.lookup(expectedDn); assertThat(ldapResult).isNotNull(); - ldapTemplate.unbind(expectedDn); + this.ldapTemplate.unbind(expectedDn); } @Test public void testUpdateWithException() { String dn = "cn=Some Person,ou=company1,ou=Sweden"; try { - dummyDao.updateWithException(dn, "Some Person", "Updated Person", "Updated description"); + this.dummyDao.updateWithException(dn, "Some Person", "Updated Person", "Updated description"); fail("DummyException expected"); } catch (DummyException expected) { @@ -109,7 +109,7 @@ public class ContextSourceTransactionManagerIntegrationTests extends AbstractLda log.debug("Verifying result"); - Object ldapResult = ldapTemplate.lookup(dn, new AttributesMapper() { + Object ldapResult = this.ldapTemplate.lookup(dn, new AttributesMapper() { public Object mapFromAttributes(Attributes attributes) throws NamingException { assertThat(attributes.get("sn").get()).isEqualTo("Person"); assertThat(attributes.get("description").get()).isEqualTo("Sweden, Company1, Some Person"); @@ -123,10 +123,10 @@ public class ContextSourceTransactionManagerIntegrationTests extends AbstractLda @Test public void testUpdate() { String dn = "cn=Some Person,ou=company1,ou=Sweden"; - dummyDao.update(dn, "Some Person", "Updated Person", "Updated description"); + this.dummyDao.update(dn, "Some Person", "Updated Person", "Updated description"); log.debug("Verifying result"); - Object ldapResult = ldapTemplate.lookup(dn, new AttributesMapper() { + Object ldapResult = this.ldapTemplate.lookup(dn, new AttributesMapper() { public Object mapFromAttributes(Attributes attributes) throws NamingException { assertThat(attributes.get("sn").get()).isEqualTo("Updated Person"); assertThat(attributes.get("description").get()).isEqualTo("Updated description"); @@ -136,7 +136,7 @@ public class ContextSourceTransactionManagerIntegrationTests extends AbstractLda assertThat(ldapResult).isNotNull(); - dummyDao.update(dn, "Some Person", "Person", "Sweden, Company1, Some Person"); + this.dummyDao.update(dn, "Some Person", "Person", "Sweden, Company1, Some Person"); } @Test @@ -145,7 +145,7 @@ public class ContextSourceTransactionManagerIntegrationTests extends AbstractLda String newDn = "cn=Some Person2,ou=company2,ou=Sweden"; try { // Perform test - dummyDao.updateAndRenameWithException(dn, newDn, "Updated description"); + this.dummyDao.updateAndRenameWithException(dn, newDn, "Updated description"); fail("DummyException expected"); } catch (DummyException expected) { @@ -154,7 +154,7 @@ public class ContextSourceTransactionManagerIntegrationTests extends AbstractLda // Verify that entry was not moved. try { - ldapTemplate.lookup(newDn); + this.ldapTemplate.lookup(newDn); fail("NameNotFoundException expected"); } catch (NameNotFoundException expected) { @@ -162,7 +162,7 @@ public class ContextSourceTransactionManagerIntegrationTests extends AbstractLda } // Verify that original entry was not updated. - Object object = ldapTemplate.lookup(dn, new AttributesMapper() { + Object object = this.ldapTemplate.lookup(dn, new AttributesMapper() { public Object mapFromAttributes(Attributes attributes) throws NamingException { assertThat(attributes.get("description").get()).isEqualTo("Sweden, Company1, Some Person2"); return new Object(); @@ -176,10 +176,10 @@ public class ContextSourceTransactionManagerIntegrationTests extends AbstractLda String dn = "cn=Some Person2,ou=company1,ou=Sweden"; String newDn = "cn=Some Person2,ou=company2,ou=Sweden"; // Perform test - dummyDao.updateAndRename(dn, newDn, "Updated description"); + this.dummyDao.updateAndRename(dn, newDn, "Updated description"); // Verify that entry was moved and updated. - Object object = ldapTemplate.lookup(newDn, new AttributesMapper() { + Object object = this.ldapTemplate.lookup(newDn, new AttributesMapper() { public Object mapFromAttributes(Attributes attributes) throws NamingException { assertThat(attributes.get("description").get()).isEqualTo("Updated description"); return new Object(); @@ -187,7 +187,7 @@ public class ContextSourceTransactionManagerIntegrationTests extends AbstractLda }); assertThat(object).isNotNull(); - dummyDao.updateAndRename(newDn, dn, "Sweden, Company1, Some Person2"); + this.dummyDao.updateAndRename(newDn, dn, "Sweden, Company1, Some Person2"); } @Test @@ -195,7 +195,7 @@ public class ContextSourceTransactionManagerIntegrationTests extends AbstractLda String dn = "cn=Some Person,ou=company1,ou=Sweden"; try { // Perform test - dummyDao.modifyAttributesWithException(dn, "Updated lastname", "Updated description"); + this.dummyDao.modifyAttributesWithException(dn, "Updated lastname", "Updated description"); fail("DummyException expected"); } catch (DummyException expected) { @@ -203,7 +203,7 @@ public class ContextSourceTransactionManagerIntegrationTests extends AbstractLda } // Verify result - check that the operation was properly rolled back - Object result = ldapTemplate.lookup(dn, new AttributesMapper() { + Object result = this.ldapTemplate.lookup(dn, new AttributesMapper() { public Object mapFromAttributes(Attributes attributes) throws NamingException { assertThat(attributes.get("sn").get()).isEqualTo("Person"); assertThat(attributes.get("description").get()).isEqualTo("Sweden, Company1, Some Person"); @@ -218,10 +218,10 @@ public class ContextSourceTransactionManagerIntegrationTests extends AbstractLda public void testModifyAttributes() { String dn = "cn=Some Person,ou=company1,ou=Sweden"; // Perform test - dummyDao.modifyAttributes(dn, "Updated lastname", "Updated description"); + this.dummyDao.modifyAttributes(dn, "Updated lastname", "Updated description"); // Verify result - check that the operation was not rolled back - Object result = ldapTemplate.lookup(dn, new AttributesMapper() { + Object result = this.ldapTemplate.lookup(dn, new AttributesMapper() { public Object mapFromAttributes(Attributes attributes) throws NamingException { assertThat(attributes.get("sn").get()).isEqualTo("Updated lastname"); assertThat(attributes.get("description").get()).isEqualTo("Updated description"); @@ -237,7 +237,7 @@ public class ContextSourceTransactionManagerIntegrationTests extends AbstractLda String dn = "cn=Some Person,ou=company1,ou=Sweden"; try { // Perform test - dummyDao.unbindWithException(dn, "Some Person"); + this.dummyDao.unbindWithException(dn, "Some Person"); fail("DummyException expected"); } catch (DummyException expected) { @@ -245,7 +245,7 @@ public class ContextSourceTransactionManagerIntegrationTests extends AbstractLda } // Verify result - check that the operation was properly rolled back - Object ldapResult = ldapTemplate.lookup(dn, new AttributesMapper() { + Object ldapResult = this.ldapTemplate.lookup(dn, new AttributesMapper() { public Object mapFromAttributes(Attributes attributes) throws NamingException { // Just verify that the entry still exists. return new Object(); @@ -259,11 +259,11 @@ public class ContextSourceTransactionManagerIntegrationTests extends AbstractLda public void testUnbind() { String dn = "cn=Some Person,ou=company1,ou=Sweden"; // Perform test - dummyDao.unbind(dn, "Some Person"); + this.dummyDao.unbind(dn, "Some Person"); try { // Verify result - check that the operation was not rolled back - ldapTemplate.lookup(dn); + this.ldapTemplate.lookup(dn); fail("NameNotFoundException expected"); } catch (NameNotFoundException expected) { diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/itest/manager/ContextSourceTransactionManagerNamespaceIntegrationTests.java b/test/integration-tests/src/test/java/org/springframework/ldap/itest/manager/ContextSourceTransactionManagerNamespaceIntegrationTests.java index ed32fb19..cae7fcec 100644 --- a/test/integration-tests/src/test/java/org/springframework/ldap/itest/manager/ContextSourceTransactionManagerNamespaceIntegrationTests.java +++ b/test/integration-tests/src/test/java/org/springframework/ldap/itest/manager/ContextSourceTransactionManagerNamespaceIntegrationTests.java @@ -66,7 +66,7 @@ public class ContextSourceTransactionManagerNamespaceIntegrationTests extends Ab @Test public void testCreateWithException() { try { - dummyDao.createWithException("Sweden", "company1", "some testperson", "testperson", "some description"); + this.dummyDao.createWithException("Sweden", "company1", "some testperson", "testperson", "some description"); fail("DummyException expected"); } catch (DummyException expected) { @@ -77,7 +77,7 @@ public class ContextSourceTransactionManagerNamespaceIntegrationTests extends Ab // Verify that no entry was created try { - ldapTemplate.lookup("cn=some testperson, ou=company1, ou=Sweden"); + this.ldapTemplate.lookup("cn=some testperson, ou=company1, ou=Sweden"); fail("NameNotFoundException expected"); } catch (NameNotFoundException expected) { @@ -87,21 +87,21 @@ public class ContextSourceTransactionManagerNamespaceIntegrationTests extends Ab @Test public void testCreate() { - dummyDao.create("Sweden", "company1", "some testperson", "testperson", "some description"); + this.dummyDao.create("Sweden", "company1", "some testperson", "testperson", "some description"); log.debug("Verifying result"); String expectedDn = "cn=some testperson, ou=company1, ou=Sweden"; - Object ldapResult = ldapTemplate.lookup(expectedDn); + Object ldapResult = this.ldapTemplate.lookup(expectedDn); assertThat(ldapResult).isNotNull(); - ldapTemplate.unbind(expectedDn); + this.ldapTemplate.unbind(expectedDn); } @Test public void testUpdateWithException() { String dn = "cn=Some Person,ou=company1,ou=Sweden"; try { - dummyDao.updateWithException(dn, "Some Person", "Updated Person", "Updated description"); + this.dummyDao.updateWithException(dn, "Some Person", "Updated Person", "Updated description"); fail("DummyException expected"); } catch (DummyException expected) { @@ -110,7 +110,7 @@ public class ContextSourceTransactionManagerNamespaceIntegrationTests extends Ab log.debug("Verifying result"); - Object ldapResult = ldapTemplate.lookup(dn, new AttributesMapper() { + Object ldapResult = this.ldapTemplate.lookup(dn, new AttributesMapper() { public Object mapFromAttributes(Attributes attributes) throws NamingException { assertThat(attributes.get("sn").get()).isEqualTo("Person"); assertThat(attributes.get("description").get()).isEqualTo("Sweden, Company1, Some Person"); @@ -124,10 +124,10 @@ public class ContextSourceTransactionManagerNamespaceIntegrationTests extends Ab @Test public void testUpdate() { String dn = "cn=Some Person,ou=company1,ou=Sweden"; - dummyDao.update(dn, "Some Person", "Updated Person", "Updated description"); + this.dummyDao.update(dn, "Some Person", "Updated Person", "Updated description"); log.debug("Verifying result"); - Object ldapResult = ldapTemplate.lookup(dn, new AttributesMapper() { + Object ldapResult = this.ldapTemplate.lookup(dn, new AttributesMapper() { public Object mapFromAttributes(Attributes attributes) throws NamingException { assertThat(attributes.get("sn").get()).isEqualTo("Updated Person"); assertThat(attributes.get("description").get()).isEqualTo("Updated description"); @@ -137,7 +137,7 @@ public class ContextSourceTransactionManagerNamespaceIntegrationTests extends Ab assertThat(ldapResult).isNotNull(); - dummyDao.update(dn, "Some Person", "Person", "Sweden, Company1, Some Person"); + this.dummyDao.update(dn, "Some Person", "Person", "Sweden, Company1, Some Person"); } @Test @@ -146,7 +146,7 @@ public class ContextSourceTransactionManagerNamespaceIntegrationTests extends Ab String newDn = "cn=Some Person2,ou=company2,ou=Sweden"; try { // Perform test - dummyDao.updateAndRenameWithException(dn, newDn, "Updated description"); + this.dummyDao.updateAndRenameWithException(dn, newDn, "Updated description"); fail("DummyException expected"); } catch (DummyException expected) { @@ -155,7 +155,7 @@ public class ContextSourceTransactionManagerNamespaceIntegrationTests extends Ab // Verify that entry was not moved. try { - ldapTemplate.lookup(newDn); + this.ldapTemplate.lookup(newDn); fail("NameNotFoundException expected"); } catch (NameNotFoundException expected) { @@ -163,7 +163,7 @@ public class ContextSourceTransactionManagerNamespaceIntegrationTests extends Ab } // Verify that original entry was not updated. - Object object = ldapTemplate.lookup(dn, new AttributesMapper() { + Object object = this.ldapTemplate.lookup(dn, new AttributesMapper() { public Object mapFromAttributes(Attributes attributes) throws NamingException { assertThat(attributes.get("description").get()).isEqualTo("Sweden, Company1, Some Person2"); return new Object(); @@ -177,10 +177,10 @@ public class ContextSourceTransactionManagerNamespaceIntegrationTests extends Ab String dn = "cn=Some Person2,ou=company1,ou=Sweden"; String newDn = "cn=Some Person2,ou=company2,ou=Sweden"; // Perform test - dummyDao.updateAndRename(dn, newDn, "Updated description"); + this.dummyDao.updateAndRename(dn, newDn, "Updated description"); // Verify that entry was moved and updated. - Object object = ldapTemplate.lookup(newDn, new AttributesMapper() { + Object object = this.ldapTemplate.lookup(newDn, new AttributesMapper() { public Object mapFromAttributes(Attributes attributes) throws NamingException { assertThat(attributes.get("description").get()).isEqualTo("Updated description"); return new Object(); @@ -188,7 +188,7 @@ public class ContextSourceTransactionManagerNamespaceIntegrationTests extends Ab }); assertThat(object).isNotNull(); - dummyDao.updateAndRename(newDn, dn, "Sweden, Company1, Some Person2"); + this.dummyDao.updateAndRename(newDn, dn, "Sweden, Company1, Some Person2"); } @Test @@ -196,7 +196,7 @@ public class ContextSourceTransactionManagerNamespaceIntegrationTests extends Ab String dn = "cn=Some Person,ou=company1,ou=Sweden"; try { // Perform test - dummyDao.modifyAttributesWithException(dn, "Updated lastname", "Updated description"); + this.dummyDao.modifyAttributesWithException(dn, "Updated lastname", "Updated description"); fail("DummyException expected"); } catch (DummyException expected) { @@ -204,7 +204,7 @@ public class ContextSourceTransactionManagerNamespaceIntegrationTests extends Ab } // Verify result - check that the operation was properly rolled back - Object result = ldapTemplate.lookup(dn, new AttributesMapper() { + Object result = this.ldapTemplate.lookup(dn, new AttributesMapper() { public Object mapFromAttributes(Attributes attributes) throws NamingException { assertThat(attributes.get("sn").get()).isEqualTo("Person"); assertThat(attributes.get("description").get()).isEqualTo("Sweden, Company1, Some Person"); @@ -219,10 +219,10 @@ public class ContextSourceTransactionManagerNamespaceIntegrationTests extends Ab public void testModifyAttributes() { String dn = "cn=Some Person,ou=company1,ou=Sweden"; // Perform test - dummyDao.modifyAttributes(dn, "Updated lastname", "Updated description"); + this.dummyDao.modifyAttributes(dn, "Updated lastname", "Updated description"); // Verify result - check that the operation was not rolled back - Object result = ldapTemplate.lookup(dn, new AttributesMapper() { + Object result = this.ldapTemplate.lookup(dn, new AttributesMapper() { public Object mapFromAttributes(Attributes attributes) throws NamingException { assertThat(attributes.get("sn").get()).isEqualTo("Updated lastname"); assertThat(attributes.get("description").get()).isEqualTo("Updated description"); @@ -238,7 +238,7 @@ public class ContextSourceTransactionManagerNamespaceIntegrationTests extends Ab String dn = "cn=Some Person,ou=company1,ou=Sweden"; try { // Perform test - dummyDao.unbindWithException(dn, "Some Person"); + this.dummyDao.unbindWithException(dn, "Some Person"); fail("DummyException expected"); } catch (DummyException expected) { @@ -246,7 +246,7 @@ public class ContextSourceTransactionManagerNamespaceIntegrationTests extends Ab } // Verify result - check that the operation was properly rolled back - Object ldapResult = ldapTemplate.lookup(dn, new AttributesMapper() { + Object ldapResult = this.ldapTemplate.lookup(dn, new AttributesMapper() { public Object mapFromAttributes(Attributes attributes) throws NamingException { // Just verify that the entry still exists. return new Object(); @@ -260,11 +260,11 @@ public class ContextSourceTransactionManagerNamespaceIntegrationTests extends Ab public void testUnbind() { String dn = "cn=Some Person,ou=company1,ou=Sweden"; // Perform test - dummyDao.unbind(dn, "Some Person"); + this.dummyDao.unbind(dn, "Some Person"); try { // Verify result - check that the operation was not rolled back - ldapTemplate.lookup(dn); + this.ldapTemplate.lookup(dn); fail("NameNotFoundException expected"); } catch (NameNotFoundException expected) { diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/itest/manager/ContextSourceTransactionManagerSubtreeIntegrationTests.java b/test/integration-tests/src/test/java/org/springframework/ldap/itest/manager/ContextSourceTransactionManagerSubtreeIntegrationTests.java index 789b7fd7..d8fd56e0 100644 --- a/test/integration-tests/src/test/java/org/springframework/ldap/itest/manager/ContextSourceTransactionManagerSubtreeIntegrationTests.java +++ b/test/integration-tests/src/test/java/org/springframework/ldap/itest/manager/ContextSourceTransactionManagerSubtreeIntegrationTests.java @@ -64,10 +64,10 @@ public class ContextSourceTransactionManagerSubtreeIntegrationTests extends Abst @Test public void testLdap168DeleteRecursively() { - dummyDao.deleteRecursively("ou=company1,ou=Sweden"); + this.dummyDao.deleteRecursively("ou=company1,ou=Sweden"); try { - ldapTemplate.lookup("ou=company1,ou=Sweden"); + this.ldapTemplate.lookup("ou=company1,ou=Sweden"); fail("NameNotFoundException expected"); } catch (NameNotFoundException expected) { @@ -78,7 +78,7 @@ public class ContextSourceTransactionManagerSubtreeIntegrationTests extends Abst @Test public void testLdap168DeleteWithException() { try { - dummyDao.deleteRecursivelyWithException("ou=company1,ou=Sweden"); + this.dummyDao.deleteRecursivelyWithException("ou=company1,ou=Sweden"); fail("DummyException expected"); } catch (DummyException expected) { @@ -86,18 +86,18 @@ public class ContextSourceTransactionManagerSubtreeIntegrationTests extends Abst } // Entry should have been restored - ldapTemplate.lookup("ou=company1,ou=Sweden"); + this.ldapTemplate.lookup("ou=company1,ou=Sweden"); } @Test public void testLdap244CreateRecursively() { - dummyDao.createRecursivelyAndUnbindSubnode(); + this.dummyDao.createRecursivelyAndUnbindSubnode(); } @Test public void testLdap244CreateRecursivelyWithException() { try { - dummyDao.createRecursivelyAndUnbindSubnodeWithException(); + this.dummyDao.createRecursivelyAndUnbindSubnodeWithException(); fail("DummyException expected"); } catch (DummyException expected) { 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 924e6e44..10d45c9d 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 @@ -119,7 +119,7 @@ public class ContextSourceAndHibernateTransactionManagerIntegrationTests extends person.setCompany("company1"); try { - dummyDao.createWithException(person); + this.dummyDao.createWithException(person); fail("DummyException expected"); } catch (DummyException expected) { @@ -130,14 +130,14 @@ public class ContextSourceAndHibernateTransactionManagerIntegrationTests extends // Verify that no entry was created in ldap or hibernate db try { - ldapTemplate.lookup("cn=some testperson, ou=company1, ou=Sweden"); + this.ldapTemplate.lookup("cn=some testperson, ou=company1, ou=Sweden"); fail("NameNotFoundException expected"); } catch (NameNotFoundException expected) { assertThat(true).isTrue(); } - List result = hibernateTemplate.findByNamedParam("from OrgPerson person where person.lastname = :lastname", + List result = this.hibernateTemplate.findByNamedParam("from OrgPerson person where person.lastname = :lastname", "lastname", person.getLastname()); assertThat(result.size() == 0).isTrue(); @@ -159,7 +159,7 @@ public class ContextSourceAndHibernateTransactionManagerIntegrationTests extends this.dummyDao.create(person); person = null; log.debug("Verifying result"); - Object ldapResult = ldapTemplate.lookup("cn=some testperson, ou=company1, ou=Sweden"); + Object ldapResult = this.ldapTemplate.lookup("cn=some testperson, ou=company1, ou=Sweden"); OrgPerson fromDb = (OrgPerson) this.hibernateTemplate.get(OrgPerson.class, new Integer(2)); assertThat(ldapResult).isNotNull(); assertThat(fromDb).isNotNull(); @@ -171,7 +171,7 @@ public class ContextSourceAndHibernateTransactionManagerIntegrationTests extends OrgPerson originalPerson = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1)); originalPerson.setLastname("fooo"); try { - dummyDao.updateWithException(originalPerson); + this.dummyDao.updateWithException(originalPerson); fail("DummyException expected"); } catch (DummyException expected) { @@ -180,7 +180,7 @@ public class ContextSourceAndHibernateTransactionManagerIntegrationTests extends log.debug("Verifying result"); - Object ldapResult = ldapTemplate.lookup(dn, new AttributesMapper() { + Object ldapResult = this.ldapTemplate.lookup(dn, new AttributesMapper() { public Object mapFromAttributes(Attributes attributes) throws NamingException { assertThat(attributes.get("sn").get()).as("Person").isNotNull(); assertThat(attributes.get("description").get()).isEqualTo("Sweden, Company1, Some Person"); @@ -203,10 +203,10 @@ public class ContextSourceAndHibernateTransactionManagerIntegrationTests extends person.setLastname("Updated Person"); person.setDescription("Updated description"); - dummyDao.update(person); + this.dummyDao.update(person); log.debug("Verifying result"); - Object ldapResult = ldapTemplate.lookup(dn, new AttributesMapper() { + Object ldapResult = this.ldapTemplate.lookup(dn, new AttributesMapper() { public Object mapFromAttributes(Attributes attributes) throws NamingException { assertThat(attributes.get("sn").get()).isEqualTo("Updated Person"); assertThat(attributes.get("description").get()).isEqualTo("Updated description"); @@ -230,7 +230,7 @@ public class ContextSourceAndHibernateTransactionManagerIntegrationTests extends try { // Perform test - dummyDao.updateAndRenameWithException(dn, newDn, "Updated description"); + this.dummyDao.updateAndRenameWithException(dn, newDn, "Updated description"); fail("DummyException expected"); } catch (DummyException expected) { @@ -239,7 +239,7 @@ public class ContextSourceAndHibernateTransactionManagerIntegrationTests extends // Verify that entry was not moved. try { - ldapTemplate.lookup(newDn); + this.ldapTemplate.lookup(newDn); fail("NameNotFoundException expected"); } catch (NameNotFoundException expected) { @@ -247,7 +247,7 @@ public class ContextSourceAndHibernateTransactionManagerIntegrationTests extends } // Verify that original entry was not updated. - Object object = ldapTemplate.lookup(dn, new AttributesMapper() { + Object object = this.ldapTemplate.lookup(dn, new AttributesMapper() { public Object mapFromAttributes(Attributes attributes) throws NamingException { assertThat(attributes.get("description").get()).isEqualTo("Sweden, Company1, Some Person2"); return new Object(); @@ -261,10 +261,10 @@ public class ContextSourceAndHibernateTransactionManagerIntegrationTests extends String dn = "cn=Some Person2,ou=company1,ou=Sweden"; String newDn = "cn=Some Person2,ou=company2,ou=Sweden"; // Perform test - dummyDao.updateAndRename(dn, newDn, "Updated description"); + this.dummyDao.updateAndRename(dn, newDn, "Updated description"); // Verify that entry was moved and updated. - Object object = ldapTemplate.lookup(newDn, new AttributesMapper() { + Object object = this.ldapTemplate.lookup(newDn, new AttributesMapper() { public Object mapFromAttributes(Attributes attributes) throws NamingException { assertThat(attributes.get("description").get()).isEqualTo("Updated description"); return new Object(); @@ -279,7 +279,7 @@ public class ContextSourceAndHibernateTransactionManagerIntegrationTests extends String dn = "cn=Some Person,ou=company1,ou=Sweden"; try { // Perform test - dummyDao.modifyAttributesWithException(dn, "Updated lastname", "Updated description"); + this.dummyDao.modifyAttributesWithException(dn, "Updated lastname", "Updated description"); fail("DummyException expected"); } catch (DummyException expected) { @@ -287,7 +287,7 @@ public class ContextSourceAndHibernateTransactionManagerIntegrationTests extends } // Verify result - check that the operation was properly rolled back - Object result = ldapTemplate.lookup(dn, new AttributesMapper() { + Object result = this.ldapTemplate.lookup(dn, new AttributesMapper() { public Object mapFromAttributes(Attributes attributes) throws NamingException { assertThat(attributes.get("sn").get()).isEqualTo("Person"); assertThat(attributes.get("description").get()).isEqualTo("Sweden, Company1, Some Person"); @@ -302,10 +302,10 @@ public class ContextSourceAndHibernateTransactionManagerIntegrationTests extends public void testModifyAttributes() { String dn = "cn=Some Person,ou=company1,ou=Sweden"; // Perform test - dummyDao.modifyAttributes(dn, "Updated lastname", "Updated description"); + this.dummyDao.modifyAttributes(dn, "Updated lastname", "Updated description"); // Verify result - check that the operation was not rolled back - Object result = ldapTemplate.lookup(dn, new AttributesMapper() { + Object result = this.ldapTemplate.lookup(dn, new AttributesMapper() { public Object mapFromAttributes(Attributes attributes) throws NamingException { assertThat(attributes.get("sn").get()).isEqualTo("Updated lastname"); assertThat(attributes.get("description").get()).isEqualTo("Updated description"); @@ -323,7 +323,7 @@ public class ContextSourceAndHibernateTransactionManagerIntegrationTests extends try { // Perform test - dummyDao.unbindWithException(person); + this.dummyDao.unbindWithException(person); fail("DummyException expected"); } catch (DummyException expected) { @@ -332,7 +332,7 @@ public class ContextSourceAndHibernateTransactionManagerIntegrationTests extends person = null; // Verify result - check that the operation was properly rolled back - Object ldapResult = ldapTemplate.lookup(dn, new AttributesMapper() { + Object ldapResult = this.ldapTemplate.lookup(dn, new AttributesMapper() { public Object mapFromAttributes(Attributes attributes) throws NamingException { // Just verify that the entry still exists. return new Object(); @@ -356,11 +356,11 @@ public class ContextSourceAndHibernateTransactionManagerIntegrationTests extends String dn = "cn=Some Person,ou=company1,ou=Sweden"; // Perform test OrgPerson person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1)); - dummyDao.unbind(person); + this.dummyDao.unbind(person); try { // Verify result - check that the operation was not rolled back - ldapTemplate.lookup(dn); + this.ldapTemplate.lookup(dn); fail("NameNotFoundException expected"); } catch (NameNotFoundException expected) { 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 33963cd8..64e63e30 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 @@ -120,7 +120,7 @@ public class ContextSourceAndHibernateTransactionManagerNamespaceITests extends person.setCompany("company1"); try { - dummyDao.createWithException(person); + this.dummyDao.createWithException(person); fail("DummyException expected"); } catch (DummyException expected) { @@ -131,14 +131,14 @@ public class ContextSourceAndHibernateTransactionManagerNamespaceITests extends // Verify that no entry was created in ldap or hibernate db try { - ldapTemplate.lookup("cn=some testperson, ou=company1, ou=Sweden"); + this.ldapTemplate.lookup("cn=some testperson, ou=company1, ou=Sweden"); fail("NameNotFoundException expected"); } catch (NameNotFoundException expected) { assertThat(true).isTrue(); } - List result = hibernateTemplate.findByNamedParam("from OrgPerson person where person.lastname = :lastname", + List result = this.hibernateTemplate.findByNamedParam("from OrgPerson person where person.lastname = :lastname", "lastname", person.getLastname()); assertThat(result.size() == 0).isTrue(); @@ -160,7 +160,7 @@ public class ContextSourceAndHibernateTransactionManagerNamespaceITests extends this.dummyDao.create(person); person = null; log.debug("Verifying result"); - Object ldapResult = ldapTemplate.lookup("cn=some testperson, ou=company1, ou=Sweden"); + Object ldapResult = this.ldapTemplate.lookup("cn=some testperson, ou=company1, ou=Sweden"); OrgPerson fromDb = (OrgPerson) this.hibernateTemplate.get(OrgPerson.class, new Integer(2)); assertThat(ldapResult).isNotNull(); assertThat(fromDb).isNotNull(); @@ -172,7 +172,7 @@ public class ContextSourceAndHibernateTransactionManagerNamespaceITests extends OrgPerson originalPerson = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1)); originalPerson.setLastname("fooo"); try { - dummyDao.updateWithException(originalPerson); + this.dummyDao.updateWithException(originalPerson); fail("DummyException expected"); } catch (DummyException expected) { @@ -181,7 +181,7 @@ public class ContextSourceAndHibernateTransactionManagerNamespaceITests extends log.debug("Verifying result"); - Object ldapResult = ldapTemplate.lookup(dn, new AttributesMapper() { + Object ldapResult = this.ldapTemplate.lookup(dn, new AttributesMapper() { public Object mapFromAttributes(Attributes attributes) throws NamingException { assertThat(attributes.get("sn").get()).as("Person").isNotNull(); assertThat(attributes.get("description").get()).isEqualTo("Sweden, Company1, Some Person"); @@ -204,10 +204,10 @@ public class ContextSourceAndHibernateTransactionManagerNamespaceITests extends person.setLastname("Updated Person"); person.setDescription("Updated description"); - dummyDao.update(person); + this.dummyDao.update(person); log.debug("Verifying result"); - Object ldapResult = ldapTemplate.lookup(dn, new AttributesMapper() { + Object ldapResult = this.ldapTemplate.lookup(dn, new AttributesMapper() { public Object mapFromAttributes(Attributes attributes) throws NamingException { assertThat(attributes.get("sn").get()).isEqualTo("Updated Person"); assertThat(attributes.get("description").get()).isEqualTo("Updated description"); @@ -231,7 +231,7 @@ public class ContextSourceAndHibernateTransactionManagerNamespaceITests extends try { // Perform test - dummyDao.updateAndRenameWithException(dn, newDn, "Updated description"); + this.dummyDao.updateAndRenameWithException(dn, newDn, "Updated description"); fail("DummyException expected"); } catch (DummyException expected) { @@ -240,7 +240,7 @@ public class ContextSourceAndHibernateTransactionManagerNamespaceITests extends // Verify that entry was not moved. try { - ldapTemplate.lookup(newDn); + this.ldapTemplate.lookup(newDn); fail("NameNotFoundException expected"); } catch (NameNotFoundException expected) { @@ -248,7 +248,7 @@ public class ContextSourceAndHibernateTransactionManagerNamespaceITests extends } // Verify that original entry was not updated. - Object object = ldapTemplate.lookup(dn, new AttributesMapper() { + Object object = this.ldapTemplate.lookup(dn, new AttributesMapper() { public Object mapFromAttributes(Attributes attributes) throws NamingException { assertThat(attributes.get("description").get()).isEqualTo("Sweden, Company1, Some Person2"); return new Object(); @@ -262,10 +262,10 @@ public class ContextSourceAndHibernateTransactionManagerNamespaceITests extends String dn = "cn=Some Person2,ou=company1,ou=Sweden"; String newDn = "cn=Some Person2,ou=company2,ou=Sweden"; // Perform test - dummyDao.updateAndRename(dn, newDn, "Updated description"); + this.dummyDao.updateAndRename(dn, newDn, "Updated description"); // Verify that entry was moved and updated. - Object object = ldapTemplate.lookup(newDn, new AttributesMapper() { + Object object = this.ldapTemplate.lookup(newDn, new AttributesMapper() { public Object mapFromAttributes(Attributes attributes) throws NamingException { assertThat(attributes.get("description").get()).isEqualTo("Updated description"); return new Object(); @@ -280,7 +280,7 @@ public class ContextSourceAndHibernateTransactionManagerNamespaceITests extends String dn = "cn=Some Person,ou=company1,ou=Sweden"; try { // Perform test - dummyDao.modifyAttributesWithException(dn, "Updated lastname", "Updated description"); + this.dummyDao.modifyAttributesWithException(dn, "Updated lastname", "Updated description"); fail("DummyException expected"); } catch (DummyException expected) { @@ -288,7 +288,7 @@ public class ContextSourceAndHibernateTransactionManagerNamespaceITests extends } // Verify result - check that the operation was properly rolled back - Object result = ldapTemplate.lookup(dn, new AttributesMapper() { + Object result = this.ldapTemplate.lookup(dn, new AttributesMapper() { public Object mapFromAttributes(Attributes attributes) throws NamingException { assertThat(attributes.get("sn").get()).isEqualTo("Person"); assertThat(attributes.get("description").get()).isEqualTo("Sweden, Company1, Some Person"); @@ -303,10 +303,10 @@ public class ContextSourceAndHibernateTransactionManagerNamespaceITests extends public void testModifyAttributes() { String dn = "cn=Some Person,ou=company1,ou=Sweden"; // Perform test - dummyDao.modifyAttributes(dn, "Updated lastname", "Updated description"); + this.dummyDao.modifyAttributes(dn, "Updated lastname", "Updated description"); // Verify result - check that the operation was not rolled back - Object result = ldapTemplate.lookup(dn, new AttributesMapper() { + Object result = this.ldapTemplate.lookup(dn, new AttributesMapper() { public Object mapFromAttributes(Attributes attributes) throws NamingException { assertThat(attributes.get("sn").get()).isEqualTo("Updated lastname"); assertThat(attributes.get("description").get()).isEqualTo("Updated description"); @@ -324,7 +324,7 @@ public class ContextSourceAndHibernateTransactionManagerNamespaceITests extends try { // Perform test - dummyDao.unbindWithException(person); + this.dummyDao.unbindWithException(person); fail("DummyException expected"); } catch (DummyException expected) { @@ -333,7 +333,7 @@ public class ContextSourceAndHibernateTransactionManagerNamespaceITests extends person = null; // Verify result - check that the operation was properly rolled back - Object ldapResult = ldapTemplate.lookup(dn, new AttributesMapper() { + Object ldapResult = this.ldapTemplate.lookup(dn, new AttributesMapper() { public Object mapFromAttributes(Attributes attributes) throws NamingException { // Just verify that the entry still exists. return new Object(); @@ -357,11 +357,11 @@ public class ContextSourceAndHibernateTransactionManagerNamespaceITests extends String dn = "cn=Some Person,ou=company1,ou=Sweden"; // Perform test OrgPerson person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1)); - dummyDao.unbind(person); + this.dummyDao.unbind(person); try { // Verify result - check that the operation was not rolled back - ldapTemplate.lookup(dn); + this.ldapTemplate.lookup(dn); fail("NameNotFoundException expected"); } catch (NameNotFoundException expected) { diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/itest/odm/LdapTemplateOdmGroupManipulationITests.java b/test/integration-tests/src/test/java/org/springframework/ldap/itest/odm/LdapTemplateOdmGroupManipulationITests.java index 84088dac..2d308598 100644 --- a/test/integration-tests/src/test/java/org/springframework/ldap/itest/odm/LdapTemplateOdmGroupManipulationITests.java +++ b/test/integration-tests/src/test/java/org/springframework/ldap/itest/odm/LdapTemplateOdmGroupManipulationITests.java @@ -43,7 +43,7 @@ public class LdapTemplateOdmGroupManipulationITests extends AbstractLdapTemplate @Test public void testFindOne() { - Group group = tested.findOne(query().where("cn").is("ROLE_USER"), Group.class); + Group group = this.tested.findOne(query().where("cn").is("ROLE_USER"), Group.class); assertThat(group).isNotNull(); assertThat(group.getName()).isEqualTo("ROLE_USER"); @@ -58,12 +58,12 @@ public class LdapTemplateOdmGroupManipulationITests extends AbstractLdapTemplate @Test public void testRemoveMember() { - Group group = tested.findOne(query().where("cn").is("ROLE_USER"), Group.class); + Group group = this.tested.findOne(query().where("cn").is("ROLE_USER"), Group.class); group.removeMember(LdapUtils.newLdapName("cn=Some Person,ou=company1,ou=Sweden," + base)); - tested.update(group); + this.tested.update(group); - Group verification = tested.findOne(query().where("cn").is("ROLE_USER"), Group.class); + Group verification = this.tested.findOne(query().where("cn").is("ROLE_USER"), Group.class); Set members = verification.getMembers(); assertThat(members).hasSize(3); @@ -72,12 +72,12 @@ public class LdapTemplateOdmGroupManipulationITests extends AbstractLdapTemplate @Test public void testRemoveMemberSyntacticallyEqual() { - Group group = tested.findOne(query().where("cn").is("ROLE_USER"), Group.class); + Group group = this.tested.findOne(query().where("cn").is("ROLE_USER"), Group.class); group.removeMember(LdapUtils.newLdapName("cn=Some Person,OU=company1, ou=Sweden," + base)); - tested.update(group); + this.tested.update(group); - Group verification = tested.findOne(query().where("cn").is("ROLE_USER"), Group.class); + Group verification = this.tested.findOne(query().where("cn").is("ROLE_USER"), Group.class); Set members = verification.getMembers(); assertThat(members).hasSize(3); @@ -86,12 +86,12 @@ public class LdapTemplateOdmGroupManipulationITests extends AbstractLdapTemplate @Test public void testAddMember() { - Group group = tested.findOne(query().where("cn").is("ROLE_USER"), Group.class); + Group group = this.tested.findOne(query().where("cn").is("ROLE_USER"), Group.class); group.addMember(LdapUtils.newLdapName("cn=Some Person,ou=company1,ou=Norway," + base)); - tested.update(group); + this.tested.update(group); - Group verification = tested.findOne(query().where("cn").is("ROLE_USER"), Group.class); + Group verification = this.tested.findOne(query().where("cn").is("ROLE_USER"), Group.class); Set members = verification.getMembers(); assertThat(members).hasSize(5); @@ -100,12 +100,12 @@ public class LdapTemplateOdmGroupManipulationITests extends AbstractLdapTemplate @Test public void testAddMemberDuplicate() { - Group group = tested.findOne(query().where("cn").is("ROLE_USER"), Group.class); + Group group = this.tested.findOne(query().where("cn").is("ROLE_USER"), Group.class); group.addMember(LdapUtils.newLdapName("cn=Some Person,ou=company1,ou=Sweden," + base)); - tested.update(group); + this.tested.update(group); - Group verification = tested.findOne(query().where("cn").is("ROLE_USER"), Group.class); + Group verification = this.tested.findOne(query().where("cn").is("ROLE_USER"), Group.class); Set members = verification.getMembers(); assertThat(members).hasSize(4); @@ -114,12 +114,12 @@ public class LdapTemplateOdmGroupManipulationITests extends AbstractLdapTemplate @Test public void testAddMemberSyntacticallyEqualDuplicate() { - Group group = tested.findOne(query().where("cn").is("ROLE_USER"), Group.class); + Group group = this.tested.findOne(query().where("cn").is("ROLE_USER"), Group.class); group.addMember(LdapUtils.newLdapName("cn=Some Person,OU=company1 ,ou=Sweden," + base)); - tested.update(group); + this.tested.update(group); - Group verification = tested.findOne(query().where("cn").is("ROLE_USER"), Group.class); + Group verification = this.tested.findOne(query().where("cn").is("ROLE_USER"), Group.class); Set members = verification.getMembers(); assertThat(members).hasSize(4); @@ -128,7 +128,7 @@ public class LdapTemplateOdmGroupManipulationITests extends AbstractLdapTemplate @Test public void testSetMembersSyntacticallyEqual() { - Group group = tested.findOne(query().where("cn").is("ROLE_USER"), Group.class); + Group group = this.tested.findOne(query().where("cn").is("ROLE_USER"), Group.class); group.setMembers(new HashSet() { { @@ -136,9 +136,9 @@ public class LdapTemplateOdmGroupManipulationITests extends AbstractLdapTemplate add(LdapUtils.newLdapName("CN=Some Person2, OU=company1,ou=Sweden," + base)); } }); - tested.update(group); + this.tested.update(group); - Group verification = tested.findOne(query().where("cn").is("ROLE_USER"), Group.class); + Group verification = this.tested.findOne(query().where("cn").is("ROLE_USER"), Group.class); Set members = verification.getMembers(); 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 cfa5fd88..ed729b46 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 @@ -43,7 +43,7 @@ public class LdapTemplateOdmWithDnAnnotationsITests extends AbstractLdapTemplate @Test public void testFindOne() { - PersonWithDnAnnotations person = tested.findOne(query().where("cn").is("Some Person3"), + PersonWithDnAnnotations person = this.tested.findOne(query().where("cn").is("Some Person3"), PersonWithDnAnnotations.class); assertThat(person).isNotNull(); @@ -60,7 +60,7 @@ public class LdapTemplateOdmWithDnAnnotationsITests extends AbstractLdapTemplate @Test public void testFindByDn() { - PersonWithDnAnnotations person = tested.findByDn(LdapUtils.newLdapName("cn=Some Person3,ou=company1,ou=Sweden"), + PersonWithDnAnnotations person = this.tested.findByDn(LdapUtils.newLdapName("cn=Some Person3,ou=company1,ou=Sweden"), PersonWithDnAnnotations.class); assertThat(person).isNotNull(); @@ -77,7 +77,7 @@ public class LdapTemplateOdmWithDnAnnotationsITests extends AbstractLdapTemplate @Test public void testFindInCountry() { - List persons = tested.find(query().base("ou=Sweden").where("cn").isPresent(), + List persons = this.tested.find(query().base("ou=Sweden").where("cn").isPresent(), PersonWithDnAnnotations.class); assertThat(persons).hasSize(4); @@ -92,7 +92,7 @@ public class LdapTemplateOdmWithDnAnnotationsITests extends AbstractLdapTemplate @Test public void testFindForStreamInCountry() { - List persons = tested + List persons = this.tested .findForStream(query().base("ou=Sweden").where("cn").isPresent(), PersonWithDnAnnotations.class) .collect(Collectors.toList()); @@ -130,11 +130,11 @@ public class LdapTemplateOdmWithDnAnnotationsITests extends AbstractLdapTemplate person.setCompany("company1"); person.setCountry("Sweden"); - tested.create(person); + this.tested.create(person); - assertThat(tested.findAll(PersonWithDnAnnotations.class)).hasSize(6); + assertThat(this.tested.findAll(PersonWithDnAnnotations.class)).hasSize(6); - person = tested.findByDn(LdapUtils.newLdapName("cn=New Person,ou=company1,ou=Sweden"), + person = this.tested.findByDn(LdapUtils.newLdapName("cn=New Person,ou=company1,ou=Sweden"), PersonWithDnAnnotations.class); assertThat(person.getCommonName()).isEqualTo("New Person"); @@ -150,15 +150,15 @@ public class LdapTemplateOdmWithDnAnnotationsITests extends AbstractLdapTemplate @Test public void testUpdate() { - PersonWithDnAnnotations person = tested.findOne(query().where("cn").is("Some Person3"), + PersonWithDnAnnotations person = this.tested.findOne(query().where("cn").is("Some Person3"), PersonWithDnAnnotations.class); person.setDesc(Arrays.asList("New Description")); String entryUuid = person.getEntryUuid(); assertThat(entryUuid).describedAs("The operational attribute 'entryUUID' was not set").isNotEmpty(); - tested.update(person); + this.tested.update(person); - person = tested.findByDn(LdapUtils.newLdapName("cn=Some Person3, ou=company1, ou=Sweden"), + person = this.tested.findByDn(LdapUtils.newLdapName("cn=Some Person3, ou=company1, ou=Sweden"), PersonWithDnAnnotations.class); assertThat(person.getCommonName()).isEqualTo("Some Person3"); @@ -170,16 +170,16 @@ public class LdapTemplateOdmWithDnAnnotationsITests extends AbstractLdapTemplate @Test public void testUpdateWithChangedDn() { - PersonWithDnAnnotations person = tested.findOne(query().where("cn").is("Some Person3"), + PersonWithDnAnnotations person = this.tested.findOne(query().where("cn").is("Some Person3"), PersonWithDnAnnotations.class); // This should make the entry move person.setCountry("Norway"); String entryUuid = person.getEntryUuid(); assertThat(entryUuid).describedAs("The operational attribute 'entryUUID' was not set").isNotEmpty(); - tested.update(person); + this.tested.update(person); - person = tested.findByDn(LdapUtils.newLdapName("cn=Some Person3, ou=company1, ou=Norway"), + person = this.tested.findByDn(LdapUtils.newLdapName("cn=Some Person3, ou=company1, ou=Norway"), PersonWithDnAnnotations.class); assertThat(person.getCommonName()).isEqualTo("Some Person3"); 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 9ac45009..56a5fd31 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 @@ -46,7 +46,7 @@ public class LdapTemplateOdmWithNoDnAnnotationsITests extends AbstractLdapTempla @Test public void testFindOne() { - Person person = tested.findOne(query().where("cn").is("Some Person3"), Person.class); + Person person = this.tested.findOne(query().where("cn").is("Some Person3"), Person.class); assertThat(person).isNotNull(); assertThat(person.getCommonName()).isEqualTo("Some Person3"); @@ -58,7 +58,7 @@ public class LdapTemplateOdmWithNoDnAnnotationsITests extends AbstractLdapTempla @Test public void testFindByDn() { - Person person = tested.findByDn(LdapUtils.newLdapName("cn=Some Person3,ou=company1,ou=Sweden"), Person.class); + Person person = this.tested.findByDn(LdapUtils.newLdapName("cn=Some Person3,ou=company1,ou=Sweden"), Person.class); assertThat(person).isNotNull(); assertThat(person.getCommonName()).isEqualTo("Some Person3"); @@ -70,17 +70,17 @@ public class LdapTemplateOdmWithNoDnAnnotationsITests extends AbstractLdapTempla @Test(expected = OdmException.class) public void testFindByDnThrowsExceptionOnInvalidEntry() { - tested.findByDn(LdapUtils.newLdapName("ou=company1,ou=Sweden"), Person.class); + this.tested.findByDn(LdapUtils.newLdapName("ou=company1,ou=Sweden"), Person.class); } @Test(expected = EmptyResultDataAccessException.class) public void testFindOneThrowsEmptyResultIfNotFound() { - tested.findOne(query().where("cn").is("This cn does not exist"), Person.class); + this.tested.findOne(query().where("cn").is("This cn does not exist"), Person.class); } @Test public void testFind() { - List persons = tested.find(query().where("cn").is("Some Person3"), Person.class); + List persons = this.tested.find(query().where("cn").is("Some Person3"), Person.class); assertThat(persons).hasSize(1); Person person = persons.get(0); @@ -95,7 +95,7 @@ public class LdapTemplateOdmWithNoDnAnnotationsITests extends AbstractLdapTempla @Test public void testFindForStream() { - List persons = tested.findForStream(query().where("cn").is("Some Person3"), Person.class) + List persons = this.tested.findForStream(query().where("cn").is("Some Person3"), Person.class) .collect(Collectors.toList()); assertThat(persons).hasSize(1); @@ -111,7 +111,7 @@ public class LdapTemplateOdmWithNoDnAnnotationsITests extends AbstractLdapTempla @Test public void testFindInCountry() { - List persons = tested.find(query().base("ou=Sweden").where("cn").isPresent(), Person.class); + List persons = this.tested.find(query().base("ou=Sweden").where("cn").isPresent(), Person.class); assertThat(persons).hasSize(4); Person person = persons.get(0); @@ -121,7 +121,7 @@ public class LdapTemplateOdmWithNoDnAnnotationsITests extends AbstractLdapTempla @Test public void testFindForStreamInCountry() { - List persons = tested.findForStream(query().base("ou=Sweden").where("cn").isPresent(), Person.class) + List persons = this.tested.findForStream(query().base("ou=Sweden").where("cn").isPresent(), Person.class) .collect(Collectors.toList()); assertThat(persons).hasSize(4); @@ -132,7 +132,7 @@ public class LdapTemplateOdmWithNoDnAnnotationsITests extends AbstractLdapTempla @Test public void testFindAll() { - List result = tested.findAll(Person.class); + List result = this.tested.findAll(Person.class); assertThat(result).hasSize(5); } @@ -145,11 +145,11 @@ public class LdapTemplateOdmWithNoDnAnnotationsITests extends AbstractLdapTempla person.setDesc(Arrays.asList("This is the description")); person.setTelephoneNumber("0123456"); - tested.create(person); + this.tested.create(person); - assertThat(tested.findAll(Person.class)).hasSize(6); + assertThat(this.tested.findAll(Person.class)).hasSize(6); - person = tested.findOne(query().where("cn").is("New Person"), Person.class); + person = this.tested.findOne(query().where("cn").is("New Person"), Person.class); assertThat(person.getCommonName()).isEqualTo("New Person"); assertThat(person.getSurname()).isEqualTo("Person"); @@ -160,14 +160,14 @@ public class LdapTemplateOdmWithNoDnAnnotationsITests extends AbstractLdapTempla @Test public void testUpdate() { - Person person = tested.findOne(query().where("cn").is("Some Person3"), Person.class); + Person person = this.tested.findOne(query().where("cn").is("Some Person3"), Person.class); person.setDesc(Arrays.asList("New Description")); String entryUuid = person.getEntryUuid(); assertThat(entryUuid).describedAs("The operational attribute 'entryUUID' was not set").isNotEmpty(); - tested.update(person); + this.tested.update(person); - person = tested.findOne(query().where("cn").is("Some Person3"), Person.class); + person = this.tested.findOne(query().where("cn").is("Some Person3"), Person.class); assertThat(person.getCommonName()).isEqualTo("Some Person3"); assertThat(person.getSurname()).isEqualTo("Person3"); @@ -178,12 +178,12 @@ public class LdapTemplateOdmWithNoDnAnnotationsITests extends AbstractLdapTempla @Test public void testDelete() { - Person person = tested.findOne(query().where("cn").is("Some Person3"), Person.class); + Person person = this.tested.findOne(query().where("cn").is("Some Person3"), Person.class); - tested.delete(person); + this.tested.delete(person); try { - tested.findOne(query().where("cn").is("Some Person3"), Person.class); + this.tested.findOne(query().where("cn").is("Some Person3"), Person.class); fail("EmptyResultDataAccessException e"); } catch (EmptyResultDataAccessException e) { @@ -196,13 +196,13 @@ public class LdapTemplateOdmWithNoDnAnnotationsITests extends AbstractLdapTempla */ @Test public void testLdap271() { - Person person = tested.findOne(query().where("cn").is("Some Person3"), Person.class); + Person person = this.tested.findOne(query().where("cn").is("Some Person3"), Person.class); // Perform test person.setTelephoneNumber(null); - tested.update(person); + this.tested.update(person); - person = tested.findOne(query().where("cn").is("Some Person3"), Person.class); + person = this.tested.findOne(query().where("cn").is("Some Person3"), Person.class); assertThat(person.getTelephoneNumber()).as("TelephoneNumber should be null").isNull(); }