HHH-4063:

- removing unnecessary test

git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@18430 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
Adam Warski 2010-01-07 14:29:32 +00:00
parent 23a2e5b3dc
commit ae48c83a54
3 changed files with 0 additions and 249 deletions

View File

@ -1,84 +0,0 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.test.integration.superclass.auditedAtSuperclassLevel;
import java.util.Arrays;
import javax.persistence.EntityManager;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.test.AbstractEntityTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
/**
* @author Adam Warski (adam at warski dot org)
*
* @author Hernán Chanfreau
*
* Same test from package
* org.hibernate.envers.test.integration.superclass changing the Audited
* annotation in MappedSuperclass from property str to class level
*/
public class MappedSubclassing2 extends AbstractEntityTest {
private Integer id1;
public void configure(Ejb3Configuration cfg) {
cfg.addAnnotatedClass(SubclassEntity2.class);
}
@BeforeClass(dependsOnMethods = "init")
public void initData() {
// Revision 1
EntityManager em = getEntityManager();
em.getTransaction().begin();
SubclassEntity2 se1 = new SubclassEntity2("x");
em.persist(se1);
id1 = se1.getId();
em.getTransaction().commit();
// Revision 2
em.getTransaction().begin();
se1 = em.find(SubclassEntity2.class, id1);
se1.setStr("y");
em.getTransaction().commit();
}
@Test
public void testRevisionsCounts() {
assert Arrays.asList(1, 2).equals(
getAuditReader().getRevisions(SubclassEntity2.class, id1));
}
@Test
public void testHistoryOfId1() {
SubclassEntity2 ver1 = new SubclassEntity2(id1, "x");
SubclassEntity2 ver2 = new SubclassEntity2(id1, "y");
assert getAuditReader().find(SubclassEntity2.class, id1, 1)
.equals(ver1);
assert getAuditReader().find(SubclassEntity2.class, id1, 2)
.equals(ver2);
}
}

View File

@ -1,87 +0,0 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.test.integration.superclass.auditedAtSuperclassLevel;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
/**
* @author Adam Warski (adam at warski dot org)
*
* @author Hernán Chanfreau
*
* Same class from package
* org.hibernate.envers.test.integration.superclass changing the
* superclass to MappedSuperclass2
*/
@Entity
public class SubclassEntity2 extends SuperclassOfEntity2 {
@Id
@GeneratedValue
private Integer id;
public SubclassEntity2() {
}
public SubclassEntity2(Integer id, String str) {
super(str);
this.id = id;
}
public SubclassEntity2(String str) {
super(str);
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public boolean equals(Object o) {
if (this == o)
return true;
if (!(o instanceof SubclassEntity2))
return false;
if (!super.equals(o))
return false;
SubclassEntity2 that = (SubclassEntity2) o;
//noinspection RedundantIfStatement
if (id != null ? !id.equals(that.id) : that.id != null)
return false;
return true;
}
public int hashCode() {
int result = super.hashCode();
result = 31 * result + (id != null ? id.hashCode() : 0);
return result;
}
}

View File

@ -1,78 +0,0 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.test.integration.superclass.auditedAtSuperclassLevel;
import javax.persistence.MappedSuperclass;
import org.hibernate.envers.Audited;
/**
* @author Adam Warski (adam at warski dot org)
*
* @author Hernán Chanfreau
*
* Same class from package
* org.hibernate.envers.test.integration.superclass changing the Audited
* annotation from property str to class level
*/
@MappedSuperclass
@Audited
public class SuperclassOfEntity2 {
private String str;
public SuperclassOfEntity2() {
}
public SuperclassOfEntity2(String str) {
this.str = str;
}
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 SuperclassOfEntity2))
return false;
SuperclassOfEntity2 that = (SuperclassOfEntity2) o;
//noinspection RedundantIfStatement
if (str != null ? !str.equals(that.str) : that.str != null)
return false;
return true;
}
public int hashCode() {
return (str != null ? str.hashCode() : 0);
}
}