From 7fd89aa794ebe542c8fd4b5ef98bae7aed7d70be Mon Sep 17 00:00:00 2001 From: Josh Cummings Date: Thu, 13 Jul 2023 09:54:15 -0600 Subject: [PATCH] Remove Deprecation Warnings - Address usage of new Integer - Address missing deprecation markers Closes gh-793 --- .../ldap/core/DistinguishedName.java | 1 + .../ldap/core/LdapEntryIdentification.java | 3 +++ .../ldap/core/LdapOperations.java | 8 ++++++ .../springframework/ldap/core/LdapRdn.java | 1 + .../ldap/core/LdapRdnComponent.java | 3 +++ .../ldap/core/support/BaseLdapPathSource.java | 1 + ...SourceAndDataSourceTransactionManager.java | 1 + ...tSourceAndHibernateTransactionManager.java | 1 + .../ldap/odm/core/OdmManager.java | 1 + .../ldap/odm/core/impl/OdmManagerImpl.java | 1 + .../core/impl/OdmManagerImplFactoryBean.java | 1 + .../ldap/odm/test/ConverterManagerTests.java | 4 +-- ...ateTransactionManagerIntegrationTests.java | 26 +++++++++---------- ...sactionManagerLdap179IntegrationTests.java | 2 +- ...nateTransactionManagerNamespaceITests.java | 26 +++++++++---------- 15 files changed, 51 insertions(+), 29 deletions(-) diff --git a/core/src/main/java/org/springframework/ldap/core/DistinguishedName.java b/core/src/main/java/org/springframework/ldap/core/DistinguishedName.java index ee9f9456..0d46887e 100644 --- a/core/src/main/java/org/springframework/ldap/core/DistinguishedName.java +++ b/core/src/main/java/org/springframework/ldap/core/DistinguishedName.java @@ -97,6 +97,7 @@ import org.springframework.util.StringUtils; * @deprecated As of 2.0 it is recommended to use {@link javax.naming.ldap.LdapName} along * with utility methods in {@link LdapUtils} instead. */ +@Deprecated public class DistinguishedName implements Name { /** diff --git a/core/src/main/java/org/springframework/ldap/core/LdapEntryIdentification.java b/core/src/main/java/org/springframework/ldap/core/LdapEntryIdentification.java index f013667d..74af11f0 100644 --- a/core/src/main/java/org/springframework/ldap/core/LdapEntryIdentification.java +++ b/core/src/main/java/org/springframework/ldap/core/LdapEntryIdentification.java @@ -54,6 +54,7 @@ public class LdapEntryIdentification { * {@link #LdapEntryIdentification(javax.naming.ldap.LdapName, javax.naming.ldap.LdapName)} * instead. */ + @Deprecated public LdapEntryIdentification(DistinguishedName absoluteDn, DistinguishedName relativeDn) { Assert.notNull(absoluteDn, "Absolute DN must not be null"); Assert.notNull(relativeDn, "Relative DN must not be null"); @@ -103,6 +104,7 @@ public class LdapEntryIdentification { * @deprecated {@link DistinguishedName} and associated classes and methods are * deprecated as of 2.0. use {@link #getRelativeName()} instead. */ + @Deprecated public DistinguishedName getRelativeDn() { return new DistinguishedName(this.relativeDn); } @@ -114,6 +116,7 @@ public class LdapEntryIdentification { * @deprecated {@link DistinguishedName} and associated classes and methods are * deprecated as of 2.0. use {@link #getAbsoluteName()} instead. */ + @Deprecated public DistinguishedName getAbsoluteDn() { return new DistinguishedName(this.absoluteDn); } diff --git a/core/src/main/java/org/springframework/ldap/core/LdapOperations.java b/core/src/main/java/org/springframework/ldap/core/LdapOperations.java index b95fa53f..b03fb747 100644 --- a/core/src/main/java/org/springframework/ldap/core/LdapOperations.java +++ b/core/src/main/java/org/springframework/ldap/core/LdapOperations.java @@ -1178,6 +1178,7 @@ public interface LdapOperations { * {@link #authenticate(org.springframework.ldap.query.LdapQuery, String)} or * {@link #authenticate(org.springframework.ldap.query.LdapQuery, String, AuthenticatedLdapEntryContextMapper)} */ + @Deprecated boolean authenticate(Name base, String filter, String password); /** @@ -1203,6 +1204,7 @@ public interface LdapOperations { * {@link #authenticate(org.springframework.ldap.query.LdapQuery, String)} or * {@link #authenticate(org.springframework.ldap.query.LdapQuery, String, AuthenticatedLdapEntryContextMapper)} */ + @Deprecated boolean authenticate(String base, String filter, String password); /** @@ -1226,6 +1228,7 @@ public interface LdapOperations { * {@link #authenticate(org.springframework.ldap.query.LdapQuery, String, AuthenticatedLdapEntryContextMapper)} * @see #authenticate(Name, String, String) */ + @Deprecated boolean authenticate(Name base, String filter, String password, AuthenticatedLdapEntryContextCallback callback); /** @@ -1249,6 +1252,7 @@ public interface LdapOperations { * {@link #authenticate(org.springframework.ldap.query.LdapQuery, String, AuthenticatedLdapEntryContextMapper)} * @see #authenticate(String, String, String) */ + @Deprecated boolean authenticate(String base, String filter, String password, AuthenticatedLdapEntryContextCallback callback); /** @@ -1276,6 +1280,7 @@ public interface LdapOperations { * {@link #authenticate(org.springframework.ldap.query.LdapQuery, String, AuthenticatedLdapEntryContextMapper)} * @see #authenticate(Name, String, String, AuthenticatedLdapEntryContextCallback) */ + @Deprecated boolean authenticate(Name base, String filter, String password, AuthenticatedLdapEntryContextCallback callback, AuthenticationErrorCallback errorCallback); @@ -1304,6 +1309,7 @@ public interface LdapOperations { * {@link #authenticate(org.springframework.ldap.query.LdapQuery, String, AuthenticatedLdapEntryContextMapper)} * @see #authenticate(String, String, String, AuthenticatedLdapEntryContextCallback) */ + @Deprecated boolean authenticate(String base, String filter, String password, AuthenticatedLdapEntryContextCallback callback, AuthenticationErrorCallback errorCallback); @@ -1328,6 +1334,7 @@ public interface LdapOperations { * @see #authenticate(Name, String, String, AuthenticatedLdapEntryContextCallback, * AuthenticationErrorCallback) */ + @Deprecated boolean authenticate(Name base, String filter, String password, AuthenticationErrorCallback errorCallback); /** @@ -1350,6 +1357,7 @@ public interface LdapOperations { * {@link #authenticate(org.springframework.ldap.query.LdapQuery, String)} or * {@link #authenticate(org.springframework.ldap.query.LdapQuery, String, AuthenticatedLdapEntryContextMapper)} */ + @Deprecated boolean authenticate(String base, String filter, String password, AuthenticationErrorCallback errorCallback); /** diff --git a/core/src/main/java/org/springframework/ldap/core/LdapRdn.java b/core/src/main/java/org/springframework/ldap/core/LdapRdn.java index 58de52c0..1256b98b 100644 --- a/core/src/main/java/org/springframework/ldap/core/LdapRdn.java +++ b/core/src/main/java/org/springframework/ldap/core/LdapRdn.java @@ -38,6 +38,7 @@ import org.springframework.util.ObjectUtils; * @author Mattias Hellborg Arthursson * @deprecated {@link DistinguishedName} and associated classes are deprecated as of 2.0. */ +@Deprecated public class LdapRdn implements Serializable, Comparable { private static final long serialVersionUID = 5681397547245228750L; diff --git a/core/src/main/java/org/springframework/ldap/core/LdapRdnComponent.java b/core/src/main/java/org/springframework/ldap/core/LdapRdnComponent.java index cfc9a450..3d2f65f2 100644 --- a/core/src/main/java/org/springframework/ldap/core/LdapRdnComponent.java +++ b/core/src/main/java/org/springframework/ldap/core/LdapRdnComponent.java @@ -35,6 +35,7 @@ import org.springframework.util.StringUtils; * @author Mattias Hellborg Arthursson * @deprecated {@link DistinguishedName} and associated classes are deprecated as of 2.0. */ +@Deprecated public class LdapRdnComponent implements Comparable, Serializable { private static final long serialVersionUID = -3296747972616243038L; @@ -111,6 +112,7 @@ public class LdapRdnComponent implements Comparable, Serializable { * @deprecated Using this method changes the internal state of surrounding * DistinguishedName instance. This should be avoided. */ + @Deprecated public void setKey(String key) { Assert.hasText(key, "Key must not be empty"); this.key = key; @@ -130,6 +132,7 @@ public class LdapRdnComponent implements Comparable, Serializable { * @deprecated Using this method changes the internal state of surrounding * DistinguishedName instance. This should be avoided. */ + @Deprecated public void setValue(String value) { Assert.hasText(value, "Value must not be empty"); this.value = value; diff --git a/core/src/main/java/org/springframework/ldap/core/support/BaseLdapPathSource.java b/core/src/main/java/org/springframework/ldap/core/support/BaseLdapPathSource.java index a1a5f059..9742eedd 100644 --- a/core/src/main/java/org/springframework/ldap/core/support/BaseLdapPathSource.java +++ b/core/src/main/java/org/springframework/ldap/core/support/BaseLdapPathSource.java @@ -38,6 +38,7 @@ public interface BaseLdapPathSource { * @deprecated {@link DistinguishedName} and associated classes and methods are * deprecated as of 2.0. Use {@link #getBaseLdapName()} instead. */ + @Deprecated DistinguishedName getBaseLdapPath(); /** diff --git a/core/src/main/java/org/springframework/ldap/transaction/compensating/manager/ContextSourceAndDataSourceTransactionManager.java b/core/src/main/java/org/springframework/ldap/transaction/compensating/manager/ContextSourceAndDataSourceTransactionManager.java index d80a6e72..188eef98 100644 --- a/core/src/main/java/org/springframework/ldap/transaction/compensating/manager/ContextSourceAndDataSourceTransactionManager.java +++ b/core/src/main/java/org/springframework/ldap/transaction/compensating/manager/ContextSourceAndDataSourceTransactionManager.java @@ -38,6 +38,7 @@ import org.springframework.transaction.support.DefaultTransactionStatus; * probably not such a good idea after all. AbstractPlatformTransactionManager is not * designed for this usage. */ +@Deprecated public class ContextSourceAndDataSourceTransactionManager extends DataSourceTransactionManager { private static final long serialVersionUID = 6832868697460384648L; diff --git a/core/src/main/java/org/springframework/ldap/transaction/compensating/manager/ContextSourceAndHibernateTransactionManager.java b/core/src/main/java/org/springframework/ldap/transaction/compensating/manager/ContextSourceAndHibernateTransactionManager.java index db0cc4b4..9ddaa71f 100755 --- a/core/src/main/java/org/springframework/ldap/transaction/compensating/manager/ContextSourceAndHibernateTransactionManager.java +++ b/core/src/main/java/org/springframework/ldap/transaction/compensating/manager/ContextSourceAndHibernateTransactionManager.java @@ -41,6 +41,7 @@ import org.springframework.transaction.support.DefaultTransactionStatus; * probably not such a good idea after all. AbstractPlatformTransactionManager is not * designed for this usage. */ +@Deprecated public class ContextSourceAndHibernateTransactionManager extends HibernateTransactionManager { /** diff --git a/odm/src/main/java/org/springframework/ldap/odm/core/OdmManager.java b/odm/src/main/java/org/springframework/ldap/odm/core/OdmManager.java index dc0ee76e..5db3335a 100755 --- a/odm/src/main/java/org/springframework/ldap/odm/core/OdmManager.java +++ b/odm/src/main/java/org/springframework/ldap/odm/core/OdmManager.java @@ -39,6 +39,7 @@ import org.springframework.ldap.query.LdapQuery; * @deprecated This functionality is automatically available in LdapTemplate as of version * 2.0 */ +@Deprecated public interface OdmManager { /** diff --git a/odm/src/main/java/org/springframework/ldap/odm/core/impl/OdmManagerImpl.java b/odm/src/main/java/org/springframework/ldap/odm/core/impl/OdmManagerImpl.java index 5d1831a2..c71c66d1 100755 --- a/odm/src/main/java/org/springframework/ldap/odm/core/impl/OdmManagerImpl.java +++ b/odm/src/main/java/org/springframework/ldap/odm/core/impl/OdmManagerImpl.java @@ -42,6 +42,7 @@ import org.springframework.util.StringUtils; * @deprecated This functionality is automatically available in LdapTemplate as of version * 2.0 */ +@Deprecated public final class OdmManagerImpl implements OdmManager { // The link to the LDAP directory diff --git a/odm/src/main/java/org/springframework/ldap/odm/core/impl/OdmManagerImplFactoryBean.java b/odm/src/main/java/org/springframework/ldap/odm/core/impl/OdmManagerImplFactoryBean.java index 94236e7b..6c7d367f 100755 --- a/odm/src/main/java/org/springframework/ldap/odm/core/impl/OdmManagerImplFactoryBean.java +++ b/odm/src/main/java/org/springframework/ldap/odm/core/impl/OdmManagerImplFactoryBean.java @@ -45,6 +45,7 @@ import org.springframework.ldap.odm.typeconversion.ConverterManager; * @deprecated This functionality is automatically available in LdapTemplate as of version * 2.0 */ +@Deprecated public final class OdmManagerImplFactoryBean implements FactoryBean { private LdapOperations ldapOperations = null; diff --git a/odm/src/test/java/org/springframework/ldap/odm/test/ConverterManagerTests.java b/odm/src/test/java/org/springframework/ldap/odm/test/ConverterManagerTests.java index 35356a37..1c1b8a8e 100755 --- a/odm/src/test/java/org/springframework/ldap/odm/test/ConverterManagerTests.java +++ b/odm/src/test/java/org/springframework/ldap/odm/test/ConverterManagerTests.java @@ -188,7 +188,7 @@ public final class ConverterManagerTests { Integer intSource = null; if (source.getClass() == String.class) { - intSource = new Integer((String) source); + intSource = Integer.valueOf((String) source); } else { if (source.getClass() == Integer.class) { @@ -213,7 +213,7 @@ public final class ConverterManagerTests { Integer intSource = null; if (source.getClass() == String.class) { - intSource = new Integer((String) source); + intSource = Integer.valueOf((String) source); } else { if (source.getClass() == Integer.class) { 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 2301c9b6..b6ef21aa 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 @@ -79,7 +79,7 @@ public class ContextSourceAndHibernateTransactionManagerIntegrationTests extends } OrgPerson person = new OrgPerson(); - person.setId(new Integer(1)); + person.setId(1); person.setLastname("Person"); person.setFullname("Some Person"); person.setDescription("Sweden, Company1, Some Person"); @@ -112,7 +112,7 @@ public class ContextSourceAndHibernateTransactionManagerIntegrationTests extends public void testCreateWithException() { OrgPerson person = new OrgPerson(); - person.setId(new Integer(2)); + person.setId(2); person.setDescription("some description"); person.setFullname("Some testperson"); person.setLastname("testperson"); @@ -148,7 +148,7 @@ public class ContextSourceAndHibernateTransactionManagerIntegrationTests extends public void testCreate() { OrgPerson person = new OrgPerson(); - person.setId(new Integer(2)); + person.setId(2); person.setDescription("some description"); person.setFullname("Some testperson"); person.setLastname("testperson"); @@ -161,7 +161,7 @@ public class ContextSourceAndHibernateTransactionManagerIntegrationTests extends person = null; log.debug("Verifying result"); Object ldapResult = this.ldapTemplate.lookup("cn=some testperson, ou=company1, ou=Sweden"); - OrgPerson fromDb = (OrgPerson) this.hibernateTemplate.get(OrgPerson.class, new Integer(2)); + OrgPerson fromDb = (OrgPerson) this.hibernateTemplate.get(OrgPerson.class, 2); assertThat(ldapResult).isNotNull(); assertThat(fromDb).isNotNull(); } @@ -169,7 +169,7 @@ public class ContextSourceAndHibernateTransactionManagerIntegrationTests extends @Test public void testUpdateWithException() { String dn = "cn=Some Person,ou=company1,ou=Sweden"; - OrgPerson originalPerson = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1)); + OrgPerson originalPerson = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, 1); originalPerson.setLastname("fooo"); try { this.dummyDao.updateWithException(originalPerson); @@ -189,7 +189,7 @@ public class ContextSourceAndHibernateTransactionManagerIntegrationTests extends } }); - OrgPerson notUpdatedPerson = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1)); + OrgPerson notUpdatedPerson = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, 1); assertThat(notUpdatedPerson.getLastname()).isEqualTo("Person"); assertThat(notUpdatedPerson.getDescription()).isEqualTo("Sweden, Company1, Some Person"); @@ -200,7 +200,7 @@ public class ContextSourceAndHibernateTransactionManagerIntegrationTests extends @Test public void testUpdate() { String dn = "cn=Some Person,ou=company1,ou=Sweden"; - OrgPerson person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1)); + OrgPerson person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, 1); person.setLastname("Updated Person"); person.setDescription("Updated description"); @@ -215,7 +215,7 @@ public class ContextSourceAndHibernateTransactionManagerIntegrationTests extends } }); - OrgPerson updatedPerson = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1)); + OrgPerson updatedPerson = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, 1); assertThat(updatedPerson.getLastname()).isEqualTo("Updated Person"); assertThat(updatedPerson.getDescription()).isEqualTo("Updated description"); assertThat(ldapResult).isNotNull(); @@ -225,7 +225,7 @@ public class ContextSourceAndHibernateTransactionManagerIntegrationTests extends public void testUpdateAndRenameWithException() { String dn = "cn=Some Person2,ou=company1,ou=Sweden"; String newDn = "cn=Some Person2,ou=company2,ou=Sweden"; - OrgPerson person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1)); + OrgPerson person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, 1); person.setLastname("Updated Person"); person.setDescription("Updated description"); @@ -320,7 +320,7 @@ public class ContextSourceAndHibernateTransactionManagerIntegrationTests extends @Test public void testUnbindWithException() { String dn = "cn=Some Person,ou=company1,ou=Sweden"; - OrgPerson person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1)); + OrgPerson person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, 1); try { // Perform test @@ -340,7 +340,7 @@ public class ContextSourceAndHibernateTransactionManagerIntegrationTests extends } }); - person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1)); // will + person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, 1); // will // throw // exception // of @@ -356,7 +356,7 @@ public class ContextSourceAndHibernateTransactionManagerIntegrationTests extends public void testUnbind() { String dn = "cn=Some Person,ou=company1,ou=Sweden"; // Perform test - OrgPerson person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1)); + OrgPerson person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, 1); this.dummyDao.unbind(person); try { @@ -368,7 +368,7 @@ public class ContextSourceAndHibernateTransactionManagerIntegrationTests extends assertThat(true).isTrue(); } - person = (OrgPerson) this.hibernateTemplate.get(OrgPerson.class, new Integer(1)); + person = (OrgPerson) this.hibernateTemplate.get(OrgPerson.class, 1); assertThat(person).isNull(); } diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/itest/manager/hibernate/ContextSourceAndHibernateTransactionManagerLdap179IntegrationTests.java b/test/integration-tests/src/test/java/org/springframework/ldap/itest/manager/hibernate/ContextSourceAndHibernateTransactionManagerLdap179IntegrationTests.java index 57fb3218..87ffa84b 100644 --- a/test/integration-tests/src/test/java/org/springframework/ldap/itest/manager/hibernate/ContextSourceAndHibernateTransactionManagerLdap179IntegrationTests.java +++ b/test/integration-tests/src/test/java/org/springframework/ldap/itest/manager/hibernate/ContextSourceAndHibernateTransactionManagerLdap179IntegrationTests.java @@ -61,7 +61,7 @@ public class ContextSourceAndHibernateTransactionManagerLdap179IntegrationTests public void testCreate() { OrgPerson person = new OrgPerson(); - person.setId(new Integer(2)); + person.setId(2); person.setDescription("some description"); person.setFullname("Some testperson"); person.setLastname("testperson"); 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 72df87ac..1e841ddc 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 @@ -80,7 +80,7 @@ public class ContextSourceAndHibernateTransactionManagerNamespaceITests extends } OrgPerson person = new OrgPerson(); - person.setId(new Integer(1)); + person.setId(1); person.setLastname("Person"); person.setFullname("Some Person"); person.setDescription("Sweden, Company1, Some Person"); @@ -113,7 +113,7 @@ public class ContextSourceAndHibernateTransactionManagerNamespaceITests extends public void testCreateWithException() { OrgPerson person = new OrgPerson(); - person.setId(new Integer(2)); + person.setId(2); person.setDescription("some description"); person.setFullname("Some testperson"); person.setLastname("testperson"); @@ -149,7 +149,7 @@ public class ContextSourceAndHibernateTransactionManagerNamespaceITests extends public void testCreate() { OrgPerson person = new OrgPerson(); - person.setId(new Integer(2)); + person.setId(2); person.setDescription("some description"); person.setFullname("Some testperson"); person.setLastname("testperson"); @@ -162,7 +162,7 @@ public class ContextSourceAndHibernateTransactionManagerNamespaceITests extends person = null; log.debug("Verifying result"); Object ldapResult = this.ldapTemplate.lookup("cn=some testperson, ou=company1, ou=Sweden"); - OrgPerson fromDb = (OrgPerson) this.hibernateTemplate.get(OrgPerson.class, new Integer(2)); + OrgPerson fromDb = (OrgPerson) this.hibernateTemplate.get(OrgPerson.class, 2); assertThat(ldapResult).isNotNull(); assertThat(fromDb).isNotNull(); } @@ -170,7 +170,7 @@ public class ContextSourceAndHibernateTransactionManagerNamespaceITests extends @Test public void testUpdateWithException() { String dn = "cn=Some Person,ou=company1,ou=Sweden"; - OrgPerson originalPerson = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1)); + OrgPerson originalPerson = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, 1); originalPerson.setLastname("fooo"); try { this.dummyDao.updateWithException(originalPerson); @@ -190,7 +190,7 @@ public class ContextSourceAndHibernateTransactionManagerNamespaceITests extends } }); - OrgPerson notUpdatedPerson = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1)); + OrgPerson notUpdatedPerson = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, 1); assertThat(notUpdatedPerson.getLastname()).isEqualTo("Person"); assertThat(notUpdatedPerson.getDescription()).isEqualTo("Sweden, Company1, Some Person"); @@ -201,7 +201,7 @@ public class ContextSourceAndHibernateTransactionManagerNamespaceITests extends @Test public void testUpdate() { String dn = "cn=Some Person,ou=company1,ou=Sweden"; - OrgPerson person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1)); + OrgPerson person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, 1); person.setLastname("Updated Person"); person.setDescription("Updated description"); @@ -216,7 +216,7 @@ public class ContextSourceAndHibernateTransactionManagerNamespaceITests extends } }); - OrgPerson updatedPerson = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1)); + OrgPerson updatedPerson = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, 1); assertThat(updatedPerson.getLastname()).isEqualTo("Updated Person"); assertThat(updatedPerson.getDescription()).isEqualTo("Updated description"); assertThat(ldapResult).isNotNull(); @@ -226,7 +226,7 @@ public class ContextSourceAndHibernateTransactionManagerNamespaceITests extends public void testUpdateAndRenameWithException() { String dn = "cn=Some Person2,ou=company1,ou=Sweden"; String newDn = "cn=Some Person2,ou=company2,ou=Sweden"; - OrgPerson person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1)); + OrgPerson person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, 1); person.setLastname("Updated Person"); person.setDescription("Updated description"); @@ -321,7 +321,7 @@ public class ContextSourceAndHibernateTransactionManagerNamespaceITests extends @Test public void testUnbindWithException() { String dn = "cn=Some Person,ou=company1,ou=Sweden"; - OrgPerson person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1)); + OrgPerson person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, 1); try { // Perform test @@ -341,7 +341,7 @@ public class ContextSourceAndHibernateTransactionManagerNamespaceITests extends } }); - person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1)); // will + person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, 1); // will // throw // exception // of @@ -357,7 +357,7 @@ public class ContextSourceAndHibernateTransactionManagerNamespaceITests extends public void testUnbind() { String dn = "cn=Some Person,ou=company1,ou=Sweden"; // Perform test - OrgPerson person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1)); + OrgPerson person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, 1); this.dummyDao.unbind(person); try { @@ -369,7 +369,7 @@ public class ContextSourceAndHibernateTransactionManagerNamespaceITests extends assertThat(true).isTrue(); } - person = (OrgPerson) this.hibernateTemplate.get(OrgPerson.class, new Integer(1)); + person = (OrgPerson) this.hibernateTemplate.get(OrgPerson.class, 1); assertThat(person).isNull(); }