diff --git a/src/main/java/org/springframework/data/jpa/repository/Query.java b/src/main/java/org/springframework/data/jpa/repository/Query.java index 6a8a4bfe7..276466d33 100644 --- a/src/main/java/org/springframework/data/jpa/repository/Query.java +++ b/src/main/java/org/springframework/data/jpa/repository/Query.java @@ -23,7 +23,7 @@ import java.lang.annotation.Target; /** - * Annotation to declare finder queries directly on DAO methods. + * Annotation to declare finder queries directly on repository methods. * * @author Oliver Gierke */ diff --git a/src/main/java/org/springframework/data/jpa/repository/config/JpaRepositoryConfigDefinitionParser.java b/src/main/java/org/springframework/data/jpa/repository/config/JpaRepositoryConfigDefinitionParser.java index 77da48eef..e20092a7d 100644 --- a/src/main/java/org/springframework/data/jpa/repository/config/JpaRepositoryConfigDefinitionParser.java +++ b/src/main/java/org/springframework/data/jpa/repository/config/JpaRepositoryConfigDefinitionParser.java @@ -28,7 +28,7 @@ import org.w3c.dom.Element; /** - * Parser to create bean definitions for dao-config namespace. Registers bean + * Parser to create bean definitions for repositories namespace. Registers bean * definitions for repositories as well as * {@code PersistenceAnnotationBeanPostProcessor} and * {@code PersistenceExceptionTranslationPostProcessor} to transparently inject @@ -53,8 +53,9 @@ class JpaRepositoryConfigDefinitionParser /* * (non-Javadoc) * - * @see org.springframework.data.jpa.repository.config. - * AbstractRepositoryConfigDefinitionParser#getDaoConfigContext() + * @see org.springframework.data.repository.config. + * AbstractRepositoryConfigDefinitionParser + * #getGlobalRepositoryConfigInformation(org.w3c.dom.Element) */ @Override protected SimpleJpaRepositoryConfiguration getGlobalRepositoryConfigInformation( diff --git a/src/main/java/org/springframework/data/jpa/repository/config/JpaRepositoryNameSpaceHandler.java b/src/main/java/org/springframework/data/jpa/repository/config/JpaRepositoryNameSpaceHandler.java index 1bd468f8f..59b0f1ad3 100644 --- a/src/main/java/org/springframework/data/jpa/repository/config/JpaRepositoryNameSpaceHandler.java +++ b/src/main/java/org/springframework/data/jpa/repository/config/JpaRepositoryNameSpaceHandler.java @@ -20,7 +20,7 @@ import org.springframework.beans.factory.xml.NamespaceHandlerSupport; /** - * Simple namespace handler for {@literal dao-config} namespace. + * Simple namespace handler for {@literal repositories} namespace. * * @author Oliver Gierke */ diff --git a/src/main/java/org/springframework/data/jpa/repository/config/SimpleJpaRepositoryConfiguration.java b/src/main/java/org/springframework/data/jpa/repository/config/SimpleJpaRepositoryConfiguration.java index f022ca655..dec8c0c61 100644 --- a/src/main/java/org/springframework/data/jpa/repository/config/SimpleJpaRepositoryConfiguration.java +++ b/src/main/java/org/springframework/data/jpa/repository/config/SimpleJpaRepositoryConfiguration.java @@ -98,7 +98,7 @@ public class SimpleJpaRepositoryConfiguration /** * Returns the {@link javax.persistence.EntityManagerFactory} reference - * to be used for all the DAO instances configured. + * to be used for all the repository instances configured. * * @return */ diff --git a/src/test/java/org/springframework/data/jpa/domain/support/AuditingEntityListenerTests.java b/src/test/java/org/springframework/data/jpa/domain/support/AuditingEntityListenerTests.java index c78b359d0..8043695a4 100644 --- a/src/test/java/org/springframework/data/jpa/domain/support/AuditingEntityListenerTests.java +++ b/src/test/java/org/springframework/data/jpa/domain/support/AuditingEntityListenerTests.java @@ -43,7 +43,7 @@ import org.springframework.transaction.annotation.Transactional; public class AuditingEntityListenerTests { @Autowired - AuditableUserRepository dao; + AuditableUserRepository repository; @Autowired AuditorAwareStub auditorAware; @@ -57,7 +57,7 @@ public class AuditingEntityListenerTests { user = new AuditableUser(); auditorAware.setAuditor(user); - dao.save(user); + repository.save(user); } @@ -76,7 +76,7 @@ public class AuditingEntityListenerTests { role.setName("ADMIN"); user.addRole(role); - dao.save(user); + repository.save(user); role = user.getRoles().iterator().next(); assertDatesSet(user); diff --git a/src/test/java/org/springframework/data/jpa/repository/OpenJpaNamespaceUserDaoTests.java b/src/test/java/org/springframework/data/jpa/repository/OpenJpaNamespaceUserRepositoryTests.java similarity index 91% rename from src/test/java/org/springframework/data/jpa/repository/OpenJpaNamespaceUserDaoTests.java rename to src/test/java/org/springframework/data/jpa/repository/OpenJpaNamespaceUserRepositoryTests.java index 1d336d481..7945463a9 100644 --- a/src/test/java/org/springframework/data/jpa/repository/OpenJpaNamespaceUserDaoTests.java +++ b/src/test/java/org/springframework/data/jpa/repository/OpenJpaNamespaceUserRepositoryTests.java @@ -25,6 +25,6 @@ import org.springframework.test.context.ContextConfiguration; * @author Oliver Gierke */ @ContextConfiguration(value = "classpath:openjpa.xml", inheritLocations = true) -public class OpenJpaNamespaceUserDaoTests extends NamespaceUserRepositoryTests { +public class OpenJpaNamespaceUserRepositoryTests extends NamespaceUserRepositoryTests { } \ No newline at end of file diff --git a/src/test/java/org/springframework/data/jpa/repository/UserRepositoryFinderTests.java b/src/test/java/org/springframework/data/jpa/repository/UserRepositoryFinderTests.java index 79714056c..96062fd23 100644 --- a/src/test/java/org/springframework/data/jpa/repository/UserRepositoryFinderTests.java +++ b/src/test/java/org/springframework/data/jpa/repository/UserRepositoryFinderTests.java @@ -85,8 +85,8 @@ public class UserRepositoryFinderTests { /** - * Tests that the DAO returns {@code null} for not found objects for finder - * methods that return a single domain object. + * Tests that the repository returns {@code null} for not found objects for + * finder methods that return a single domain object. */ @Test public void returnsNullIfNothingFound() { diff --git a/src/test/java/org/springframework/data/jpa/repository/UserRepositoryTests.java b/src/test/java/org/springframework/data/jpa/repository/UserRepositoryTests.java index ba6c26d21..621104f53 100644 --- a/src/test/java/org/springframework/data/jpa/repository/UserRepositoryTests.java +++ b/src/test/java/org/springframework/data/jpa/repository/UserRepositoryTests.java @@ -326,7 +326,7 @@ public class UserRepositoryTests { /** * Tests that all users get deleted by triggering - * {@link UserDao#deleteAll()}. + * {@link UserRepository#deleteAll()}. * * @throws Exception */ @@ -398,7 +398,7 @@ public class UserRepositoryTests { /** - * Tests, that the generic dao implements count correctly. + * Tests, that the generic repository implements count correctly. */ @Test public void testCountsCorrectly() { @@ -414,7 +414,8 @@ public class UserRepositoryTests { /** - * Tests invoking a method of a custom implementation of the DAO interface. + * Tests invoking a method of a custom implementation of the repository + * interface. */ @Test public void testInvocationOfCustomImplementation() { @@ -424,7 +425,7 @@ public class UserRepositoryTests { /** - * Tests that overriding a finder method is recognized by the DAO + * Tests that overriding a finder method is recognized by the repository * implementation. If an overriding method is found it will will be invoked * instead of the automatically generated finder. */ diff --git a/src/test/java/org/springframework/data/jpa/repository/config/AbstractRepositoryConfigTests.java b/src/test/java/org/springframework/data/jpa/repository/config/AbstractRepositoryConfigTests.java index af9df8702..53930a76b 100644 --- a/src/test/java/org/springframework/data/jpa/repository/config/AbstractRepositoryConfigTests.java +++ b/src/test/java/org/springframework/data/jpa/repository/config/AbstractRepositoryConfigTests.java @@ -45,7 +45,7 @@ public abstract class AbstractRepositoryConfigTests { /** - * Asserts that context creation detects 3 DAO beans. + * Asserts that context creation detects 3 repository beans. */ @Test public void testContextCreation() { diff --git a/src/test/java/org/springframework/data/jpa/repository/config/CustomRepositoryFactoryConfigTests.java b/src/test/java/org/springframework/data/jpa/repository/config/CustomRepositoryFactoryConfigTests.java index 2c116bfbf..5556aa791 100644 --- a/src/test/java/org/springframework/data/jpa/repository/config/CustomRepositoryFactoryConfigTests.java +++ b/src/test/java/org/springframework/data/jpa/repository/config/CustomRepositoryFactoryConfigTests.java @@ -25,14 +25,14 @@ import org.springframework.util.Assert; /** - * Annotation to exclude DAO interfaces from being picked up and thus in + * Annotation to exclude repository interfaces from being picked up and thus in * consequence getting an instance being created. *

* This will typically be used when providing an extended base interface for all - * DAOs in combination with a custom DAO base class to implement methods - * declared in that intermediate interface. In this case you typically derive - * your concrete DAO interfaces from the intermediate one but don't want to - * create a Spring bean for the intermediate interface. + * repositories in combination with a custom repository base class to implement + * methods declared in that intermediate interface. In this case you typically + * derive your concrete repository interfaces from the intermediate one but + * don't want to create a Spring bean for the intermediate interface. * * @author Oliver Gierke */ diff --git a/src/test/java/org/springframework/data/jpa/repository/config/RepositoryAutoConfigTests.java b/src/test/java/org/springframework/data/jpa/repository/config/RepositoryAutoConfigTests.java index 3733e3ba5..d716e14d9 100644 --- a/src/test/java/org/springframework/data/jpa/repository/config/RepositoryAutoConfigTests.java +++ b/src/test/java/org/springframework/data/jpa/repository/config/RepositoryAutoConfigTests.java @@ -20,7 +20,7 @@ import org.springframework.test.context.ContextConfiguration; /** - * Integration test to test DAO auto configuration. + * Integration test to test repository auto configuration. * * @author Oliver Gierke */ diff --git a/src/test/java/org/springframework/data/jpa/repository/config/RepositoryConfigTests.java b/src/test/java/org/springframework/data/jpa/repository/config/RepositoryConfigTests.java index 72a6fa34d..6f6b600a4 100644 --- a/src/test/java/org/springframework/data/jpa/repository/config/RepositoryConfigTests.java +++ b/src/test/java/org/springframework/data/jpa/repository/config/RepositoryConfigTests.java @@ -19,7 +19,7 @@ import org.springframework.test.context.ContextConfiguration; /** - * Integration test for DAO namespace configuration. + * Integration test for repository namespace configuration. * * @author Oliver Gierke */ diff --git a/src/test/java/org/springframework/data/jpa/repository/custom/CustomGenericJpaRepository.java b/src/test/java/org/springframework/data/jpa/repository/custom/CustomGenericJpaRepository.java index f5e733c25..421bb47bb 100644 --- a/src/test/java/org/springframework/data/jpa/repository/custom/CustomGenericJpaRepository.java +++ b/src/test/java/org/springframework/data/jpa/repository/custom/CustomGenericJpaRepository.java @@ -24,8 +24,8 @@ import org.springframework.data.jpa.repository.support.SimpleJpaRepository; /** - * Sample custom DAO base class implementing common custom functionality for all - * derived DAO instances. + * Sample custom repository base class implementing common custom functionality + * for all derived repository instances. * * @author Oliver Gierke */ diff --git a/src/test/java/org/springframework/data/jpa/repository/custom/CustomGenericJpaRepositoryFactoryBean.java b/src/test/java/org/springframework/data/jpa/repository/custom/CustomGenericJpaRepositoryFactoryBean.java index a1bcde25c..e2b6c01d3 100644 --- a/src/test/java/org/springframework/data/jpa/repository/custom/CustomGenericJpaRepositoryFactoryBean.java +++ b/src/test/java/org/springframework/data/jpa/repository/custom/CustomGenericJpaRepositoryFactoryBean.java @@ -24,7 +24,7 @@ import org.springframework.data.repository.support.RepositoryFactorySupport; /** - * {@link GenericDaoFactoryBean} to return a custom DAO base class. + * {@link JpaRepositoryFactoryBean} to return a custom repository base class. * * @author Gil Markham * @author Oliver Gierke diff --git a/src/test/java/org/springframework/data/jpa/repository/custom/UserCustomExtendedRepository.java b/src/test/java/org/springframework/data/jpa/repository/custom/UserCustomExtendedRepository.java index 8042e2de8..723786422 100644 --- a/src/test/java/org/springframework/data/jpa/repository/custom/UserCustomExtendedRepository.java +++ b/src/test/java/org/springframework/data/jpa/repository/custom/UserCustomExtendedRepository.java @@ -20,8 +20,8 @@ import org.springframework.data.jpa.domain.sample.User; /** - * Custom Extended DAO interface for a {@code User}. This relies on the custom - * intermediate DAO interface {@link CustomGenericRepository}. + * Custom Extended repository interface for a {@code User}. This relies on the + * custom intermediate repository interface {@link CustomGenericRepository}. * * @author Oliver Gierke */ diff --git a/src/test/java/org/springframework/data/jpa/repository/query/JpaQueryMethodUnitTests.java b/src/test/java/org/springframework/data/jpa/repository/query/JpaQueryMethodUnitTests.java index 8b30066d9..102eb1dd6 100644 --- a/src/test/java/org/springframework/data/jpa/repository/query/JpaQueryMethodUnitTests.java +++ b/src/test/java/org/springframework/data/jpa/repository/query/JpaQueryMethodUnitTests.java @@ -56,7 +56,7 @@ public class JpaQueryMethodUnitTests { @Mock EntityManager em; - Method daoMethod, invalidReturnType, pageableAndSort, pageableTwice, + Method repositoryMethod, invalidReturnType, pageableAndSort, pageableTwice, sortableTwice, modifyingMethod; @@ -66,21 +66,21 @@ public class JpaQueryMethodUnitTests { @Before public void setUp() throws Exception { - daoMethod = + repositoryMethod = UserRepository.class.getMethod("findByLastname", String.class); invalidReturnType = - InvalidDao.class.getMethod(METHOD_NAME, String.class, + InvalidRepository.class.getMethod(METHOD_NAME, String.class, Pageable.class); pageableAndSort = - InvalidDao.class.getMethod(METHOD_NAME, String.class, + InvalidRepository.class.getMethod(METHOD_NAME, String.class, Pageable.class, Sort.class); pageableTwice = - InvalidDao.class.getMethod(METHOD_NAME, String.class, + InvalidRepository.class.getMethod(METHOD_NAME, String.class, Pageable.class, Pageable.class); sortableTwice = - InvalidDao.class.getMethod(METHOD_NAME, String.class, + InvalidRepository.class.getMethod(METHOD_NAME, String.class, Sort.class, Sort.class); modifyingMethod = UserRepository.class @@ -91,7 +91,8 @@ public class JpaQueryMethodUnitTests { @Test public void testname() { - JpaQueryMethod method = new JpaQueryMethod(daoMethod, extractor, em); + JpaQueryMethod method = + new JpaQueryMethod(repositoryMethod, extractor, em); assertEquals("User.findByLastname", method.getNamedQueryName()); assertThat(method.getExecution(), is(CollectionExecution.class)); @@ -99,7 +100,7 @@ public class JpaQueryMethodUnitTests { @Test(expected = IllegalArgumentException.class) - public void preventsNullDaoMethod() { + public void preventsNullRepositoryMethod() { new JpaQueryMethod(null, extractor, em); } @@ -108,37 +109,39 @@ public class JpaQueryMethodUnitTests { @Test(expected = IllegalArgumentException.class) public void preventsNullEntityManager() { - new JpaQueryMethod(daoMethod, extractor, null); + new JpaQueryMethod(repositoryMethod, extractor, null); } @Test(expected = IllegalArgumentException.class) public void preventsNullQueryExtractor() { - new JpaQueryMethod(daoMethod, null, em); + new JpaQueryMethod(repositoryMethod, null, em); } @Test public void returnsCorrectName() { - JpaQueryMethod method = new JpaQueryMethod(daoMethod, extractor, em); - assertEquals(daoMethod.getName(), method.getName()); + JpaQueryMethod method = + new JpaQueryMethod(repositoryMethod, extractor, em); + assertEquals(repositoryMethod.getName(), method.getName()); } @Test public void returnsQueryIfAvailable() throws Exception { - JpaQueryMethod method = new JpaQueryMethod(daoMethod, extractor, em); + JpaQueryMethod method = + new JpaQueryMethod(repositoryMethod, extractor, em); assertNull(method.getAnnotatedQuery()); - Method daoMethod = + Method repositoryMethod = UserRepository.class.getMethod("findByAnnotatedQuery", String.class); - assertNotNull(new JpaQueryMethod(daoMethod, extractor, em) + assertNotNull(new JpaQueryMethod(repositoryMethod, extractor, em) .getAnnotatedQuery()); } @@ -146,7 +149,8 @@ public class JpaQueryMethodUnitTests { @Test public void returnsCorrectDomainClassName() { - JpaQueryMethod method = new JpaQueryMethod(daoMethod, extractor, em); + JpaQueryMethod method = + new JpaQueryMethod(repositoryMethod, extractor, em); assertEquals(DOMAIN_CLASS, method.getDomainClass()); } @@ -154,8 +158,9 @@ public class JpaQueryMethodUnitTests { @Test public void returnsCorrectNumberOfParameters() { - JpaQueryMethod method = new JpaQueryMethod(daoMethod, extractor, em); - assertTrue(method.isCorrectNumberOfParameters(daoMethod + JpaQueryMethod method = + new JpaQueryMethod(repositoryMethod, extractor, em); + assertTrue(method.isCorrectNumberOfParameters(repositoryMethod .getParameterTypes().length)); } @@ -215,7 +220,7 @@ public class JpaQueryMethodUnitTests { public void rejectsModifyingMethodWithPageable() throws Exception { Method method = - InvalidDao.class.getMethod("updateMethod", String.class, + InvalidRepository.class.getMethod("updateMethod", String.class, Pageable.class); new JpaQueryMethod(method, extractor, em); @@ -226,7 +231,7 @@ public class JpaQueryMethodUnitTests { public void rejectsModifyingMethodWithSort() throws Exception { Method method = - InvalidDao.class.getMethod("updateMethod", String.class, + InvalidRepository.class.getMethod("updateMethod", String.class, Sort.class); new JpaQueryMethod(method, extractor, em); @@ -236,7 +241,8 @@ public class JpaQueryMethodUnitTests { @Test public void discoversHintsCorrectly() { - JpaQueryMethod method = new JpaQueryMethod(daoMethod, extractor, em); + JpaQueryMethod method = + new JpaQueryMethod(repositoryMethod, extractor, em); List hints = method.getHints(); assertNotNull(hints); @@ -245,11 +251,11 @@ public class JpaQueryMethodUnitTests { } /** - * Interface to define invalid DAO methods for testing. + * Interface to define invalid repository methods for testing. * * @author Oliver Gierke */ - static interface InvalidDao { + static interface InvalidRepository { // Invalid return type User findByFirstname(String firstname, Pageable pageable); diff --git a/src/test/java/org/springframework/data/jpa/repository/query/ParameterBinderUnitTests.java b/src/test/java/org/springframework/data/jpa/repository/query/ParameterBinderUnitTests.java index 9510f52f4..ec4cf6690 100644 --- a/src/test/java/org/springframework/data/jpa/repository/query/ParameterBinderUnitTests.java +++ b/src/test/java/org/springframework/data/jpa/repository/query/ParameterBinderUnitTests.java @@ -55,12 +55,13 @@ public class ParameterBinderUnitTests { @Before public void setUp() throws SecurityException, NoSuchMethodException { - valid = SampleDao.class.getMethod("valid", String.class); + valid = SampleRepository.class.getMethod("valid", String.class); useIndexedParameters = - SampleDao.class.getMethod("useIndexedParameters", String.class); + SampleRepository.class.getMethod("useIndexedParameters", + String.class); indexedParametersWithSort = - SampleDao.class.getMethod("indexedParameterWithSort", + SampleRepository.class.getMethod("indexedParameterWithSort", String.class, Sort.class); } @@ -68,7 +69,7 @@ public class ParameterBinderUnitTests { } - static interface SampleDao { + static interface SampleRepository { User useIndexedParameters(String lastname); @@ -116,8 +117,8 @@ public class ParameterBinderUnitTests { NoSuchMethodException { Method method = - SampleDao.class.getMethod("validWithPageable", String.class, - Pageable.class); + SampleRepository.class.getMethod("validWithPageable", + String.class, Pageable.class); Parameters parameters = new Parameters(method); ParameterBinder binder = @@ -131,7 +132,7 @@ public class ParameterBinderUnitTests { public void bindWorksWithNullForSort() throws Exception { Method validWithSort = - SampleDao.class.getMethod("validWithSort", String.class, + SampleRepository.class.getMethod("validWithSort", String.class, Sort.class); new ParameterBinder(new Parameters(validWithSort), new Object[] { @@ -144,8 +145,8 @@ public class ParameterBinderUnitTests { public void bindWorksWithNullForPageable() throws Exception { Method validWithPageable = - SampleDao.class.getMethod("validWithPageable", String.class, - Pageable.class); + SampleRepository.class.getMethod("validWithPageable", + String.class, Pageable.class); new ParameterBinder(new Parameters(validWithPageable), new Object[] { "foo", null }).bind(query); diff --git a/src/test/java/org/springframework/data/jpa/repository/sample/AuditableUserRepository.java b/src/test/java/org/springframework/data/jpa/repository/sample/AuditableUserRepository.java index 3ceeb3b6f..efafac94e 100644 --- a/src/test/java/org/springframework/data/jpa/repository/sample/AuditableUserRepository.java +++ b/src/test/java/org/springframework/data/jpa/repository/sample/AuditableUserRepository.java @@ -23,7 +23,7 @@ import org.springframework.data.jpa.repository.JpaRepository; /** - * DAO interface for {@code AuditableUser}. + * Repository interface for {@code AuditableUser}. * * @author Oliver Gierke */ diff --git a/src/test/java/org/springframework/data/jpa/repository/sample/UserRepository.java b/src/test/java/org/springframework/data/jpa/repository/sample/UserRepository.java index f7f6d5d88..e6ec72850 100644 --- a/src/test/java/org/springframework/data/jpa/repository/sample/UserRepository.java +++ b/src/test/java/org/springframework/data/jpa/repository/sample/UserRepository.java @@ -33,8 +33,7 @@ import org.springframework.transaction.annotation.Transactional; /** - * DAO interface for {@code User}s. The declared methods will trigger named - * queries as they start with {@code findBy}. + * Repository interface for {@code User}s. * * @author Oliver Gierke */ diff --git a/src/test/java/org/springframework/data/jpa/repository/sample/UserRepositoryCustom.java b/src/test/java/org/springframework/data/jpa/repository/sample/UserRepositoryCustom.java index 63430709c..7bfb03229 100644 --- a/src/test/java/org/springframework/data/jpa/repository/sample/UserRepositoryCustom.java +++ b/src/test/java/org/springframework/data/jpa/repository/sample/UserRepositoryCustom.java @@ -20,7 +20,7 @@ import org.springframework.data.jpa.domain.sample.User; /** - * Simple interface for custom methods on the DAO for {@code User}s. + * Simple interface for custom methods on the repository for {@code User}s. * * @author Oliver Gierke */ diff --git a/src/test/java/org/springframework/data/jpa/repository/support/EntityManagerFactoryRefTests.java b/src/test/java/org/springframework/data/jpa/repository/support/EntityManagerFactoryRefTests.java index 94759be7d..133e7ae20 100644 --- a/src/test/java/org/springframework/data/jpa/repository/support/EntityManagerFactoryRefTests.java +++ b/src/test/java/org/springframework/data/jpa/repository/support/EntityManagerFactoryRefTests.java @@ -30,8 +30,8 @@ import org.springframework.transaction.annotation.Transactional; /** - * Assures the injected DAO instances are wired to the customly configured - * {@link EntityManagerFactory}. + * Assures the injected repository instances are wired to the customly + * configured {@link EntityManagerFactory}. * * @author Oliver Gierke */ @@ -43,7 +43,7 @@ public class EntityManagerFactoryRefTests { UserRepository userRepository; @Autowired - AuditableUserRepository auditableUserDao; + AuditableUserRepository auditableUserRepository; @Test @@ -57,8 +57,8 @@ public class EntityManagerFactoryRefTests { @Test @Transactional("transactionManager-2") - public void useAuditableUserDao() throws Exception { + public void useAuditableUserRepository() throws Exception { - auditableUserDao.saveAndFlush(new AuditableUser()); + auditableUserRepository.saveAndFlush(new AuditableUser()); } } diff --git a/src/test/java/org/springframework/data/jpa/repository/support/EntityManagerFactoryRefUnitTests.java b/src/test/java/org/springframework/data/jpa/repository/support/EntityManagerFactoryRefUnitTests.java index 70193df60..bb62d4e48 100644 --- a/src/test/java/org/springframework/data/jpa/repository/support/EntityManagerFactoryRefUnitTests.java +++ b/src/test/java/org/springframework/data/jpa/repository/support/EntityManagerFactoryRefUnitTests.java @@ -36,8 +36,8 @@ import org.springframework.test.context.ContextConfiguration; /** - * Assures the injected DAO instances are wired to the customly configured - * {@link EntityManagerFactory}. + * Assures the injected repository instances are wired to the customly + * configured {@link EntityManagerFactory}. * * @author Oliver Gierke */ @@ -55,7 +55,8 @@ public class EntityManagerFactoryRefUnitTests extends @Test - public void daosGetTheSecondEntityManagerFactoryInjected() throws Exception { + public void repositoriesGetTheSecondEntityManagerFactoryInjected() + throws Exception { verify(first, never()).createEntityManager(); verify(second, atLeastOnce()).createEntityManager(); diff --git a/src/test/java/org/springframework/data/jpa/repository/support/JpaRepositoryFactoryBeanUnitTests.java b/src/test/java/org/springframework/data/jpa/repository/support/JpaRepositoryFactoryBeanUnitTests.java index bb1c28a6e..010d4563d 100644 --- a/src/test/java/org/springframework/data/jpa/repository/support/JpaRepositoryFactoryBeanUnitTests.java +++ b/src/test/java/org/springframework/data/jpa/repository/support/JpaRepositoryFactoryBeanUnitTests.java @@ -38,7 +38,7 @@ import org.springframework.data.jpa.repository.JpaRepository; /** - * Unit test for {@code GenericDaoFactoryBean}. + * Unit test for {@code JpaRepositoryFactoryBean}. *

* TODO: Check if test methods double the ones in * {@link JpaRepositoryFactoryUnitTests}. @@ -80,7 +80,7 @@ public class JpaRepositoryFactoryBeanUnitTests { /** * Assert that the instance created for the standard configuration is a - * valid {@code UserDao}. + * valid {@code UserRepository}. * * @throws Exception */ @@ -103,22 +103,23 @@ public class JpaRepositoryFactoryBeanUnitTests { /** * Assert that the factory rejects calls to - * {@code GenericDaoFactoryBean#setDaoInterface(Class)} with {@code null} or - * any other parameter instance not implementing {@code GenericDao}. + * {@code JpaRepositoryFactoryBean#setRepositoryInterface(Class)} with + * {@literal null} or any other parameter instance not implementing + * {@code Repository}. */ @Test(expected = IllegalArgumentException.class) - public void preventsNullDaoInterface() { + public void preventsNullRepositoryInterface() { factory.setRepositoryInterface(null); } /** - * Assert that the factory detects unset DAO class and interface in - * {@code GenericDaoFactoryBean#afterPropertiesSet()}. + * Assert that the factory detects unset repository class and interface in + * {@code JpaRepositoryFactoryBean#afterPropertiesSet()}. */ @Test(expected = IllegalArgumentException.class) - public void preventsUnsetDaoInterface() throws Exception { + public void preventsUnsetRepositoryInterface() throws Exception { factory = new JpaRepositoryFactoryBean(); factory.afterPropertiesSet(); @@ -126,10 +127,11 @@ public class JpaRepositoryFactoryBeanUnitTests { /** - * Asserts that the factory recognized configured DAO classes that contain - * custom method but no custom implementation could be found. Furthremore - * the exception has to contain the name of the DAO interface as for a large - * DAO configuration it's hard to find out where this error occured. + * Asserts that the factory recognized configured repository classes that + * contain custom method but no custom implementation could be found. + * Furthremore the exception has to contain the name of the repository + * interface as for a large repository configuration it's hard to find out + * where this error occured. * * @throws Exception */ @@ -160,13 +162,13 @@ public class JpaRepositoryFactoryBeanUnitTests { * * @author Oliver Gierke */ - private interface SampleCustomDao { + private interface SampleCustomRepository { void someSampleMethod(); } private interface SampleRepository extends JpaRepository, - SampleCustomDao { + SampleCustomRepository { } } diff --git a/src/test/java/org/springframework/data/jpa/repository/support/JpaRepositoryFactoryUnitTests.java b/src/test/java/org/springframework/data/jpa/repository/support/JpaRepositoryFactoryUnitTests.java index 579a833a0..d67eb0138 100644 --- a/src/test/java/org/springframework/data/jpa/repository/support/JpaRepositoryFactoryUnitTests.java +++ b/src/test/java/org/springframework/data/jpa/repository/support/JpaRepositoryFactoryUnitTests.java @@ -35,7 +35,7 @@ import org.springframework.transaction.annotation.Transactional; /** - * Unit test for {@code GenericDaoFactoryBean}. + * Unit test for {@code JpaRepositoryFactory}. * * @author Oliver Gierke */ @@ -58,33 +58,35 @@ public class JpaRepositoryFactoryUnitTests { /** * Assert that the instance created for the standard configuration is a - * valid {@code UserDao}. + * valid {@code UserRepository}. * * @throws Exception */ @Test public void setsUpBasicInstanceCorrectly() throws Exception { - assertNotNull(factory.getRepository(SimpleSampleDao.class)); + assertNotNull(factory.getRepository(SimpleSampleRepository.class)); } @Test public void allowsCallingOfObjectMethods() { - SimpleSampleDao userDao = factory.getRepository(SimpleSampleDao.class); + SimpleSampleRepository repository = + factory.getRepository(SimpleSampleRepository.class); - userDao.hashCode(); - userDao.toString(); - userDao.equals(userDao); + repository.hashCode(); + repository.toString(); + repository.equals(repository); } /** - * Asserts that the factory recognized configured DAO classes that contain - * custom method but no custom implementation could be found. Furthremore - * the exception has to contain the name of the DAO interface as for a large - * DAO configuration it's hard to find out where this error occured. + * Asserts that the factory recognized configured repository classes that + * contain custom method but no custom implementation could be found. + * Furthremore the exception has to contain the name of the repository + * interface as for a large repository configuration it's hard to find out + * where this error occured. * * @throws Exception */ @@ -93,9 +95,10 @@ public class JpaRepositoryFactoryUnitTests { throws Exception { try { - factory.getRepository(SampleDao.class); + factory.getRepository(SampleRepository.class); } catch (IllegalArgumentException e) { - assertTrue(e.getMessage().contains(SampleDao.class.getName())); + assertTrue(e.getMessage() + .contains(SampleRepository.class.getName())); } } @@ -103,20 +106,20 @@ public class JpaRepositoryFactoryUnitTests { @Test(expected = IllegalArgumentException.class) public void handlesRuntimeExceptionsCorrectly() { - SampleDao dao = - factory.getRepository(SampleDao.class, - new SampleCustomDaoImpl()); - dao.throwingRuntimeException(); + SampleRepository repository = + factory.getRepository(SampleRepository.class, + new SampleCustomRepositoryImpl()); + repository.throwingRuntimeException(); } @Test(expected = IOException.class) public void handlesCheckedExceptionsCorrectly() throws Exception { - SampleDao dao = - factory.getRepository(SampleDao.class, - new SampleCustomDaoImpl()); - dao.throwingCheckedException(); + SampleRepository repository = + factory.getRepository(SampleRepository.class, + new SampleCustomRepositoryImpl()); + repository.throwingCheckedException(); } @@ -125,13 +128,14 @@ public class JpaRepositoryFactoryUnitTests { JpaRepositoryFactory factory = new CustomGenericJpaRepositoryFactory(entityManager); - UserCustomExtendedRepository dao = + UserCustomExtendedRepository repository = factory.getRepository(UserCustomExtendedRepository.class); - dao.customMethod(1); + repository.customMethod(1); } - private interface SimpleSampleDao extends JpaRepository { + private interface SimpleSampleRepository extends + JpaRepository { @Transactional User readByPrimaryKey(Integer primaryKey); @@ -142,7 +146,7 @@ public class JpaRepositoryFactoryUnitTests { * * @author Oliver Gierke */ - public interface SampleCustomDao { + public interface SampleCustomRepository { void throwingRuntimeException(); @@ -151,11 +155,11 @@ public class JpaRepositoryFactoryUnitTests { } /** - * Implementation of the custom DAO interface. + * Implementation of the custom repository interface. * * @author Oliver Gierke */ - private class SampleCustomDaoImpl implements SampleCustomDao { + private class SampleCustomRepositoryImpl implements SampleCustomRepository { public void throwingRuntimeException() { @@ -169,8 +173,8 @@ public class JpaRepositoryFactoryUnitTests { } } - private interface SampleDao extends JpaRepository, - SampleCustomDao { + private interface SampleRepository extends JpaRepository, + SampleCustomRepository { } } diff --git a/src/test/java/org/springframework/data/jpa/repository/support/JpaRepositoryTests.java b/src/test/java/org/springframework/data/jpa/repository/support/JpaRepositoryTests.java index 49032205d..d9e8764a8 100644 --- a/src/test/java/org/springframework/data/jpa/repository/support/JpaRepositoryTests.java +++ b/src/test/java/org/springframework/data/jpa/repository/support/JpaRepositoryTests.java @@ -35,7 +35,7 @@ import org.springframework.transaction.annotation.Transactional; /** - * Integration test for {@link GenericJpaDao}. + * Integration test for {@link JpaRepository}. * * @author Oliver Gierke */ diff --git a/src/test/java/org/springframework/data/jpa/repository/support/TransactionalRepositoryTests.java b/src/test/java/org/springframework/data/jpa/repository/support/TransactionalRepositoryTests.java index 15baa6d43..a9d178f20 100644 --- a/src/test/java/org/springframework/data/jpa/repository/support/TransactionalRepositoryTests.java +++ b/src/test/java/org/springframework/data/jpa/repository/support/TransactionalRepositoryTests.java @@ -18,7 +18,7 @@ import org.springframework.transaction.TransactionStatus; /** - * Integration test for transactional behaviour of DAO operations. + * Integration test for transactional behaviour of repository operations. * * @author Oliver Gierke */