Polished JavaDoc and code.
Removed any reference to Hades from JavaDoc and code. Use a logger instead of System.out in test cases.
This commit is contained in:
@@ -29,7 +29,7 @@ public class AuditorAwareStub implements AuditorAware<User> {
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.synyx.hades.domain.auditing.AuditorAware#getCurrentAuditor()
|
||||
* @see org.springframework.data.domain.AuditorAware#getCurrentAuditor()
|
||||
*/
|
||||
public User getCurrentAuditor() {
|
||||
|
||||
|
||||
@@ -62,10 +62,10 @@ public class Role {
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
/**
|
||||
* Returns the id.
|
||||
*
|
||||
* @see org.synyx.hades.jpa.support.Entity#getId()
|
||||
* @return
|
||||
*/
|
||||
public Integer getId() {
|
||||
|
||||
@@ -85,10 +85,10 @@ public class Role {
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
/**
|
||||
* Returns whether the role is to be considered new.
|
||||
*
|
||||
* @see org.synyx.hades.jpa.support.Entity#isNew()
|
||||
* @return
|
||||
*/
|
||||
public boolean isNew() {
|
||||
|
||||
|
||||
@@ -20,11 +20,10 @@ import static org.junit.Assert.*;
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.config.RuntimeBeanReference;
|
||||
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
||||
|
||||
|
||||
/**
|
||||
* Unit test for the Hades {@code auditing} namespace element.
|
||||
* Unit test for the JPA {@code auditing} namespace element.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
@@ -34,9 +33,8 @@ public class AuditingNamespaceUnitTests extends
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.synyx.hades.domain.auditing.AuditingBeanFactoryPostProcessorUnitTest
|
||||
* #getConfigFile()
|
||||
* @see org.springframework.data.jpa.domain.support.
|
||||
* AuditingBeanFactoryPostProcessorUnitTests#getConfigFile()
|
||||
*/
|
||||
@Override
|
||||
protected String getConfigFile() {
|
||||
|
||||
@@ -16,11 +16,12 @@
|
||||
package org.springframework.data.jpa.repository;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.springframework.data.jpa.repository.sample.UserRepository;
|
||||
|
||||
|
||||
/**
|
||||
* Testcase to run {@link org.synyx.hades.dao.UserDao} integration tests on top
|
||||
* of EclipseLink. So far not running as of an EclipseLink bug.
|
||||
* Testcase to run {@link UserRepository} integration tests on top of
|
||||
* EclipseLink. So far not running as of an EclipseLink bug.
|
||||
*
|
||||
* @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=312132
|
||||
* @author Oliver Gierke
|
||||
|
||||
@@ -15,12 +15,12 @@
|
||||
*/
|
||||
package org.springframework.data.jpa.repository;
|
||||
|
||||
import org.springframework.data.jpa.repository.sample.UserRepository;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
|
||||
|
||||
/**
|
||||
* Testcase to run {@link org.synyx.hades.dao.UserDao} integration tests on top
|
||||
* of OpenJPA.
|
||||
* Testcase to run {@link UserRepository} integration tests on top of OpenJPA.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
|
||||
@@ -436,9 +436,9 @@ public class UserRepositoryTests {
|
||||
|
||||
|
||||
@Test
|
||||
public void testUsesHadesQueryAnnotation() {
|
||||
public void testUsesQueryAnnotation() {
|
||||
|
||||
assertEquals(null, repository.findByHadesQuery("gierke@synyx.de"));
|
||||
assertEquals(null, repository.findByAnnotatedQuery("gierke@synyx.de"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -25,14 +25,14 @@ import org.springframework.util.Assert;
|
||||
|
||||
|
||||
/**
|
||||
* Annotation to exclude DAO interfaces from being picked up by Hades and thus
|
||||
* in consequence getting an instance being created.
|
||||
* Annotation to exclude DAO interfaces from being picked up and thus in
|
||||
* consequence getting an instance being created.
|
||||
* <p>
|
||||
* 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 Hades
|
||||
* to create a Spring bean for the intermediate interface.
|
||||
* your concrete DAO interfaces from the intermediate one but don't want to
|
||||
* create a Spring bean for the intermediate interface.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
|
||||
@@ -33,8 +33,9 @@ public class TypeFilterConfigTest extends AbstractRepositoryConfigTests {
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @seeorg.synyx.hades.dao.config.AbstractDaoConfigIntegrationTest#
|
||||
* testContextCreation()
|
||||
* @see
|
||||
* org.springframework.data.jpa.repository.config.AbstractRepositoryConfigTests
|
||||
* #testContextCreation()
|
||||
*/
|
||||
@Override
|
||||
public void testContextCreation() {
|
||||
|
||||
@@ -47,8 +47,8 @@ public class CustomGenericJpaRepository<T, ID extends Serializable> extends
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.synyx.hades.customimpl.CustomExtendedGenericDao#customMethod(java
|
||||
* .io.Serializable)
|
||||
* org.springframework.data.jpa.repository.custom.CustomGenericRepository
|
||||
* #customMethod(java.io.Serializable)
|
||||
*/
|
||||
public T customMethod(ID id) {
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ public class JpaQueryMethodUnitTests {
|
||||
EntityManager em;
|
||||
|
||||
Method daoMethod, invalidReturnType, pageableAndSort, pageableTwice,
|
||||
sortableTwice, modifyingMethod;
|
||||
sortableTwice, modifyingMethod;
|
||||
|
||||
|
||||
/**
|
||||
@@ -67,24 +67,24 @@ public class JpaQueryMethodUnitTests {
|
||||
public void setUp() throws Exception {
|
||||
|
||||
daoMethod =
|
||||
UserRepository.class.getMethod("findByLastname", String.class);
|
||||
UserRepository.class.getMethod("findByLastname", String.class);
|
||||
|
||||
invalidReturnType =
|
||||
InvalidDao.class.getMethod(METHOD_NAME, String.class,
|
||||
Pageable.class);
|
||||
InvalidDao.class.getMethod(METHOD_NAME, String.class,
|
||||
Pageable.class);
|
||||
pageableAndSort =
|
||||
InvalidDao.class.getMethod(METHOD_NAME, String.class,
|
||||
Pageable.class, Sort.class);
|
||||
InvalidDao.class.getMethod(METHOD_NAME, String.class,
|
||||
Pageable.class, Sort.class);
|
||||
pageableTwice =
|
||||
InvalidDao.class.getMethod(METHOD_NAME, String.class,
|
||||
Pageable.class, Pageable.class);
|
||||
InvalidDao.class.getMethod(METHOD_NAME, String.class,
|
||||
Pageable.class, Pageable.class);
|
||||
|
||||
sortableTwice =
|
||||
InvalidDao.class.getMethod(METHOD_NAME, String.class,
|
||||
Sort.class, Sort.class);
|
||||
InvalidDao.class.getMethod(METHOD_NAME, String.class,
|
||||
Sort.class, Sort.class);
|
||||
modifyingMethod =
|
||||
UserRepository.class
|
||||
.getMethod("renameAllUsersTo", String.class);
|
||||
UserRepository.class
|
||||
.getMethod("renameAllUsersTo", String.class);
|
||||
}
|
||||
|
||||
|
||||
@@ -135,11 +135,11 @@ public class JpaQueryMethodUnitTests {
|
||||
assertNull(method.getAnnotatedQuery());
|
||||
|
||||
Method daoMethod =
|
||||
UserRepository.class
|
||||
.getMethod("findByHadesQuery", String.class);
|
||||
UserRepository.class.getMethod("findByAnnotatedQuery",
|
||||
String.class);
|
||||
|
||||
assertNotNull(new JpaQueryMethod(daoMethod, extractor, em)
|
||||
.getAnnotatedQuery());
|
||||
.getAnnotatedQuery());
|
||||
}
|
||||
|
||||
|
||||
@@ -190,11 +190,11 @@ public class JpaQueryMethodUnitTests {
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void rejectsPageablesOnPersistenceProvidersNotExtractingQueries()
|
||||
throws Exception {
|
||||
throws Exception {
|
||||
|
||||
Method method =
|
||||
UserRepository.class.getMethod("findByFirstname",
|
||||
Pageable.class, String.class);
|
||||
UserRepository.class.getMethod("findByFirstname",
|
||||
Pageable.class, String.class);
|
||||
|
||||
when(extractor.canExtractQuery()).thenReturn(false);
|
||||
|
||||
@@ -206,7 +206,7 @@ public class JpaQueryMethodUnitTests {
|
||||
public void recognizesModifyingMethod() {
|
||||
|
||||
JpaQueryMethod method =
|
||||
new JpaQueryMethod(modifyingMethod, extractor, em);
|
||||
new JpaQueryMethod(modifyingMethod, extractor, em);
|
||||
assertTrue(method.isModifyingQuery());
|
||||
}
|
||||
|
||||
@@ -215,8 +215,8 @@ public class JpaQueryMethodUnitTests {
|
||||
public void rejectsModifyingMethodWithPageable() throws Exception {
|
||||
|
||||
Method method =
|
||||
InvalidDao.class.getMethod("updateMethod", String.class,
|
||||
Pageable.class);
|
||||
InvalidDao.class.getMethod("updateMethod", String.class,
|
||||
Pageable.class);
|
||||
|
||||
new JpaQueryMethod(method, extractor, em);
|
||||
}
|
||||
@@ -226,8 +226,8 @@ public class JpaQueryMethodUnitTests {
|
||||
public void rejectsModifyingMethodWithSort() throws Exception {
|
||||
|
||||
Method method =
|
||||
InvalidDao.class.getMethod("updateMethod", String.class,
|
||||
Sort.class);
|
||||
InvalidDao.class.getMethod("updateMethod", String.class,
|
||||
Sort.class);
|
||||
|
||||
new JpaQueryMethod(method, extractor, em);
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ public class QueryUtilsUnitTests {
|
||||
|
||||
static final String QUERY = "select u from User u";
|
||||
static final String FQ_QUERY =
|
||||
"select u from org.synyx.hades.domain.User$Foo_Bar u";
|
||||
"select u from org.acme.domain.User$Foo_Bar u";
|
||||
static final String SIMPLE_QUERY = "from User u";
|
||||
static final String COUNT_QUERY = "select count(u) from User u";
|
||||
|
||||
@@ -147,7 +147,7 @@ public class QueryUtilsUnitTests {
|
||||
|
||||
assertThat(detectAlias(FQ_QUERY), IS_U);
|
||||
assertCountQuery(FQ_QUERY,
|
||||
"select count(u) from org.synyx.hades.domain.User$Foo_Bar u");
|
||||
"select count(u) from org.acme.domain.User$Foo_Bar u");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ import org.springframework.data.jpa.repository.sample.UserRepository;
|
||||
|
||||
|
||||
/**
|
||||
* Unit test for {@link SimpleHadesQuery}.
|
||||
* Unit test for {@link SimpleJpaQuery}.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
@@ -68,8 +68,8 @@ public class SimpleJpaQueryUnitTests {
|
||||
@Test
|
||||
public void appliesHintsCorrectly() throws Exception {
|
||||
|
||||
SimpleJpaQuery hadesQuery = new SimpleJpaQuery(method, em, "foobar");
|
||||
hadesQuery.createQuery(new ParameterBinder(method.getParameters(),
|
||||
SimpleJpaQuery jpaQuery = new SimpleJpaQuery(method, em, "foobar");
|
||||
jpaQuery.createQuery(new ParameterBinder(method.getParameters(),
|
||||
new Object[] { "gierke" }));
|
||||
|
||||
verify(query).setHint("foo", "bar");
|
||||
@@ -83,9 +83,9 @@ public class SimpleJpaQueryUnitTests {
|
||||
when(method.getCountQuery()).thenReturn("foo");
|
||||
when(em.createQuery("foo")).thenReturn(query);
|
||||
|
||||
SimpleJpaQuery hadesQuery =
|
||||
SimpleJpaQuery jpaQuery =
|
||||
new SimpleJpaQuery(method, em, "select u from User u");
|
||||
|
||||
assertThat(hadesQuery.createCountQuery(null), is(query));
|
||||
assertThat(jpaQuery.createCountQuery(null), is(query));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ public interface UserRepository extends JpaRepository<User, Integer>,
|
||||
*/
|
||||
@Query("select u from User u where u.emailAddress = ?1")
|
||||
@Transactional(readOnly = true)
|
||||
User findByHadesQuery(String emailAddress);
|
||||
User findByAnnotatedQuery(String emailAddress);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package org.springframework.data.jpa.repository.sample;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.data.jpa.domain.sample.User;
|
||||
|
||||
|
||||
@@ -10,25 +12,30 @@ import org.springframework.data.jpa.domain.sample.User;
|
||||
*/
|
||||
public class UserRepositoryImpl implements UserRepositoryCustom {
|
||||
|
||||
private static final Logger LOG = LoggerFactory
|
||||
.getLogger(UserRepositoryImpl.class);
|
||||
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.synyx.hades.dao.UserDao#someOtherMethod(org.synyx.hades.domain.User)
|
||||
* @see org.springframework.data.jpa.repository.sample.UserRepositoryCustom#
|
||||
* someCustomMethod(org.springframework.data.jpa.domain.sample.User)
|
||||
*/
|
||||
public void someCustomMethod(User u) {
|
||||
|
||||
System.out.println("Some custom method was invoked!");
|
||||
LOG.debug("Some custom method was invoked!");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.synyx.hades.dao.UserDaoCustom#findFooMethod()
|
||||
* @see org.springframework.data.jpa.repository.sample.UserRepositoryCustom#
|
||||
* findByOverrridingMethod()
|
||||
*/
|
||||
public void findByOverrridingMethod() {
|
||||
|
||||
System.out.println("A mthod overriding a finder was invoked!");
|
||||
LOG.debug("A method overriding a finder was invoked!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ public class TransactionalRepositoryTests extends
|
||||
@Test
|
||||
public void invokeTransactionalFinder() throws Exception {
|
||||
|
||||
repository.findByHadesQuery("foo@bar.de");
|
||||
repository.findByAnnotatedQuery("foo@bar.de");
|
||||
assertThat(transactionManager.getTransactionRequests(), is(1));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user