HHH-9193 : Default audit behavior of mapped-superclass (test cases)
(cherry picked from commit 95070f50a9
)
Conflicts:
hibernate-envers/src/test/java/org/hibernate/envers/test/integration/components/collections/mappedsuperclasselement/CollectionOfMappedSuperclassComponentsTest.java
hibernate-envers/src/test/java/org/hibernate/envers/test/integration/components/mappedsuperclass/EmbeddableWithDeclaredDataTest.java
hibernate-envers/src/test/java/org/hibernate/envers/test/integration/components/mappedsuperclass/EmbeddableWithNoDeclaredDataTest.java
This commit is contained in:
parent
9afc3d086f
commit
1f7d90de8b
|
@ -31,16 +31,16 @@ import org.junit.Test;
|
|||
|
||||
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
|
||||
import org.hibernate.envers.test.Priority;
|
||||
import org.hibernate.testing.FailureExpected;
|
||||
import org.hibernate.testing.FailureExpectedWithNewMetamodel;
|
||||
import org.hibernate.testing.TestForIssue;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* @author Gail Badner
|
||||
*/
|
||||
@TestForIssue( jiraKey = "HHH-8908" )
|
||||
@TestForIssue( jiraKey = "HHH-9193" )
|
||||
@FailureExpectedWithNewMetamodel( message = "Aggregate.getSuperType() returns null when it should return a MappedSuperclass")
|
||||
public class CollectionOfMappedSuperclassComponentsTest extends BaseEnversJPAFunctionalTestCase {
|
||||
private Integer id1;
|
||||
|
@ -86,6 +86,7 @@ public class CollectionOfMappedSuperclassComponentsTest extends BaseEnversJPAFun
|
|||
}
|
||||
|
||||
@Test
|
||||
@FailureExpected( jiraKey = "HHH-9193")
|
||||
public void testHistoryOfId1() {
|
||||
MappedSuperclassComponentSetTestEntity entity = getAuditReader().find(
|
||||
MappedSuperclassComponentSetTestEntity.class,
|
||||
|
@ -96,9 +97,15 @@ public class CollectionOfMappedSuperclassComponentsTest extends BaseEnversJPAFun
|
|||
assertEquals( 0, entity.getCompsNotAudited().size() );
|
||||
|
||||
entity = getAuditReader().find( MappedSuperclassComponentSetTestEntity.class, id1, 2 );
|
||||
|
||||
// TODO: what is the expectation here? The collection is audited, but the embeddable class
|
||||
// has no data and it extends a mapped-superclass that is not audited.
|
||||
// currently the collection has 1 element that has value AbstractCode.UNDEFINED
|
||||
// (which seems wrong). I changed the expected size to 0 which currently fails; is that what
|
||||
// should be expected?
|
||||
Set<Code> comps1 = entity.getComps();
|
||||
assertEquals( 1, comps1.size() );
|
||||
assertTrue( comps1.contains( new Code( 1 ) ) );
|
||||
assertEquals( 0, comps1.size() );
|
||||
|
||||
// The contents of entity.getCompsNotAudited() is unspecified, so no need to test.
|
||||
}
|
||||
}
|
|
@ -34,6 +34,7 @@ import org.hibernate.envers.AuditReader;
|
|||
import org.hibernate.envers.AuditReaderFactory;
|
||||
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
|
||||
import org.hibernate.envers.test.Priority;
|
||||
import org.hibernate.testing.FailureExpected;
|
||||
import org.hibernate.testing.FailureExpectedWithNewMetamodel;
|
||||
import org.hibernate.testing.TestForIssue;
|
||||
|
||||
|
@ -41,7 +42,7 @@ import org.hibernate.testing.TestForIssue;
|
|||
* @author Jakob Braeuchi.
|
||||
* @author Gail Badner
|
||||
*/
|
||||
@TestForIssue(jiraKey = "HHH-8908")
|
||||
@TestForIssue(jiraKey = "HHH-9193")
|
||||
@FailureExpectedWithNewMetamodel( message = "Aggregate.getSuperType() returns null when it should return a MappedSuperclass")
|
||||
public class EmbeddableWithDeclaredDataTest extends BaseEnversJPAFunctionalTestCase {
|
||||
private long id;
|
||||
|
@ -70,6 +71,7 @@ public class EmbeddableWithDeclaredDataTest extends BaseEnversJPAFunctionalTestC
|
|||
}
|
||||
|
||||
@Test
|
||||
@FailureExpected( jiraKey = "HHH-9193" )
|
||||
public void testEmbeddableThatExtendsMappedSuperclass() {
|
||||
|
||||
// Reload and Compare Revision
|
||||
|
@ -85,7 +87,9 @@ public class EmbeddableWithDeclaredDataTest extends BaseEnversJPAFunctionalTestC
|
|||
|
||||
Assert.assertEquals( entityLoaded.getName(), entityRev1.getName() );
|
||||
|
||||
// value is read from AUD Table
|
||||
Assert.assertEquals( entityLoaded.getValue(), entityRev1.getValue() );
|
||||
// only value.codeArt should be audited because it is the only audited field in EmbeddableWithDeclaredData;
|
||||
// fields in AbstractEmbeddable should not be audited.
|
||||
Assert.assertEquals( entityLoaded.getValue().getCodeart(), entityRev1.getValue().getCodeart() );
|
||||
Assert.assertNull( entityRev1.getValue().getCode() );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
package org.hibernate.envers.test.integration.components.mappedsuperclass;
|
||||
|
||||
import javax.persistence.Embeddable;
|
||||
import javax.persistence.Transient;
|
||||
|
||||
/**
|
||||
* @author Jakob Braeuchi.
|
||||
|
|
|
@ -41,7 +41,7 @@ import org.hibernate.testing.TestForIssue;
|
|||
* @author Jakob Braeuchi.
|
||||
* @author Gail Badner
|
||||
*/
|
||||
@TestForIssue(jiraKey = "HHH-8908")
|
||||
@TestForIssue(jiraKey = "HHH-9193")
|
||||
@FailureExpectedWithNewMetamodel( message = "Aggregate.getSuperType() returns null when it should return a MappedSuperclass")
|
||||
public class EmbeddableWithNoDeclaredDataTest extends BaseEnversJPAFunctionalTestCase {
|
||||
private long id;
|
||||
|
@ -85,7 +85,8 @@ public class EmbeddableWithNoDeclaredDataTest extends BaseEnversJPAFunctionalTes
|
|||
|
||||
Assert.assertEquals( entityLoaded.getName(), entityRev1.getName() );
|
||||
|
||||
// value is read from AUD Table
|
||||
Assert.assertEquals( entityLoaded.getValue(), entityRev1.getValue() );
|
||||
// value should be null because there is no data in EmbeddableWithNoDeclaredData
|
||||
// and the fields in AbstractEmbeddable should not be audited.
|
||||
Assert.assertNull( entityRev1.getValue() );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue