DATAJPA-622 - Polishing.

Renamed CustomAbstractPersistableIntergrationTests to AbstractPersistableIntergrationTests. Reordered declarations in persistence(2).xml to make sure we retain alphabetic sorting.

Original pull request: #115.
This commit is contained in:
Oliver Gierke
2014-11-24 17:33:34 +01:00
parent 55382f58a2
commit 0b761a8921
4 changed files with 20 additions and 22 deletions

View File

@@ -41,11 +41,9 @@ public abstract class AbstractPersistable<PK extends Serializable> implements Pe
/*
* (non-Javadoc)
*
* @see org.springframework.data.domain.Persistable#getId()
*/
public PK getId() {
return id;
}
@@ -55,7 +53,6 @@ public abstract class AbstractPersistable<PK extends Serializable> implements Pe
* @param id the id to set
*/
protected void setId(final PK id) {
this.id = id;
}
@@ -67,7 +64,6 @@ public abstract class AbstractPersistable<PK extends Serializable> implements Pe
*/
@Transient
public boolean isNew() {
return null == getId();
}
@@ -78,7 +74,6 @@ public abstract class AbstractPersistable<PK extends Serializable> implements Pe
*/
@Override
public String toString() {
return String.format("Entity of type %s with id: %s", this.getClass().getName(), getId());
}

View File

@@ -21,6 +21,7 @@ import static org.junit.Assert.*;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.jpa.domain.AbstractPersistable;
import org.springframework.data.jpa.domain.sample.CustomAbstractPersistable;
import org.springframework.data.jpa.repository.sample.CustomAbstractPersistableRepository;
import org.springframework.test.context.ContextConfiguration;
@@ -28,12 +29,14 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.transaction.annotation.Transactional;
/**
* Integration tests for {@link AbstractPersistable}.
*
* @author Thomas Darimont
*/
@Transactional
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath:config/namespace-autoconfig-context.xml" })
public class CustomAbstractPersistableIntegrationTests {
public class AbstractPersistableIntegrationTests {
@Autowired CustomAbstractPersistableRepository repository;
@@ -45,10 +48,8 @@ public class CustomAbstractPersistableIntegrationTests {
CustomAbstractPersistable entity = new CustomAbstractPersistable();
CustomAbstractPersistable saved = repository.save(entity);
CustomAbstractPersistable found = repository.findOne(saved.getId());
assertThat(found, is(saved));
}
}

View File

@@ -13,6 +13,7 @@
<class>org.springframework.data.jpa.domain.sample.Child</class>
<class>org.springframework.data.jpa.domain.sample.ConcreteType1</class>
<class>org.springframework.data.jpa.domain.sample.ConcreteType2</class>
<class>org.springframework.data.jpa.domain.sample.CustomAbstractPersistable</class>
<class>org.springframework.data.jpa.domain.sample.Customer</class>
<class>org.springframework.data.jpa.domain.sample.EmbeddedIdExampleEmployeePK</class>
<class>org.springframework.data.jpa.domain.sample.EmbeddedIdExampleEmployee</class>
@@ -35,15 +36,14 @@
<class>org.springframework.data.jpa.domain.sample.SpecialUser</class>
<class>org.springframework.data.jpa.domain.sample.User</class>
<class>org.springframework.data.jpa.domain.sample.VersionedUser</class>
<class>org.springframework.data.jpa.domain.sample.CustomAbstractPersistable</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
</persistence-unit>
<persistence-unit name="querydsl">
<class>org.springframework.data.jpa.domain.sample.CustomAbstractPersistable</class>
<class>org.springframework.data.jpa.domain.sample.MailMessage</class>
<class>org.springframework.data.jpa.domain.sample.MailSender</class>
<class>org.springframework.data.jpa.domain.sample.MailUser</class>
<class>org.springframework.data.jpa.domain.sample.User</class>
<class>org.springframework.data.jpa.domain.sample.CustomAbstractPersistable</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
</persistence-unit>
<persistence-unit name="cdi">
@@ -80,12 +80,12 @@
<persistence-unit name="metadata">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>org.springframework.data.jpa.domain.sample.User</class>
<class>org.springframework.data.jpa.domain.sample.CustomAbstractPersistable</class>
<class>org.springframework.data.jpa.domain.sample.MailMessage</class>
<class>org.springframework.data.jpa.domain.sample.MailSender</class>
<class>org.springframework.data.jpa.domain.sample.MailUser</class>
<class>org.springframework.data.jpa.domain.sample.User</class>
<class>org.springframework.data.jpa.repository.support.JpaMetamodelEntityInformationIntegrationTests$Sample</class>
<class>org.springframework.data.jpa.domain.sample.CustomAbstractPersistable</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect" />
@@ -93,22 +93,22 @@
</persistence-unit>
<persistence-unit name="metadata_el">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<class>org.springframework.data.jpa.domain.sample.User</class>
<class>org.springframework.data.jpa.domain.sample.CustomAbstractPersistable</class>
<class>org.springframework.data.jpa.domain.sample.MailMessage</class>
<class>org.springframework.data.jpa.domain.sample.MailSender</class>
<class>org.springframework.data.jpa.domain.sample.MailUser</class>
<class>org.springframework.data.jpa.domain.sample.User</class>
<class>org.springframework.data.jpa.repository.support.JpaMetamodelEntityInformationIntegrationTests$Sample</class>
<class>org.springframework.data.jpa.domain.sample.CustomAbstractPersistable</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
</persistence-unit>
<persistence-unit name="metadata_oj">
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
<class>org.springframework.data.jpa.domain.sample.User</class>
<class>org.springframework.data.jpa.domain.sample.CustomAbstractPersistable</class>
<class>org.springframework.data.jpa.domain.sample.MailMessage</class>
<class>org.springframework.data.jpa.domain.sample.MailSender</class>
<class>org.springframework.data.jpa.domain.sample.MailUser</class>
<class>org.springframework.data.jpa.domain.sample.User</class>
<class>org.springframework.data.jpa.repository.support.JpaMetamodelEntityInformationIntegrationTests$Sample</class>
<class>org.springframework.data.jpa.domain.sample.CustomAbstractPersistable</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property name="openjpa.jdbc.DBDictionary" value="hsql" />

View File

@@ -6,24 +6,26 @@
<class>org.springframework.data.jpa.domain.sample.AnnotatedAuditableUser</class>
<class>org.springframework.data.jpa.domain.sample.AuditableRole</class>
<class>org.springframework.data.jpa.domain.sample.AuditableUser</class>
<class>org.springframework.data.jpa.domain.sample.User</class>
<class>org.springframework.data.jpa.domain.sample.SpecialUser</class>
<class>org.springframework.data.jpa.domain.sample.Role</class>
<class>org.springframework.data.jpa.domain.sample.CustomAbstractPersistable</class>
<class>org.springframework.data.jpa.domain.sample.MailMessage</class>
<class>org.springframework.data.jpa.domain.sample.MailSender</class>
<class>org.springframework.data.jpa.domain.sample.MailUser</class>
<class>org.springframework.data.jpa.domain.sample.Role</class>
<class>org.springframework.data.jpa.domain.sample.SpecialUser</class>
<class>org.springframework.data.jpa.domain.sample.User</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
</persistence-unit>
<persistence-unit name="second">
<class>org.springframework.data.jpa.domain.sample.User</class>
<class>org.springframework.data.jpa.domain.sample.SpecialUser</class>
<class>org.springframework.data.jpa.domain.sample.Role</class>
<class>org.springframework.data.jpa.domain.sample.AnnotatedAuditableUser</class>
<class>org.springframework.data.jpa.domain.sample.AuditableUser</class>
<class>org.springframework.data.jpa.domain.sample.AuditableRole</class>
<class>org.springframework.data.jpa.domain.sample.CustomAbstractPersistable</class>
<class>org.springframework.data.jpa.domain.sample.MailMessage</class>
<class>org.springframework.data.jpa.domain.sample.MailSender</class>
<class>org.springframework.data.jpa.domain.sample.MailUser</class>
<class>org.springframework.data.jpa.domain.sample.Role</class>
<class>org.springframework.data.jpa.domain.sample.SpecialUser</class>
<class>org.springframework.data.jpa.domain.sample.User</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
</persistence-unit>
</persistence>