HHH-7187 - New Envers base test classes

This commit is contained in:
Lukasz Antoniak 2012-04-18 22:09:13 +02:00 committed by Strong Liu
parent 7e6815c80c
commit c7aa99d0d3
211 changed files with 1198 additions and 857 deletions

View File

@ -30,7 +30,7 @@ package org.hibernate.envers.synchronization.work;
*/
public interface WorkUnitMergeDispatcher {
/**
* Shuold be invoked on the second work unit.
* Should be invoked on the second work unit.
* @param first First work unit (that is, the one added earlier).
* @return The work unit that is the result of the merge.
*/

View File

@ -1,99 +0,0 @@
package org.hibernate.envers.test;
import java.net.URISyntaxException;
import org.hibernate.dialect.Dialect;
import org.junit.Before;
import org.hibernate.MappingException;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Environment;
import org.hibernate.envers.AuditReader;
import org.hibernate.envers.AuditReaderFactory;
import org.hibernate.service.ServiceRegistry;
import org.hibernate.testing.AfterClassOnce;
import org.hibernate.testing.BeforeClassOnce;
import org.hibernate.testing.ServiceRegistryBuilder;
/**
* Base class for testing envers with Session.
*
* @author Hernán Chanfreau
* @author Lukasz Antoniak (lukasz dot antoniak at gmail dot com)
*/
public abstract class AbstractSessionTest extends AbstractEnversTest {
public static final Dialect DIALECT = Dialect.getDialect();
protected Configuration config;
private ServiceRegistry serviceRegistry;
private SessionFactory sessionFactory;
private Session session ;
private AuditReader auditReader;
protected static Dialect getDialect() {
return DIALECT;
}
@BeforeClassOnce
public void init() throws URISyntaxException {
config = new Configuration();
if ( createSchema() ) {
config.setProperty( Environment.HBM2DDL_AUTO, "create-drop" );
config.setProperty( Environment.USE_NEW_ID_GENERATOR_MAPPINGS, "true" );
config.setProperty("org.hibernate.envers.use_enhanced_revision_entity", "true");
}
String auditStrategy = getAuditStrategy();
if (auditStrategy != null && !"".equals(auditStrategy)) {
config.setProperty("org.hibernate.envers.audit_strategy", auditStrategy);
}
this.initMappings();
serviceRegistry = ServiceRegistryBuilder.buildServiceRegistry( config.getProperties() );
sessionFactory = config.buildSessionFactory( serviceRegistry );
}
protected boolean createSchema() {
return true;
}
protected abstract void initMappings() throws MappingException, URISyntaxException ;
private SessionFactory getSessionFactory(){
return sessionFactory;
}
@Before
public void newSessionFactory() {
session = getSessionFactory().openSession();
auditReader = AuditReaderFactory.get(session);
}
@AfterClassOnce
public void closeSessionFactory() {
try {
sessionFactory.close();
}
finally {
if ( serviceRegistry != null ) {
ServiceRegistryBuilder.destroy( serviceRegistry );
serviceRegistry = null;
}
}
}
protected Session getSession() {
return session;
}
protected Configuration getCfg() {
return config;
}
protected AuditReader getAuditReader() {
return auditReader;
}
}

View File

@ -0,0 +1,60 @@
package org.hibernate.envers.test;
import java.util.Arrays;
import java.util.List;
import org.hibernate.cfg.Configuration;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.hibernate.Session;
import org.hibernate.envers.AuditReader;
import org.hibernate.envers.AuditReaderFactory;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
/**
* @author Strong Liu (stliu@hibernate.org)
*/
@RunWith(EnversRunner.class)
public abstract class BaseEnversFunctionalTestCase extends BaseCoreFunctionalTestCase {
private String auditStrategy;
@Parameterized.Parameters
public static List<Object[]> data() {
return Arrays.asList(
new Object[] { null },
new Object[] { "org.hibernate.envers.strategy.ValidityAuditStrategy" }
);
}
public void setTestData(Object[] data) {
auditStrategy = (String) data[0];
}
public String getAuditStrategy() {
return auditStrategy;
}
protected Session getSession() {
if ( session == null || !session.isOpen() ) {
return openSession();
}
return session;
}
protected AuditReader getAuditReader(){
return AuditReaderFactory.get( getSession() );
}
@Override
protected Configuration constructConfiguration() {
Configuration configuration = super.constructConfiguration();
configuration.setProperty("org.hibernate.envers.use_enhanced_revision_entity", "true");
return configuration;
}
@Override
protected String getBaseForMappings() {
return "";
}
}

View File

@ -0,0 +1,285 @@
package org.hibernate.envers.test;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.transaction.SystemException;
import org.jboss.logging.Logger;
import org.junit.After;
import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Environment;
import org.hibernate.dialect.Dialect;
import org.hibernate.ejb.AvailableSettings;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.ejb.EntityManagerFactoryImpl;
import org.hibernate.engine.transaction.internal.jta.JtaStatusHelper;
import org.hibernate.envers.AuditReader;
import org.hibernate.envers.AuditReaderFactory;
import org.hibernate.envers.event.EnversIntegrator;
import org.hibernate.internal.SessionFactoryImpl;
import org.hibernate.internal.util.StringHelper;
import org.hibernate.service.BootstrapServiceRegistryBuilder;
import org.hibernate.service.ServiceRegistryBuilder;
import org.hibernate.service.internal.StandardServiceRegistryImpl;
import org.hibernate.testing.AfterClassOnce;
import org.hibernate.testing.BeforeClassOnce;
import org.hibernate.testing.jta.TestingJtaBootstrap;
/**
* @author Strong Liu (stliu@hibernate.org)
*/
public abstract class BaseEnversJPAFunctionalTestCase extends AbstractEnversTest {
private static final Logger log = Logger.getLogger( BaseEnversJPAFunctionalTestCase.class );
private static final Dialect dialect = Dialect.getDialect();
protected Ejb3Configuration ejb3Configuration;
private StandardServiceRegistryImpl serviceRegistry;
private EntityManagerFactoryImpl entityManagerFactory;
private EntityManager em;
private AuditReader auditReader;
private ArrayList<EntityManager> isolatedEms = new ArrayList<EntityManager>();
protected Dialect getDialect() {
return dialect;
}
protected EntityManagerFactory entityManagerFactory() {
return entityManagerFactory;
}
protected StandardServiceRegistryImpl serviceRegistry() {
return serviceRegistry;
}
protected Configuration getCfg(){
return ejb3Configuration.getHibernateConfiguration();
}
@BeforeClassOnce
@SuppressWarnings({ "UnusedDeclaration" })
public void buildEntityManagerFactory() throws Exception {
log.trace( "Building session factory" );
ejb3Configuration = buildConfiguration();
ejb3Configuration.configure( getConfig() );
configure(ejb3Configuration);
afterConfigurationBuilt( ejb3Configuration );
entityManagerFactory = (EntityManagerFactoryImpl) ejb3Configuration.buildEntityManagerFactory(
bootstrapRegistryBuilder()
);
serviceRegistry = (StandardServiceRegistryImpl) ( (SessionFactoryImpl) entityManagerFactory.getSessionFactory() )
.getServiceRegistry()
.getParentServiceRegistry();
afterEntityManagerFactoryBuilt();
}
public void configure(Ejb3Configuration cfg) {
}
private BootstrapServiceRegistryBuilder bootstrapRegistryBuilder() {
return new BootstrapServiceRegistryBuilder();
}
protected Ejb3Configuration buildConfiguration() {
Ejb3Configuration ejb3Cfg = constructConfiguration();
addMappings( ejb3Cfg.getHibernateConfiguration() );
return ejb3Cfg;
}
protected Ejb3Configuration constructConfiguration() {
Ejb3Configuration ejb3Configuration = new Ejb3Configuration();
if ( createSchema() ) {
ejb3Configuration.getHibernateConfiguration().setProperty( Environment.HBM2DDL_AUTO, "create-drop" );
}
if ( StringHelper.isNotEmpty( getAuditStrategy() ) ) {
ejb3Configuration.getHibernateConfiguration().setProperty(
"org.hibernate.envers.audit_strategy",
getAuditStrategy()
);
}
if (!isAudit()){
ejb3Configuration.getHibernateConfiguration().setProperty( EnversIntegrator.AUTO_REGISTER, "false" );
}
ejb3Configuration
.getHibernateConfiguration()
.setProperty( org.hibernate.cfg.AvailableSettings.USE_NEW_ID_GENERATOR_MAPPINGS, "true" );
ejb3Configuration
.getHibernateConfiguration()
.setProperty( "org.hibernate.envers.use_enhanced_revision_entity", "true" );
ejb3Configuration
.getHibernateConfiguration()
.setProperty( Environment.DIALECT, getDialect().getClass().getName() );
return ejb3Configuration;
}
protected void addMappings(Configuration configuration) {
String[] mappings = getMappings();
if ( mappings != null ) {
for ( String mapping : mappings ) {
configuration.addResource( mapping, getClass().getClassLoader() );
}
}
}
protected static final String[] NO_MAPPINGS = new String[0];
protected String[] getMappings() {
return NO_MAPPINGS;
}
protected Map getConfig() {
Map<Object, Object> config = new HashMap<Object, Object>();
ArrayList<Class> classes = new ArrayList<Class>();
classes.addAll( Arrays.asList( getAnnotatedClasses() ) );
config.put( AvailableSettings.LOADED_CLASSES, classes );
for ( Map.Entry<Class, String> entry : getCachedClasses().entrySet() ) {
config.put( AvailableSettings.CLASS_CACHE_PREFIX + "." + entry.getKey().getName(), entry.getValue() );
}
for ( Map.Entry<String, String> entry : getCachedCollections().entrySet() ) {
config.put( AvailableSettings.COLLECTION_CACHE_PREFIX + "." + entry.getKey(), entry.getValue() );
}
if ( getEjb3DD().length > 0 ) {
ArrayList<String> dds = new ArrayList<String>();
dds.addAll( Arrays.asList( getEjb3DD() ) );
config.put( AvailableSettings.XML_FILE_NAMES, dds );
}
addConfigOptions( config );
return config;
}
protected void addConfigOptions(Map options) {
}
protected static final Class<?>[] NO_CLASSES = new Class[0];
protected Class<?>[] getAnnotatedClasses() {
return NO_CLASSES;
}
public Map<Class, String> getCachedClasses() {
return new HashMap<Class, String>();
}
public Map<String, String> getCachedCollections() {
return new HashMap<String, String>();
}
public String[] getEjb3DD() {
return new String[] { };
}
@SuppressWarnings({ "UnusedParameters" })
protected void afterConfigurationBuilt(Ejb3Configuration ejb3Configuration) {
}
@SuppressWarnings({ "UnusedParameters" })
protected void applyServices(ServiceRegistryBuilder registryBuilder) {
}
protected void afterEntityManagerFactoryBuilt() {
}
protected boolean createSchema() {
return true;
}
protected boolean isAudit() {
return true;
}
@AfterClassOnce
public void releaseEntityManagerFactory(){
if ( entityManagerFactory != null && entityManagerFactory.isOpen() ) {
entityManagerFactory.close();
}
}
@After
@SuppressWarnings({ "UnusedDeclaration" })
public void releaseUnclosedEntityManagers() {
releaseUnclosedEntityManager( this.em );
auditReader =null;
for ( EntityManager isolatedEm : isolatedEms ) {
releaseUnclosedEntityManager( isolatedEm );
}
}
private void releaseUnclosedEntityManager(EntityManager em) {
if ( em == null ) {
return;
}
if ( !em.isOpen() ) {
em = null;
return;
}
if ( JtaStatusHelper.isActive( TestingJtaBootstrap.INSTANCE.getTransactionManager() ) ) {
log.warn( "Cleaning up unfinished transaction" );
try {
TestingJtaBootstrap.INSTANCE.getTransactionManager().rollback();
}
catch (SystemException ignored) {
}
}
try{
if ( em.getTransaction().isActive() ) {
em.getTransaction().rollback();
log.warn( "You left an open transaction! Fix your test case. For now, we are closing it for you." );
}
}
catch ( IllegalStateException e ) {
}
if ( em.isOpen() ) {
// as we open an EM before the test runs, it will still be open if the test uses a custom EM.
// or, the person may have forgotten to close. So, do not raise a "fail", but log the fact.
em.close();
log.warn( "The EntityManager is not closed. Closing it." );
}
}
protected EntityManager getEntityManager(){
return getOrCreateEntityManager();
}
protected EntityManager getOrCreateEntityManager() {
if ( em == null || !em.isOpen() ) {
em = entityManagerFactory.createEntityManager();
}
return em;
}
protected AuditReader getAuditReader(){
if(auditReader!=null){
return auditReader;
}
return auditReader = AuditReaderFactory.get( getOrCreateEntityManager() );
}
protected EntityManager createIsolatedEntityManager() {
EntityManager isolatedEm = entityManagerFactory.createEntityManager();
isolatedEms.add( isolatedEm );
return isolatedEm;
}
protected EntityManager createIsolatedEntityManager(Map props) {
EntityManager isolatedEm = entityManagerFactory.createEntityManager( props );
isolatedEms.add( isolatedEm );
return isolatedEm;
}
protected EntityManager createEntityManager(Map properties) {
// always reopen a new EM and close the existing one
if ( em != null && em.isOpen() ) {
em.close();
}
em = entityManagerFactory.createEntityManager( properties );
return em;
}
}

View File

@ -43,8 +43,12 @@ public class EnversRunner extends Suite {
@Override
protected Object getTestInstance() throws Exception {
Object testInstance = super.getTestInstance();
((AbstractEnversTest) testInstance).setTestData(computeParams());
if ( AbstractEnversTest.class.isInstance( testInstance ) ) {
( (AbstractEnversTest) testInstance ).setTestData( computeParams() );
}
else if ( BaseEnversFunctionalTestCase.class.isInstance( testInstance ) ) {
( (BaseEnversFunctionalTestCase) testInstance ).setTestData( computeParams() );
}
return testInstance;
}

View File

@ -0,0 +1,77 @@
package org.hibernate.envers.test.entities;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import org.hibernate.envers.Audited;
/**
* Duplicate of {@link IntTestEntity} but with private sequence generator.
* @author Lukasz Antoniak (lukasz dot antoniak at gmail dot com)
*/
@Entity
public class IntTestPrivSeqEntity {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "IntTestPrivSeq")
@SequenceGenerator(name = "IntTestPrivSeq", sequenceName="INTTESTPRIV_SEQ",
allocationSize = 1, initialValue = 1)
private Integer id;
@Audited
@Column(name = "NUMERIC_VALUE")
private Integer number;
public IntTestPrivSeqEntity() {
}
public IntTestPrivSeqEntity(Integer number, Integer id) {
this.id = id;
this.number = number;
}
public IntTestPrivSeqEntity(Integer number) {
this.number = number;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getNumber() {
return number;
}
public void setNumber(Integer number) {
this.number = number;
}
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof IntTestPrivSeqEntity)) return false;
IntTestPrivSeqEntity that = (IntTestPrivSeqEntity) o;
if (id != null ? !id.equals(that.id) : that.id != null) return false;
if (number != null ? !number.equals(that.number) : that.number != null) return false;
return true;
}
public int hashCode() {
int result = (id != null ? id.hashCode() : 0);
result = 31 * result + (number != null ? number.hashCode() : 0);
return result;
}
public String toString() {
return "ITPSE(id = " + id + ", number = " + number + ")";
}
}

View File

@ -0,0 +1,78 @@
package org.hibernate.envers.test.entities;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import org.hibernate.envers.Audited;
/**
* Duplicate of {@link StrTestEntity} but with private sequence generator.
* @author Lukasz Antoniak (lukasz dot antoniak at gmail dot com)
*/
@Entity
@Table(name = "STRSEQ")
public class StrTestPrivSeqEntity {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "StrTestPrivSeq")
@SequenceGenerator(name = "StrTestPrivSeq", sequenceName="STRTESTPRIV_SEQ",
allocationSize = 1, initialValue = 1)
private Integer id;
@Audited
private String str;
public StrTestPrivSeqEntity() {
}
public StrTestPrivSeqEntity(String str, Integer id) {
this.str = str;
this.id = id;
}
public StrTestPrivSeqEntity(String str) {
this.str = str;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getStr() {
return str;
}
public void setStr(String str) {
this.str = str;
}
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof StrTestPrivSeqEntity)) return false;
StrTestPrivSeqEntity that = (StrTestPrivSeqEntity) o;
if (id != null ? !id.equals(that.id) : that.id != null) return false;
if (str != null ? !str.equals(that.str) : that.str != null) return false;
return true;
}
public int hashCode() {
int result;
result = (id != null ? id.hashCode() : 0);
result = 31 * result + (str != null ? str.hashCode() : 0);
return result;
}
public String toString() {
return "STPSE(id = " + id + ", str = " + str + ")";
}
}

View File

@ -31,13 +31,13 @@ import org.junit.Assert;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class FieldAccessType extends AbstractEntityTest {
public class FieldAccessType extends BaseEnversJPAFunctionalTestCase {
private Integer id1;
public void configure(Ejb3Configuration cfg) {

View File

@ -6,12 +6,12 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
import static org.junit.Assert.assertEquals;
public class ImmutableClassAccessType extends AbstractEntityTest {
public class ImmutableClassAccessType extends BaseEnversJPAFunctionalTestCase {
private Country country;
public void configure(Ejb3Configuration cfg) {

View File

@ -29,13 +29,13 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class MixedAccessType extends AbstractEntityTest {
public class MixedAccessType extends BaseEnversJPAFunctionalTestCase {
private Integer id1;
public void configure(Ejb3Configuration cfg) {

View File

@ -29,13 +29,13 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class PropertyAccessType extends AbstractEntityTest {
public class PropertyAccessType extends BaseEnversJPAFunctionalTestCase {
private Integer id1;
public void configure(Ejb3Configuration cfg) {

View File

@ -30,7 +30,7 @@ import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.exception.NotAuditedException;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
/**
@ -38,7 +38,7 @@ import org.hibernate.envers.test.Priority;
*
* @author Hernan Chanfreau
*/
public class AuditReaderAPITest extends AbstractEntityTest {
public class AuditReaderAPITest extends BaseEnversJPAFunctionalTestCase {
public void configure(Ejb3Configuration cfg) {
cfg.addAnnotatedClass(AuditedTestEntity.class);
cfg.addAnnotatedClass(NotAuditedTestEntity.class);

View File

@ -7,7 +7,7 @@ import org.junit.Assert;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
import org.hibernate.mapping.Column;
import org.hibernate.mapping.Table;
@ -17,7 +17,7 @@ import org.hibernate.testing.TestForIssue;
* @author Lukasz Antoniak (lukasz dot antoniak at gmail dot com)
*/
@TestForIssue(jiraKey = "HHH-7003")
public class ColumnScalePrecisionTest extends AbstractEntityTest {
public class ColumnScalePrecisionTest extends BaseEnversJPAFunctionalTestCase {
private Table auditTable = null;
private Table originalTable = null;
private Long id = null;

View File

@ -29,13 +29,13 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase ;
import org.hibernate.envers.test.Priority;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class Delete extends AbstractEntityTest {
public class Delete extends BaseEnversJPAFunctionalTestCase {
private Integer id1;
private Integer id2;
private Integer id3;

View File

@ -29,13 +29,13 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class GlobalVersioned extends AbstractEntityTest {
public class GlobalVersioned extends BaseEnversJPAFunctionalTestCase {
private Integer id1;
public void configure(Ejb3Configuration cfg) {

View File

@ -29,13 +29,13 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class ManyOperationsInTransaction extends AbstractEntityTest {
public class ManyOperationsInTransaction extends BaseEnversJPAFunctionalTestCase {
private Integer id1;
private Integer id2;
private Integer id3;

View File

@ -31,22 +31,17 @@ import org.junit.Assert;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.mapping.PersistentClass;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class NoneAudited extends AbstractEntityTest {
public class NoneAudited extends BaseEnversJPAFunctionalTestCase {
public void configure(Ejb3Configuration cfg) {
cfg.addAnnotatedClass(BasicTestEntity3.class);
}
@Override
public void newEntityManager() {
// The AuditReader shouldn't be created
}
@Test
public void testRevisionInfoTableNotCreated() {
@SuppressWarnings({"unchecked"}) List<PersistentClass> pcs = iteratorToList(getCfg().getClassMappings());

View File

@ -29,13 +29,13 @@ import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.exception.NotAuditedException;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class NotVersioned extends AbstractEntityTest {
public class NotVersioned extends BaseEnversJPAFunctionalTestCase {
private Integer id1;
public void configure(Ejb3Configuration cfg) {

View File

@ -29,13 +29,13 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class NullProperties extends AbstractEntityTest {
public class NullProperties extends BaseEnversJPAFunctionalTestCase {
private Integer id1;
private Integer id2;

View File

@ -29,14 +29,14 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
import org.hibernate.envers.test.entities.IntTestEntity;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class Simple extends AbstractEntityTest {
public class Simple extends BaseEnversJPAFunctionalTestCase {
private Integer id1;
public void configure(Ejb3Configuration cfg) {

View File

@ -30,13 +30,13 @@ import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.exception.RevisionDoesNotExistException;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class SingleOperationInTransaction extends AbstractEntityTest {
public class SingleOperationInTransaction extends BaseEnversJPAFunctionalTestCase {
private Integer id1;
private Integer id2;
private Integer id3;

View File

@ -29,13 +29,13 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class UnversionedPropertiesChange extends AbstractEntityTest {
public class UnversionedPropertiesChange extends BaseEnversJPAFunctionalTestCase {
private Integer id1;
public void configure(Ejb3Configuration cfg) {

View File

@ -29,14 +29,14 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase ;
import org.hibernate.envers.test.Priority;
import org.hibernate.envers.test.entities.UnversionedEntity;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class UnversionedProperty extends AbstractEntityTest {
public class UnversionedProperty extends BaseEnversJPAFunctionalTestCase {
private Integer id1;
public void configure(Ejb3Configuration cfg) {

View File

@ -28,7 +28,7 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
import org.hibernate.envers.test.entities.onetomany.SetRefEdEntity;
import org.hibernate.envers.test.entities.onetomany.SetRefIngEntity;
@ -37,7 +37,7 @@ import org.hibernate.envers.test.entities.onetomany.SetRefIngEntity;
* @author Adam Warski (adam at warski dot org)
*/
@SuppressWarnings({"ObjectEquality"})
public class OneToManyCache extends AbstractEntityTest {
public class OneToManyCache extends BaseEnversJPAFunctionalTestCase {
private Integer ed1_id;
private Integer ed2_id;

View File

@ -28,7 +28,7 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
import org.hibernate.envers.test.integration.onetoone.bidirectional.BiRefEdEntity;
import org.hibernate.envers.test.integration.onetoone.bidirectional.BiRefIngEntity;
@ -37,7 +37,7 @@ import org.hibernate.envers.test.integration.onetoone.bidirectional.BiRefIngEnti
* @author Adam Warski (adam at warski dot org)
*/
@SuppressWarnings({"ObjectEquality"})
public class OneToOneCache extends AbstractEntityTest {
public class OneToOneCache extends BaseEnversJPAFunctionalTestCase {
private Integer ed1_id;
private Integer ed2_id;
@ -79,8 +79,6 @@ public class OneToOneCache extends AbstractEntityTest {
em.getTransaction().commit();
//
ed1_id = ed1.getId();
ed2_id = ed2.getId();

View File

@ -29,7 +29,7 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
import org.hibernate.envers.test.entities.IntTestEntity;
@ -37,7 +37,7 @@ import org.hibernate.envers.test.entities.IntTestEntity;
* @author Adam Warski (adam at warski dot org)
*/
@SuppressWarnings({"ObjectEquality"})
public class QueryCache extends AbstractEntityTest {
public class QueryCache extends BaseEnversJPAFunctionalTestCase {
private Integer id1;
public void configure(Ejb3Configuration cfg) {

View File

@ -29,7 +29,7 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase ;
import org.hibernate.envers.test.Priority;
import org.hibernate.envers.test.entities.collection.EnumSetEntity;
import org.hibernate.envers.test.entities.collection.EnumSetEntity.E1;
@ -39,7 +39,7 @@ import org.hibernate.envers.test.tools.TestTools;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class EnumSet extends AbstractEntityTest {
public class EnumSet extends BaseEnversJPAFunctionalTestCase {
private Integer sse1_id;
public void configure(Ejb3Configuration cfg) {

View File

@ -30,7 +30,7 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
import org.hibernate.envers.test.entities.collection.StringListEntity;
import org.hibernate.envers.test.tools.TestTools;
@ -38,7 +38,7 @@ import org.hibernate.envers.test.tools.TestTools;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class StringList extends AbstractEntityTest {
public class StringList extends BaseEnversJPAFunctionalTestCase {
private Integer sle1_id;
private Integer sle2_id;

View File

@ -30,7 +30,7 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
import org.hibernate.envers.test.entities.collection.StringMapEntity;
import org.hibernate.envers.test.tools.TestTools;
@ -38,7 +38,7 @@ import org.hibernate.envers.test.tools.TestTools;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class StringMap extends AbstractEntityTest {
public class StringMap extends BaseEnversJPAFunctionalTestCase {
private Integer sme1_id;
private Integer sme2_id;

View File

@ -30,7 +30,7 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
import org.hibernate.envers.test.entities.collection.StringSetEntity;
import org.hibernate.envers.test.tools.TestTools;
@ -38,7 +38,7 @@ import org.hibernate.envers.test.tools.TestTools;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class StringSet extends AbstractEntityTest {
public class StringSet extends BaseEnversJPAFunctionalTestCase {
private Integer sse1_id;
private Integer sse2_id;

View File

@ -29,7 +29,7 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
import org.hibernate.envers.test.entities.components.Component1;
import org.hibernate.envers.test.entities.components.Component2;
@ -39,7 +39,7 @@ import org.hibernate.envers.test.tools.TestTools;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class ComponentMapKey extends AbstractEntityTest {
public class ComponentMapKey extends BaseEnversJPAFunctionalTestCase {
private Integer cmke_id;
private Integer cte1_id;

View File

@ -29,7 +29,7 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
import org.hibernate.envers.test.entities.StrTestEntity;
import org.hibernate.envers.test.tools.TestTools;
@ -37,7 +37,7 @@ import org.hibernate.envers.test.tools.TestTools;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class IdMapKey extends AbstractEntityTest {
public class IdMapKey extends BaseEnversJPAFunctionalTestCase {
private Integer imke_id;
private Integer ste1_id;

View File

@ -1,22 +1,24 @@
package org.hibernate.envers.test.integration.collection.norevision;
import java.net.URISyntaxException;
import java.util.List;
import org.hibernate.Session;
import org.hibernate.cfg.Configuration;
import org.hibernate.envers.test.BaseEnversFunctionalTestCase;
import org.hibernate.envers.test.Priority;
import org.junit.Test;
import org.hibernate.MappingException;
import org.hibernate.envers.test.AbstractSessionTest;
import org.hibernate.envers.test.Priority;
import java.util.List;
public abstract class AbstractCollectionChangeTest extends AbstractSessionTest {
public abstract class AbstractCollectionChangeTest extends BaseEnversFunctionalTestCase {
protected Integer personId;
@Override
protected void initMappings() throws MappingException, URISyntaxException {
config.addAnnotatedClass(Person.class);
config.addAnnotatedClass(Name.class);
config.setProperty("org.hibernate.envers.revision_on_collection_change", getCollectionChangeValue());
protected void configure(Configuration configuration) {
configuration.setProperty("org.hibernate.envers.revision_on_collection_change", getCollectionChangeValue());
}
@Override
protected Class<?>[] getAnnotatedClasses() {
return new Class[]{Person.class, Name.class};
}
protected abstract String getCollectionChangeValue();
@ -26,29 +28,29 @@ public abstract class AbstractCollectionChangeTest extends AbstractSessionTest {
@Test
@Priority(10)
public void initData() {
newSessionFactory();
Session session = openSession();
// Rev 1
getSession().getTransaction().begin();
session.getTransaction().begin();
Person p = new Person();
Name n = new Name();
n.setName("name1");
p.getNames().add(n);
getSession().saveOrUpdate(p);
getSession().getTransaction().commit();
session.saveOrUpdate(p);
session.getTransaction().commit();
// Rev 2
getSession().getTransaction().begin();
session.getTransaction().begin();
n.setName("Changed name");
getSession().saveOrUpdate(p);
getSession().getTransaction().commit();
session.saveOrUpdate(p);
session.getTransaction().commit();
// Rev 3
getSession().getTransaction().begin();
session.getTransaction().begin();
Name n2 = new Name();
n2.setName("name2");
p.getNames().add(n2);
getSession().getTransaction().commit();
session.getTransaction().commit();
personId = p.getId();
}

View File

@ -29,7 +29,7 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase ;
import org.hibernate.envers.test.Priority;
import org.hibernate.envers.test.entities.components.Component1;
import org.hibernate.envers.test.entities.components.Component2;
@ -38,7 +38,7 @@ import org.hibernate.envers.test.entities.components.ComponentTestEntity;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class Components extends AbstractEntityTest {
public class Components extends BaseEnversJPAFunctionalTestCase {
private Integer id1;
private Integer id2;
private Integer id3;

View File

@ -30,7 +30,7 @@ import org.jboss.logging.Logger;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
import org.hibernate.envers.test.entities.components.DefaultValueComponent1;
import org.hibernate.envers.test.entities.components.DefaultValueComponent2;
@ -45,7 +45,7 @@ import org.hibernate.envers.test.entities.components.DefaultValueComponentTestEn
*
* @author Erik-Berndt Scheper
*/
public class DefaultValueComponents extends AbstractEntityTest {
public class DefaultValueComponents extends BaseEnversJPAFunctionalTestCase {
private static final Logger log = Logger.getLogger( DefaultValueComponents.class );
private Integer id0;

View File

@ -4,11 +4,12 @@ import java.io.File;
import java.net.URISyntaxException;
import java.net.URL;
import org.hibernate.Session;
import org.junit.Assert;
import org.junit.Test;
import org.hibernate.MappingException;
import org.hibernate.envers.test.AbstractSessionTest;
import org.hibernate.envers.test.BaseEnversFunctionalTestCase;
import org.hibernate.envers.test.Priority;
import org.hibernate.envers.test.entities.components.UniquePropsEntity;
import org.hibernate.envers.test.entities.components.UniquePropsNotAuditedEntity;
@ -20,42 +21,44 @@ import org.hibernate.testing.TestForIssue;
* @author Lukasz Antoniak (lukasz dot antoniak at gmail dot com)
*/
@TestForIssue(jiraKey = "HHH-6636")
public class PropertiesGroupTest extends AbstractSessionTest {
public class PropertiesGroupTest extends BaseEnversFunctionalTestCase {
private PersistentClass uniquePropsAudit = null;
private PersistentClass uniquePropsNotAuditedAudit = null;
private UniquePropsEntity entityRev1 = null;
private UniquePropsNotAuditedEntity entityNotAuditedRev2 = null;
protected void initMappings() throws MappingException, URISyntaxException {
URL url = Thread.currentThread().getContextClassLoader().getResource("mappings/components/UniquePropsEntity.hbm.xml");
config.addFile(new File(url.toURI()));
url = Thread.currentThread().getContextClassLoader().getResource("mappings/components/UniquePropsNotAuditedEntity.hbm.xml");
config.addFile(new File(url.toURI()));
@Override
protected String[] getMappings() {
return new String[] {
"mappings/components/UniquePropsEntity.hbm.xml",
"mappings/components/UniquePropsNotAuditedEntity.hbm.xml"
};
}
@Test
@Priority(10)
public void initData() {
uniquePropsAudit = getCfg().getClassMapping("org.hibernate.envers.test.entities.components.UniquePropsEntity_AUD");
uniquePropsNotAuditedAudit = getCfg().getClassMapping("org.hibernate.envers.test.entities.components.UniquePropsNotAuditedEntity_AUD");
uniquePropsAudit = configuration().getClassMapping("org.hibernate.envers.test.entities.components.UniquePropsEntity_AUD");
uniquePropsNotAuditedAudit = configuration().getClassMapping("org.hibernate.envers.test.entities.components.UniquePropsNotAuditedEntity_AUD");
// Revision 1
getSession().getTransaction().begin();
Session session = openSession();
session.getTransaction().begin();
UniquePropsEntity ent = new UniquePropsEntity();
ent.setData1("data1");
ent.setData2("data2");
getSession().persist(ent);
getSession().getTransaction().commit();
session.persist(ent);
session.getTransaction().commit();
entityRev1 = new UniquePropsEntity(ent.getId(), ent.getData1(), ent.getData2());
// Revision 2
getSession().getTransaction().begin();
session.getTransaction().begin();
UniquePropsNotAuditedEntity entNotAud = new UniquePropsNotAuditedEntity();
entNotAud.setData1("data3");
entNotAud.setData2("data4");
getSession().persist(entNotAud);
getSession().getTransaction().commit();
session.persist(entNotAud);
session.getTransaction().commit();
entityNotAuditedRev2 = new UniquePropsNotAuditedEntity(entNotAud.getId(), entNotAud.getData1(), null);
}

View File

@ -31,7 +31,7 @@ import org.junit.Ignore;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
import org.hibernate.envers.test.entities.components.Component1;
import org.hibernate.envers.test.entities.components.ComponentSetTestEntity;
@ -41,7 +41,7 @@ import org.hibernate.envers.test.entities.components.ComponentSetTestEntity;
* @author Adam Warski (adam at warski dot org)
*/
@Ignore
public class CollectionOfComponents extends AbstractEntityTest {
public class CollectionOfComponents extends BaseEnversJPAFunctionalTestCase {
private Integer id1;
public void configure(Ejb3Configuration cfg) {

View File

@ -29,7 +29,7 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase ;
import org.hibernate.envers.test.Priority;
import org.hibernate.envers.test.entities.StrTestEntity;
import org.hibernate.envers.test.entities.components.relations.ManyToOneComponent;
@ -38,14 +38,15 @@ import org.hibernate.envers.test.entities.components.relations.ManyToOneComponen
/**
* @author Adam Warski (adam at warski dot org)
*/
public class ManyToOneInComponent extends AbstractEntityTest {
public class ManyToOneInComponent extends BaseEnversJPAFunctionalTestCase {
private Integer mtocte_id1;
private Integer ste_id1;
private Integer ste_id2;
public void configure(Ejb3Configuration cfg) {
cfg.addAnnotatedClass(ManyToOneComponentTestEntity.class);
cfg.addAnnotatedClass(StrTestEntity.class);
@Override
protected Class<?>[] getAnnotatedClasses() {
return new Class[]{ManyToOneComponentTestEntity.class, StrTestEntity.class};
}
@Test

View File

@ -29,7 +29,7 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
import org.hibernate.envers.test.entities.UnversionedStrTestEntity;
import org.hibernate.envers.test.entities.components.relations.NotAuditedManyToOneComponent;
@ -38,7 +38,7 @@ import org.hibernate.envers.test.entities.components.relations.NotAuditedManyToO
/**
* @author Adam Warski (adam at warski dot org)
*/
public class NotAuditedManyToOneInComponent extends AbstractEntityTest {
public class NotAuditedManyToOneInComponent extends BaseEnversJPAFunctionalTestCase {
private Integer mtocte_id1;
public void configure(Ejb3Configuration cfg) {

View File

@ -29,7 +29,7 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase ;
import org.hibernate.envers.test.Priority;
import org.hibernate.envers.test.entities.StrTestEntity;
import org.hibernate.envers.test.entities.components.relations.OneToManyComponent;
@ -38,7 +38,7 @@ import org.hibernate.envers.test.entities.components.relations.OneToManyComponen
/**
* @author Adam Warski (adam at warski dot org)
*/
public class OneToManyInComponent extends AbstractEntityTest {
public class OneToManyInComponent extends BaseEnversJPAFunctionalTestCase {
private Integer otmcte_id1;
private Integer ste_id1;
private Integer ste_id2;

View File

@ -29,7 +29,7 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
import org.hibernate.envers.test.entities.customtype.Component;
import org.hibernate.envers.test.entities.customtype.CompositeCustomTypeEntity;
@ -37,7 +37,7 @@ import org.hibernate.envers.test.entities.customtype.CompositeCustomTypeEntity;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class CompositeCustom extends AbstractEntityTest {
public class CompositeCustom extends BaseEnversJPAFunctionalTestCase {
private Integer ccte_id;
public void configure(Ejb3Configuration cfg) {

View File

@ -29,14 +29,14 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
import org.hibernate.envers.test.entities.customtype.ParametrizedCustomTypeEntity;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class ParametrizedCustom extends AbstractEntityTest {
public class ParametrizedCustom extends BaseEnversJPAFunctionalTestCase {
private Integer pcte_id;
public void configure(Ejb3Configuration cfg) {

View File

@ -31,13 +31,13 @@ import org.junit.Assert;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class Dates extends AbstractEntityTest {
public class Dates extends BaseEnversJPAFunctionalTestCase {
private Integer id1;
public void configure(Ejb3Configuration cfg) {

View File

@ -29,13 +29,13 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class Enums extends AbstractEntityTest {
public class Enums extends BaseEnversJPAFunctionalTestCase {
private Integer id1;
public void configure(Ejb3Configuration cfg) {
@ -57,8 +57,6 @@ public class Enums extends AbstractEntityTest {
ete.setEnum1(EnumTestEntity.E1.Y);
ete.setEnum2(EnumTestEntity.E2.B);
em.getTransaction().commit();
newEntityManager();
}
@Test

View File

@ -24,14 +24,14 @@
package org.hibernate.envers.test.integration.data;
import java.util.Arrays;
import java.util.Properties;
import java.util.Map;
import javax.persistence.EntityManager;
import org.hibernate.dialect.PostgreSQL82Dialect;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.testing.DialectChecks;
import org.hibernate.testing.RequiresDialectFeature;
@ -39,7 +39,7 @@ import org.hibernate.testing.RequiresDialectFeature;
* @author Adam Warski (adam at warski dot org)
*/
@RequiresDialectFeature(DialectChecks.SupportsExpectedLobUsagePattern.class)
public class LobSerializables extends AbstractEntityTest {
public class LobSerializables extends BaseEnversJPAFunctionalTestCase {
private Integer id1;
public void configure(Ejb3Configuration cfg) {
@ -47,11 +47,11 @@ public class LobSerializables extends AbstractEntityTest {
}
@Override
public void addConfigurationProperties(Properties configuration) {
super.addConfigurationProperties(configuration);
protected void addConfigOptions(Map options) {
super.addConfigOptions(options);
if (getDialect() instanceof PostgreSQL82Dialect) {
// In PostgreSQL LOBs cannot be used in auto-commit mode.
configuration.setProperty("hibernate.connection.autocommit", "false");
options.put("hibernate.connection.autocommit", "false");
}
}

View File

@ -24,14 +24,14 @@
package org.hibernate.envers.test.integration.data;
import java.util.Arrays;
import java.util.Properties;
import java.util.Map;
import javax.persistence.EntityManager;
import org.hibernate.dialect.PostgreSQL82Dialect;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
import org.hibernate.testing.DialectChecks;
import org.hibernate.testing.RequiresDialectFeature;
@ -40,7 +40,7 @@ import org.hibernate.testing.RequiresDialectFeature;
* @author Adam Warski (adam at warski dot org)
*/
@RequiresDialectFeature(DialectChecks.SupportsExpectedLobUsagePattern.class)
public class Lobs extends AbstractEntityTest {
public class Lobs extends BaseEnversJPAFunctionalTestCase {
private Integer id1;
public void configure(Ejb3Configuration cfg) {
@ -48,11 +48,11 @@ public class Lobs extends AbstractEntityTest {
}
@Override
public void addConfigurationProperties(Properties configuration) {
super.addConfigurationProperties(configuration);
protected void addConfigOptions(Map options) {
super.addConfigOptions(options);
if (getDialect() instanceof PostgreSQL82Dialect) {
// In PostgreSQL LOBs cannot be used in auto-commit mode.
configuration.setProperty("hibernate.connection.autocommit", "false");
options.put("hibernate.connection.autocommit", "false");
}
}

View File

@ -29,13 +29,13 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class Serializables extends AbstractEntityTest {
public class Serializables extends BaseEnversJPAFunctionalTestCase {
private Integer id1;
public void configure(Ejb3Configuration cfg) {

View File

@ -31,13 +31,13 @@ import org.junit.Before;
import org.hibernate.FlushMode;
import org.hibernate.Session;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.entities.StrTestEntity;
/**
* @author Adam Warski (adam at warski dot org)
*/
public abstract class AbstractFlushTest extends AbstractEntityTest {
public abstract class AbstractFlushTest extends BaseEnversJPAFunctionalTestCase {
public abstract FlushMode getFlushMode();
public void configure(Ejb3Configuration cfg) {

View File

@ -1,20 +1,17 @@
package org.hibernate.envers.test.integration.flush;
import java.util.Properties;
import org.hibernate.FlushMode;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.testing.TestForIssue;
import java.util.Map;
/**
* @author Lukasz Antoniak (lukasz dot antoniak at gmail dot com)
*/
@TestForIssue(jiraKey = "HHH-7017")
public class ManualFlushAutoCommitDisabled extends ManualFlush {
@Override
public void addConfigurationProperties(Properties configuration) {
super.addConfigurationProperties( configuration );
configuration.setProperty("hibernate.connection.autocommit", "false");
}
@Override
protected void addConfigOptions(Map options) {
super.addConfigOptions(options);
options.put("hibernate.connection.autocommit", "false");
}
}

View File

@ -29,14 +29,14 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
import org.hibernate.envers.test.tools.TestTools;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class ChangingHashcode extends AbstractEntityTest {
public class ChangingHashcode extends BaseEnversJPAFunctionalTestCase {
private Long pageId;
private Long imageId;

View File

@ -29,8 +29,7 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
import org.hibernate.envers.test.entities.ids.CompositeDateIdTestEntity;
import org.hibernate.envers.test.entities.ids.DateEmbId;
@ -38,11 +37,12 @@ import org.hibernate.envers.test.entities.ids.DateEmbId;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class CompositeDateId extends AbstractEntityTest {
public class CompositeDateId extends BaseEnversJPAFunctionalTestCase {
private DateEmbId id1;
public void configure(Ejb3Configuration cfg) {
cfg.addAnnotatedClass(CompositeDateIdTestEntity.class);
@Override
protected Class<?>[] getAnnotatedClasses() {
return new Class[]{CompositeDateIdTestEntity.class};
}
@Test

View File

@ -29,7 +29,7 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
import org.hibernate.envers.test.entities.ids.CustomEnum;
import org.hibernate.envers.test.entities.ids.EmbId;
@ -42,7 +42,7 @@ import org.hibernate.envers.test.entities.ids.MulIdTestEntity;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class CompositeIds extends AbstractEntityTest {
public class CompositeIds extends BaseEnversJPAFunctionalTestCase {
private EmbId id1;
private EmbId id2;
private MulId id3;

View File

@ -30,14 +30,14 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
import org.hibernate.envers.test.entities.ids.DateIdTestEntity;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class DateId extends AbstractEntityTest {
public class DateId extends BaseEnversJPAFunctionalTestCase {
private Date id1;
public void configure(Ejb3Configuration cfg) {

View File

@ -5,7 +5,7 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
import org.hibernate.envers.test.entities.StrTestEntity;
import org.hibernate.envers.test.entities.UnversionedStrTestEntity;
@ -17,7 +17,7 @@ import org.hibernate.envers.test.entities.ids.ManyToOneNotAuditedEmbId;
* components in their ids, e.g. a many-to-one join to another entity.
* @author Adam Warski (adam at warski dot org)
*/
public class ManyToOneIdNotAudited extends AbstractEntityTest {
public class ManyToOneIdNotAudited extends BaseEnversJPAFunctionalTestCase {
private ManyToOneNotAuditedEmbId id1;
public void configure(Ejb3Configuration cfg) {

View File

@ -30,13 +30,13 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class ChildAuditing extends AbstractEntityTest {
public class ChildAuditing extends BaseEnversJPAFunctionalTestCase {
private Integer id1;
public void configure(Ejb3Configuration cfg) {

View File

@ -30,13 +30,13 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class ChildNullAuditing extends AbstractEntityTest {
public class ChildNullAuditing extends BaseEnversJPAFunctionalTestCase {
private Integer id1;
public void configure(Ejb3Configuration cfg) {

View File

@ -30,13 +30,13 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class ParentAuditing extends AbstractEntityTest {
public class ParentAuditing extends BaseEnversJPAFunctionalTestCase {
private Integer id1;
public void configure(Ejb3Configuration cfg) {

View File

@ -30,14 +30,14 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
import org.hibernate.envers.test.tools.TestTools;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class ChildReferencing extends AbstractEntityTest {
public class ChildReferencing extends BaseEnversJPAFunctionalTestCase {
private Integer re_id1;
private Integer re_id2;
private Integer c_id;

View File

@ -30,13 +30,13 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class EmptyChildAuditing extends AbstractEntityTest {
public class EmptyChildAuditing extends BaseEnversJPAFunctionalTestCase {
private Integer id1;
public void configure(Ejb3Configuration cfg) {

View File

@ -30,14 +30,14 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
import org.hibernate.envers.test.tools.TestTools;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class NotOwnedBidirectional extends AbstractEntityTest {
public class NotOwnedBidirectional extends BaseEnversJPAFunctionalTestCase {
private Long pc_id;
private Long a1_id;
private Long a2_id;

View File

@ -31,7 +31,7 @@ import org.junit.Assert;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
import org.hibernate.envers.test.integration.inheritance.joined.ParentEntity;
import org.hibernate.mapping.Column;
@ -39,7 +39,7 @@ import org.hibernate.mapping.Column;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class ChildPrimaryKeyJoinAuditing extends AbstractEntityTest {
public class ChildPrimaryKeyJoinAuditing extends BaseEnversJPAFunctionalTestCase {
private Integer id1;
public void configure(Ejb3Configuration cfg) {

View File

@ -7,7 +7,7 @@ import org.junit.Assert;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
import org.hibernate.envers.test.tools.TestTools;
import org.hibernate.testing.TestForIssue;
@ -16,7 +16,7 @@ import org.hibernate.testing.TestForIssue;
* @author Lukasz Antoniak (lukasz dot antoniak at gmail dot com)
*/
@TestForIssue(jiraKey = "HHH-3843")
public class ParentReferencingChildTest extends AbstractEntityTest {
public class ParentReferencingChildTest extends BaseEnversJPAFunctionalTestCase {
Person expLukaszRev1 = null;
Role expAdminRev1 = null;

View File

@ -30,14 +30,14 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
import org.hibernate.envers.test.tools.TestTools;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class PolymorphicCollection extends AbstractEntityTest {
public class PolymorphicCollection extends BaseEnversJPAFunctionalTestCase {
private Integer ed_id1;
private Integer c_id;
private Integer p_id;

View File

@ -31,13 +31,13 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class UnidirectionalDoubleAbstract extends AbstractEntityTest {
public class UnidirectionalDoubleAbstract extends BaseEnversJPAFunctionalTestCase {
private Long cce1_id;
private Integer cse1_id;

View File

@ -5,7 +5,7 @@ import java.util.Arrays;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase ;
import org.hibernate.envers.test.Priority;
import org.hibernate.envers.test.integration.inheritance.mixed.entities.AbstractActivity;
import org.hibernate.envers.test.integration.inheritance.mixed.entities.AbstractCheckActivity;
@ -19,7 +19,7 @@ import static org.junit.Assert.assertEquals;
/**
* @author Michal Skowronek (mskowr at o2 pl)
*/
public class MixedInheritanceStrategiesEntityTest extends AbstractEntityTest {
public class MixedInheritanceStrategiesEntityTest extends BaseEnversJPAFunctionalTestCase {
private ActivityId id2;
private ActivityId id1;

View File

@ -29,13 +29,13 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class ChildAuditing extends AbstractEntityTest {
public class ChildAuditing extends BaseEnversJPAFunctionalTestCase {
private Integer id1;
public void configure(Ejb3Configuration cfg) {

View File

@ -29,13 +29,13 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class ParentAuditing extends AbstractEntityTest {
public class ParentAuditing extends BaseEnversJPAFunctionalTestCase {
private Integer id1;
public void configure(Ejb3Configuration cfg) {

View File

@ -29,14 +29,14 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
import org.hibernate.envers.test.tools.TestTools;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class ChildReferencing extends AbstractEntityTest {
public class ChildReferencing extends BaseEnversJPAFunctionalTestCase {
private Integer re_id1;
private Integer re_id2;
private Integer c_id;

View File

@ -9,7 +9,7 @@ import org.junit.Assert;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
import org.hibernate.mapping.Formula;
import org.hibernate.mapping.PersistentClass;
@ -17,7 +17,7 @@ import org.hibernate.mapping.PersistentClass;
/**
* @author Lukasz Antoniak (lukasz dot antoniak at gmail dot com)
*/
public class DiscriminatorFormulaTest extends AbstractEntityTest {
public class DiscriminatorFormulaTest extends BaseEnversJPAFunctionalTestCase {
private PersistentClass parentAudit = null;
private ChildEntity childVer1 = null;
private ChildEntity childVer2 = null;

View File

@ -30,14 +30,14 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
import org.hibernate.envers.test.tools.TestTools;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class NotOwnedBidirectional extends AbstractEntityTest {
public class NotOwnedBidirectional extends BaseEnversJPAFunctionalTestCase {
private Long pc_id;
private Long a1_id;
private Long a2_id;

View File

@ -29,14 +29,14 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
import org.hibernate.envers.test.tools.TestTools;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class PolymorphicCollection extends AbstractEntityTest {
public class PolymorphicCollection extends BaseEnversJPAFunctionalTestCase {
private Integer ed_id1;
private Integer c_id;
private Integer p_id;

View File

@ -30,13 +30,13 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class ChildAuditing extends AbstractEntityTest {
public class ChildAuditing extends BaseEnversJPAFunctionalTestCase {
private Integer id1;
public void configure(Ejb3Configuration cfg) {

View File

@ -30,13 +30,13 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class ParentAuditing extends AbstractEntityTest {
public class ParentAuditing extends BaseEnversJPAFunctionalTestCase {
private Integer id1;
public void configure(Ejb3Configuration cfg) {

View File

@ -30,14 +30,14 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
import org.hibernate.envers.test.tools.TestTools;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class ChildReferencing extends AbstractEntityTest {
public class ChildReferencing extends BaseEnversJPAFunctionalTestCase {
private Integer re_id1;
private Integer re_id2;
private Integer c_id;

View File

@ -30,14 +30,14 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
import org.hibernate.envers.test.tools.TestTools;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class NotOwnedBidirectional extends AbstractEntityTest {
public class NotOwnedBidirectional extends BaseEnversJPAFunctionalTestCase {
private Long pc_id;
private Long a1_id;
private Long a2_id;

View File

@ -30,14 +30,14 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
import org.hibernate.envers.test.tools.TestTools;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class PolymorphicCollection extends AbstractEntityTest {
public class PolymorphicCollection extends BaseEnversJPAFunctionalTestCase {
private Integer ed_id1;
private Integer c_id;
private Integer p_id;

View File

@ -29,13 +29,13 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class InterfacesComponents extends AbstractEntityTest {
public class InterfacesComponents extends BaseEnversJPAFunctionalTestCase {
private Integer id1;
public void configure(Ejb3Configuration cfg) {

View File

@ -7,14 +7,14 @@ import org.junit.Assert;
import org.junit.Test;
import org.hibernate.envers.exception.NotAuditedException;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
/**
* @author Hern<EFBFBD>n Chanfreau
* @author Adam Warski (adam at warski dot org)
*/
public abstract class AbstractAllAuditedTest extends AbstractEntityTest {
public abstract class AbstractAllAuditedTest extends BaseEnversJPAFunctionalTestCase {
private long ai_id;
private long nai_id;

View File

@ -1,23 +1,13 @@
package org.hibernate.envers.test.integration.interfaces.hbm.allAudited.joined;
import java.io.File;
import java.net.URISyntaxException;
import java.net.URL;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.integration.interfaces.hbm.allAudited.AbstractAllAuditedTest;
/**
* @author Hern<EFBFBD>n Chanfreau
*/
public class JoinedAllAuditedTest extends AbstractAllAuditedTest {
public void configure(Ejb3Configuration cfg) {
try {
URL url = Thread.currentThread().getContextClassLoader().getResource("mappings/interfaces/joinedAllAuditedMappings.hbm.xml");
cfg.addFile(new File(url.toURI()));
} catch (URISyntaxException e) {
e.printStackTrace();
}
@Override
protected String[] getMappings() {
return new String[]{"mappings/interfaces/joinedAllAuditedMappings.hbm.xml"};
}
}

View File

@ -1,24 +1,13 @@
package org.hibernate.envers.test.integration.interfaces.hbm.allAudited.subclass;
import java.io.File;
import java.net.URISyntaxException;
import java.net.URL;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.integration.interfaces.hbm.allAudited.AbstractAllAuditedTest;
/**
* @author Hern<EFBFBD>n Chanfreau
*/
public class SubclassAllAuditedTest extends AbstractAllAuditedTest {
public void configure(Ejb3Configuration cfg) {
try {
URL url = Thread.currentThread().getContextClassLoader().getResource("mappings/interfaces/subclassAllAuditedMappings.hbm.xml");
cfg.addFile(new File(url.toURI()));
} catch (URISyntaxException e) {
e.printStackTrace();
}
@Override
protected String[] getMappings() {
return new String[]{"mappings/interfaces/subclassAllAuditedMappings.hbm.xml"};
}
}

View File

@ -1,23 +1,13 @@
package org.hibernate.envers.test.integration.interfaces.hbm.allAudited.union;
import java.io.File;
import java.net.URISyntaxException;
import java.net.URL;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.integration.interfaces.hbm.allAudited.AbstractAllAuditedTest;
/**
* @author Hern<EFBFBD>n Chanfreau
*/
public class UnionAllAuditedTest extends AbstractAllAuditedTest {
public void configure(Ejb3Configuration cfg) {
try {
URL url = Thread.currentThread().getContextClassLoader().getResource("mappings/interfaces/unionAllAuditedMappings.hbm.xml");
cfg.addFile(new File(url.toURI()));
} catch (URISyntaxException e) {
e.printStackTrace();
}
@Override
protected String[] getMappings() {
return new String[]{"mappings/interfaces/unionAllAuditedMappings.hbm.xml"};
}
}

View File

@ -5,14 +5,14 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.envers.exception.NotAuditedException;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase ;
import org.hibernate.envers.test.Priority;
/**
* @author Hern<EFBFBD>n Chanfreau
*
*/
public abstract class AbstractPropertiesAuditedTest extends AbstractEntityTest {
public abstract class AbstractPropertiesAuditedTest extends BaseEnversJPAFunctionalTestCase {
private long ai_id;
private long nai_id;

View File

@ -5,14 +5,14 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.envers.exception.NotAuditedException;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
/**
* @author Hern<EFBFBD>n Chanfreau
*
*/
public abstract class AbstractPropertiesAudited2Test extends AbstractEntityTest {
public abstract class AbstractPropertiesAudited2Test extends BaseEnversJPAFunctionalTestCase {
private long ai_id;
private long nai_id;

View File

@ -29,13 +29,13 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class InterfacesRelation extends AbstractEntityTest {
public class InterfacesRelation extends BaseEnversJPAFunctionalTestCase {
private Integer ed1_id;
private Integer ed2_id;

View File

@ -23,7 +23,7 @@
*/
package org.hibernate.envers.test.integration.jta;
import java.util.Properties;
import java.util.Map;
import javax.persistence.EntityManager;
import javax.transaction.RollbackException;
@ -31,7 +31,7 @@ import org.junit.Assert;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
import org.hibernate.envers.test.entities.StrTestEntity;
import org.hibernate.envers.test.integration.reventity.ExceptionListenerRevEntity;
@ -42,16 +42,15 @@ import org.hibernate.testing.jta.TestingJtaBootstrap;
* Same as {@link org.hibernate.envers.test.integration.reventity.ExceptionListener}, but in a JTA environment.
* @author Adam Warski (adam at warski dot org)
*/
public class JtaExceptionListener extends AbstractEntityTest {
public class JtaExceptionListener extends BaseEnversJPAFunctionalTestCase {
public void configure(Ejb3Configuration cfg) {
cfg.addAnnotatedClass(StrTestEntity.class);
cfg.addAnnotatedClass(ExceptionListenerRevEntity.class);
}
@Override
public void addConfigurationProperties(Properties configuration) {
super.addConfigurationProperties(configuration);
TestingJtaBootstrap.prepare( configuration );
protected void addConfigOptions(Map options) {
TestingJtaBootstrap.prepare(options);
}
@Test(expected = RollbackException.class)
@ -60,7 +59,6 @@ public class JtaExceptionListener extends AbstractEntityTest {
TestingJtaBootstrap.INSTANCE.getTransactionManager().begin();
try {
newEntityManager();
EntityManager em = getEntityManager();
// Trying to persist an entity - however the listener should throw an exception, so the entity
@ -78,7 +76,6 @@ public class JtaExceptionListener extends AbstractEntityTest {
try {
// Checking if the entity became persisted
newEntityManager();
EntityManager em = getEntityManager();
long count = em.createQuery("from StrTestEntity s where s.str = 'x'").getResultList().size();
Assert.assertEquals( 0, count );

View File

@ -2,33 +2,31 @@ package org.hibernate.envers.test.integration.jta;
import javax.persistence.EntityManager;
import java.util.Arrays;
import java.util.Properties;
import java.util.Map;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
import org.hibernate.envers.test.entities.IntTestEntity;
import org.junit.Test;
import org.hibernate.testing.FailureExpected;
import org.hibernate.testing.jta.TestingJtaBootstrap;
/**
* Same as {@link org.hibernate.envers.test.integration.basic.Simple}, but in a JTA environment.
* @author Adam Warski (adam at warski dot org)
*/
public class JtaTransaction extends AbstractEntityTest {
public class JtaTransaction extends BaseEnversJPAFunctionalTestCase {
private Integer id1;
public void configure(Ejb3Configuration cfg) {
cfg.addAnnotatedClass(IntTestEntity.class);
@Override
protected Class<?>[] getAnnotatedClasses() {
return new Class[]{IntTestEntity.class};
}
@Override
public void addConfigurationProperties(Properties configuration) {
super.addConfigurationProperties(configuration);
TestingJtaBootstrap.prepare( configuration );
protected void addConfigOptions(Map options) {
TestingJtaBootstrap.prepare(options);
}
@Test
@ -39,7 +37,6 @@ public class JtaTransaction extends AbstractEntityTest {
EntityManager em;
IntTestEntity ite;
try {
newEntityManager();
em = getEntityManager();
ite = new IntTestEntity(10);
em.persist(ite);
@ -47,19 +44,18 @@ public class JtaTransaction extends AbstractEntityTest {
} finally {
TestingJtaBootstrap.tryCommit();
}
//
em.close();
TestingJtaBootstrap.INSTANCE.getTransactionManager().begin();
try {
newEntityManager();
em = getEntityManager();
ite = em.find(IntTestEntity.class, id1);
ite.setNumber(20);
} finally {
TestingJtaBootstrap.tryCommit();
}
em.close();
}
@Test

View File

@ -31,7 +31,7 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
import org.hibernate.envers.test.entities.manytomany.ListOwnedEntity;
import org.hibernate.envers.test.entities.manytomany.ListOwningEntity;
@ -40,7 +40,7 @@ import org.hibernate.envers.test.tools.TestTools;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class BasicList extends AbstractEntityTest {
public class BasicList extends BaseEnversJPAFunctionalTestCase {
private Integer ed1_id;
private Integer ed2_id;

View File

@ -31,7 +31,7 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
import org.hibernate.envers.test.entities.manytomany.MapOwnedEntity;
import org.hibernate.envers.test.entities.manytomany.MapOwningEntity;
@ -40,7 +40,7 @@ import org.hibernate.envers.test.tools.TestTools;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class BasicMap extends AbstractEntityTest {
public class BasicMap extends BaseEnversJPAFunctionalTestCase {
private Integer ed1_id;
private Integer ed2_id;

View File

@ -31,7 +31,7 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase ;
import org.hibernate.envers.test.Priority;
import org.hibernate.envers.test.entities.manytomany.SetOwnedEntity;
import org.hibernate.envers.test.entities.manytomany.SetOwningEntity;
@ -40,7 +40,7 @@ import org.hibernate.envers.test.tools.TestTools;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class BasicSet extends AbstractEntityTest {
public class BasicSet extends BaseEnversJPAFunctionalTestCase {
private Integer ed1_id;
private Integer ed2_id;

View File

@ -29,7 +29,7 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
import org.hibernate.envers.test.entities.IntNoAutoIdTestEntity;
import org.hibernate.envers.test.entities.manytomany.WhereJoinTableEntity;
@ -40,7 +40,7 @@ import static org.junit.Assert.assertEquals;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class BasicWhereJoinTable extends AbstractEntityTest {
public class BasicWhereJoinTable extends BaseEnversJPAFunctionalTestCase {
private Integer ite1_1_id;
private Integer ite1_2_id;
private Integer ite2_1_id;

View File

@ -33,7 +33,7 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
import org.hibernate.envers.test.entities.StrTestEntity;
import org.hibernate.envers.test.entities.StrTestEntityComparator;
@ -44,7 +44,7 @@ import static org.junit.Assert.assertEquals;
/**
* @author Michal Skowronek (mskowr at o2 pl)
*/
public class CustomComparatorEntityTest extends AbstractEntityTest {
public class CustomComparatorEntityTest extends BaseEnversJPAFunctionalTestCase {
private Integer id1;
private Integer id2;

View File

@ -29,7 +29,7 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
import org.hibernate.envers.test.entities.manytomany.biowned.ListBiowning1Entity;
import org.hibernate.envers.test.entities.manytomany.biowned.ListBiowning2Entity;
@ -40,7 +40,7 @@ import static org.junit.Assert.assertEquals;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class BasicBiowned extends AbstractEntityTest {
public class BasicBiowned extends BaseEnversJPAFunctionalTestCase {
private Integer o1_1_id;
private Integer o1_2_id;
private Integer o2_1_id;

View File

@ -9,7 +9,7 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase ;
import org.hibernate.envers.test.Priority;
/**
@ -17,7 +17,7 @@ import org.hibernate.envers.test.Priority;
*
*/
public class ManyToManyInverseToSuperclassTest extends AbstractEntityTest {
public class ManyToManyInverseToSuperclassTest extends BaseEnversJPAFunctionalTestCase {
private long m1_id;

View File

@ -33,7 +33,7 @@ import org.junit.Test;
import org.hibernate.Session;
import org.hibernate.dialect.PostgreSQL82Dialect;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase ;
import org.hibernate.envers.test.Priority;
import org.hibernate.envers.test.entities.manytomany.sametable.Child1Entity;
import org.hibernate.envers.test.entities.manytomany.sametable.Child2Entity;
@ -44,7 +44,7 @@ import org.hibernate.envers.test.tools.TestTools;
* Test which checks that auditing entities which contain multiple mappings to same tables work.
* @author Adam Warski (adam at warski dot org)
*/
public class BasicSametable extends AbstractEntityTest {
public class BasicSametable extends BaseEnversJPAFunctionalTestCase {
private Integer p1_id;
private Integer p2_id;
private Integer c1_1_id;

View File

@ -30,16 +30,16 @@ import org.junit.Assert;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
import org.hibernate.envers.test.entities.IntTestEntity;
import org.hibernate.envers.test.entities.StrTestEntity;
import org.hibernate.envers.test.entities.IntTestPrivSeqEntity;
import org.hibernate.envers.test.entities.StrTestPrivSeqEntity;
import org.hibernate.envers.test.tools.TestTools;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class TernaryMap extends AbstractEntityTest {
public class TernaryMap extends BaseEnversJPAFunctionalTestCase {
private Integer str1_id;
private Integer str2_id;
@ -51,8 +51,8 @@ public class TernaryMap extends AbstractEntityTest {
public void configure(Ejb3Configuration cfg) {
cfg.addAnnotatedClass(TernaryMapEntity.class);
cfg.addAnnotatedClass(StrTestEntity.class);
cfg.addAnnotatedClass(IntTestEntity.class);
cfg.addAnnotatedClass(StrTestPrivSeqEntity.class);
cfg.addAnnotatedClass(IntTestPrivSeqEntity.class);
}
@Test
@ -60,11 +60,11 @@ public class TernaryMap extends AbstractEntityTest {
public void initData() {
EntityManager em = getEntityManager();
StrTestEntity str1 = new StrTestEntity("a");
StrTestEntity str2 = new StrTestEntity("b");
StrTestPrivSeqEntity str1 = new StrTestPrivSeqEntity("a");
StrTestPrivSeqEntity str2 = new StrTestPrivSeqEntity("b");
IntTestEntity int1 = new IntTestEntity(1);
IntTestEntity int2 = new IntTestEntity(2);
IntTestPrivSeqEntity int1 = new IntTestPrivSeqEntity(1);
IntTestPrivSeqEntity int2 = new IntTestPrivSeqEntity(2);
TernaryMapEntity map1 = new TernaryMapEntity();
TernaryMapEntity map2 = new TernaryMapEntity();
@ -91,11 +91,11 @@ public class TernaryMap extends AbstractEntityTest {
map1 = em.find(TernaryMapEntity.class, map1.getId());
map2 = em.find(TernaryMapEntity.class, map2.getId());
str1 = em.find(StrTestEntity.class, str1.getId());
str2 = em.find(StrTestEntity.class, str2.getId());
str1 = em.find(StrTestPrivSeqEntity.class, str1.getId());
str2 = em.find(StrTestPrivSeqEntity.class, str2.getId());
int1 = em.find(IntTestEntity.class, int1.getId());
int2 = em.find(IntTestEntity.class, int2.getId());
int1 = em.find(IntTestPrivSeqEntity.class, int1.getId());
int2 = em.find(IntTestPrivSeqEntity.class, int2.getId());
map1.getMap().put(int1, str2);
@ -110,10 +110,10 @@ public class TernaryMap extends AbstractEntityTest {
map1 = em.find(TernaryMapEntity.class, map1.getId());
map2 = em.find(TernaryMapEntity.class, map2.getId());
str2 = em.find(StrTestEntity.class, str2.getId());
str2 = em.find(StrTestPrivSeqEntity.class, str2.getId());
int1 = em.find(IntTestEntity.class, int1.getId());
int2 = em.find(IntTestEntity.class, int2.getId());
int1 = em.find(IntTestPrivSeqEntity.class, int1.getId());
int2 = em.find(IntTestPrivSeqEntity.class, int2.getId());
map1.getMap().remove(int2);
map1.getMap().put(int1, str2);
@ -128,10 +128,10 @@ public class TernaryMap extends AbstractEntityTest {
map1 = em.find(TernaryMapEntity.class, map1.getId());
map2 = em.find(TernaryMapEntity.class, map2.getId());
str2 = em.find(StrTestEntity.class, str2.getId());
str2 = em.find(StrTestPrivSeqEntity.class, str2.getId());
int1 = em.find(IntTestEntity.class, int1.getId());
int2 = em.find(IntTestEntity.class, int2.getId());
int1 = em.find(IntTestPrivSeqEntity.class, int1.getId());
int2 = em.find(IntTestPrivSeqEntity.class, int2.getId());
map1.getMap().put(int2, str2);
@ -155,20 +155,20 @@ public class TernaryMap extends AbstractEntityTest {
assert Arrays.asList(1, 2, 4).equals(getAuditReader().getRevisions(TernaryMapEntity.class, map1_id));
assert Arrays.asList(1, 2, 3, 4).equals(getAuditReader().getRevisions(TernaryMapEntity.class, map2_id));
assert Arrays.asList(1).equals(getAuditReader().getRevisions(StrTestEntity.class, str1_id));
assert Arrays.asList(1).equals(getAuditReader().getRevisions(StrTestEntity.class, str2_id));
assert Arrays.asList(1).equals(getAuditReader().getRevisions(StrTestPrivSeqEntity.class, str1_id));
assert Arrays.asList(1).equals(getAuditReader().getRevisions(StrTestPrivSeqEntity.class, str2_id));
assert Arrays.asList(1).equals(getAuditReader().getRevisions(IntTestEntity.class, int1_id));
assert Arrays.asList(1).equals(getAuditReader().getRevisions(IntTestEntity.class, int2_id));
assert Arrays.asList(1).equals(getAuditReader().getRevisions(IntTestPrivSeqEntity.class, int1_id));
assert Arrays.asList(1).equals(getAuditReader().getRevisions(IntTestPrivSeqEntity.class, int2_id));
}
@Test
public void testHistoryOfMap1() {
StrTestEntity str1 = getEntityManager().find(StrTestEntity.class, str1_id);
StrTestEntity str2 = getEntityManager().find(StrTestEntity.class, str2_id);
StrTestPrivSeqEntity str1 = getEntityManager().find(StrTestPrivSeqEntity.class, str1_id);
StrTestPrivSeqEntity str2 = getEntityManager().find(StrTestPrivSeqEntity.class, str2_id);
IntTestEntity int1 = getEntityManager().find(IntTestEntity.class, int1_id);
IntTestEntity int2 = getEntityManager().find(IntTestEntity.class, int2_id);
IntTestPrivSeqEntity int1 = getEntityManager().find(IntTestPrivSeqEntity.class, int1_id);
IntTestPrivSeqEntity int2 = getEntityManager().find(IntTestPrivSeqEntity.class, int2_id);
TernaryMapEntity rev1 = getAuditReader().find(TernaryMapEntity.class, map1_id, 1);
TernaryMapEntity rev2 = getAuditReader().find(TernaryMapEntity.class, map1_id, 2);
@ -183,11 +183,11 @@ public class TernaryMap extends AbstractEntityTest {
@Test
public void testHistoryOfMap2() {
StrTestEntity str1 = getEntityManager().find(StrTestEntity.class, str1_id);
StrTestEntity str2 = getEntityManager().find(StrTestEntity.class, str2_id);
StrTestPrivSeqEntity str1 = getEntityManager().find(StrTestPrivSeqEntity.class, str1_id);
StrTestPrivSeqEntity str2 = getEntityManager().find(StrTestPrivSeqEntity.class, str2_id);
IntTestEntity int1 = getEntityManager().find(IntTestEntity.class, int1_id);
IntTestEntity int2 = getEntityManager().find(IntTestEntity.class, int2_id);
IntTestPrivSeqEntity int1 = getEntityManager().find(IntTestPrivSeqEntity.class, int1_id);
IntTestPrivSeqEntity int2 = getEntityManager().find(IntTestPrivSeqEntity.class, int2_id);
TernaryMapEntity rev1 = getAuditReader().find(TernaryMapEntity.class, map2_id, 1);
TernaryMapEntity rev2 = getAuditReader().find(TernaryMapEntity.class, map2_id, 2);

View File

@ -30,8 +30,8 @@ import javax.persistence.Id;
import javax.persistence.ManyToMany;
import org.hibernate.envers.Audited;
import org.hibernate.envers.test.entities.IntTestEntity;
import org.hibernate.envers.test.entities.StrTestEntity;
import org.hibernate.envers.test.entities.IntTestPrivSeqEntity;
import org.hibernate.envers.test.entities.StrTestPrivSeqEntity;
/**
* @author Adam Warski (adam at warski dot org)
@ -45,10 +45,10 @@ public class TernaryMapEntity {
@Audited
@ManyToMany
@javax.persistence.MapKeyJoinColumn
private Map<IntTestEntity, StrTestEntity> map;
private Map<IntTestPrivSeqEntity, StrTestPrivSeqEntity> map;
public TernaryMapEntity() {
map = new HashMap<IntTestEntity, StrTestEntity>();
map = new HashMap<IntTestPrivSeqEntity, StrTestPrivSeqEntity>();
}
public Integer getId() {
@ -59,11 +59,11 @@ public class TernaryMapEntity {
this.id = id;
}
public Map<IntTestEntity, StrTestEntity> getMap() {
public Map<IntTestPrivSeqEntity, StrTestPrivSeqEntity> getMap() {
return map;
}
public void setMap(Map<IntTestEntity, StrTestEntity> map) {
public void setMap(Map<IntTestPrivSeqEntity, StrTestPrivSeqEntity> map) {
this.map = map;
}

View File

@ -30,10 +30,10 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
import org.hibernate.envers.test.entities.IntTestEntity;
import org.hibernate.envers.test.entities.StrTestEntity;
import org.hibernate.envers.test.entities.IntTestPrivSeqEntity;
import org.hibernate.envers.test.entities.StrTestPrivSeqEntity;
import org.hibernate.envers.test.tools.TestTools;
import static org.junit.Assert.assertEquals;
@ -41,7 +41,7 @@ import static org.junit.Assert.assertEquals;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class TernaryMapFlush extends AbstractEntityTest {
public class TernaryMapFlush extends BaseEnversJPAFunctionalTestCase {
private Integer str1_id;
private Integer str2_id;
private Integer int1_id;
@ -50,8 +50,8 @@ public class TernaryMapFlush extends AbstractEntityTest {
public void configure(Ejb3Configuration cfg) {
cfg.addAnnotatedClass(TernaryMapEntity.class);
cfg.addAnnotatedClass(StrTestEntity.class);
cfg.addAnnotatedClass(IntTestEntity.class);
cfg.addAnnotatedClass(StrTestPrivSeqEntity.class);
cfg.addAnnotatedClass(IntTestPrivSeqEntity.class);
}
@Test
@ -59,10 +59,10 @@ public class TernaryMapFlush extends AbstractEntityTest {
public void createData() {
EntityManager em = getEntityManager();
StrTestEntity str1 = new StrTestEntity("a");
StrTestEntity str2 = new StrTestEntity("b");
IntTestEntity int1 = new IntTestEntity(1);
IntTestEntity int2 = new IntTestEntity(2);
StrTestPrivSeqEntity str1 = new StrTestPrivSeqEntity("a");
StrTestPrivSeqEntity str2 = new StrTestPrivSeqEntity("b");
IntTestPrivSeqEntity int1 = new IntTestPrivSeqEntity(1);
IntTestPrivSeqEntity int2 = new IntTestPrivSeqEntity(2);
TernaryMapEntity map1 = new TernaryMapEntity();
// Revision 1 (int1 -> str1)
@ -84,10 +84,10 @@ public class TernaryMapFlush extends AbstractEntityTest {
em.getTransaction().begin();
map1 = em.find(TernaryMapEntity.class, map1.getId());
str1 = em.find(StrTestEntity.class, str1.getId());
int1 = em.find(IntTestEntity.class, int1.getId());
str1 = em.find(StrTestPrivSeqEntity.class, str1.getId());
int1 = em.find(IntTestPrivSeqEntity.class, int1.getId());
map1.setMap(new HashMap<IntTestEntity, StrTestEntity>());
map1.setMap(new HashMap<IntTestPrivSeqEntity, StrTestPrivSeqEntity>());
em.flush();
@ -101,8 +101,8 @@ public class TernaryMapFlush extends AbstractEntityTest {
em.getTransaction().begin();
map1 = em.find(TernaryMapEntity.class, map1.getId());
str1 = em.find(StrTestEntity.class, str1.getId());
int1 = em.find(IntTestEntity.class, int1.getId());
str1 = em.find(StrTestPrivSeqEntity.class, str1.getId());
int1 = em.find(IntTestPrivSeqEntity.class, int1.getId());
map1.getMap().remove(int1);
@ -124,18 +124,18 @@ public class TernaryMapFlush extends AbstractEntityTest {
@Test
public void testRevisionsCounts() {
assertEquals(Arrays.asList(1, 2, 3), getAuditReader().getRevisions(TernaryMapEntity.class, map1_id));
assertEquals(Arrays.asList(1), getAuditReader().getRevisions(StrTestEntity.class, str1_id));
assertEquals(Arrays.asList(1), getAuditReader().getRevisions(StrTestEntity.class, str2_id));
assertEquals(Arrays.asList(1) ,getAuditReader().getRevisions(IntTestEntity.class, int1_id));
assertEquals(Arrays.asList(1) ,getAuditReader().getRevisions(IntTestEntity.class, int2_id));
assertEquals(Arrays.asList(1), getAuditReader().getRevisions(StrTestPrivSeqEntity.class, str1_id));
assertEquals(Arrays.asList(1), getAuditReader().getRevisions(StrTestPrivSeqEntity.class, str2_id));
assertEquals(Arrays.asList(1) ,getAuditReader().getRevisions(IntTestPrivSeqEntity.class, int1_id));
assertEquals(Arrays.asList(1) ,getAuditReader().getRevisions(IntTestPrivSeqEntity.class, int2_id));
}
@Test
public void testHistoryOfMap1() {
StrTestEntity str1 = getEntityManager().find(StrTestEntity.class, str1_id);
StrTestEntity str2 = getEntityManager().find(StrTestEntity.class, str2_id);
IntTestEntity int1 = getEntityManager().find(IntTestEntity.class, int1_id);
IntTestEntity int2 = getEntityManager().find(IntTestEntity.class, int2_id);
StrTestPrivSeqEntity str1 = getEntityManager().find(StrTestPrivSeqEntity.class, str1_id);
StrTestPrivSeqEntity str2 = getEntityManager().find(StrTestPrivSeqEntity.class, str2_id);
IntTestPrivSeqEntity int1 = getEntityManager().find(IntTestPrivSeqEntity.class, int1_id);
IntTestPrivSeqEntity int2 = getEntityManager().find(IntTestPrivSeqEntity.class, int2_id);
TernaryMapEntity rev1 = getAuditReader().find(TernaryMapEntity.class, map1_id, 1);
TernaryMapEntity rev2 = getAuditReader().find(TernaryMapEntity.class, map1_id, 2);

View File

@ -31,7 +31,7 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
import org.hibernate.envers.test.entities.StrTestEntity;
import org.hibernate.envers.test.entities.manytomany.unidirectional.ListUniEntity;
@ -40,7 +40,7 @@ import org.hibernate.envers.test.tools.TestTools;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class BasicUniList extends AbstractEntityTest {
public class BasicUniList extends BaseEnversJPAFunctionalTestCase {
private Integer ed1_id;
private Integer ed2_id;

View File

@ -30,7 +30,7 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
import org.hibernate.envers.test.entities.StrTestEntity;
import org.hibernate.envers.test.entities.manytomany.unidirectional.MapUniEntity;
@ -39,7 +39,7 @@ import org.hibernate.envers.test.tools.TestTools;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class BasicUniMap extends AbstractEntityTest {
public class BasicUniMap extends BaseEnversJPAFunctionalTestCase {
private Integer str1_id;
private Integer str2_id;

View File

@ -31,7 +31,7 @@ import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
import org.hibernate.envers.test.entities.StrTestEntity;
import org.hibernate.envers.test.entities.manytomany.unidirectional.SetUniEntity;
@ -40,7 +40,7 @@ import org.hibernate.envers.test.tools.TestTools;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class BasicUniSet extends AbstractEntityTest {
public class BasicUniSet extends BaseEnversJPAFunctionalTestCase {
private Integer ed1_id;
private Integer ed2_id;

Some files were not shown because too many files have changed in this diff Show More