HHH-6361 Cleaned up test case
This commit is contained in:
parent
d0aa9f5d9d
commit
5c562411e6
|
@ -23,6 +23,10 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.event.collection.detached;
|
package org.hibernate.test.event.collection.detached;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertNotNull;
|
||||||
|
import static org.junit.Assert.assertSame;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -32,25 +36,18 @@ import org.hibernate.event.spi.AbstractCollectionEvent;
|
||||||
import org.hibernate.event.spi.PostCollectionRecreateEvent;
|
import org.hibernate.event.spi.PostCollectionRecreateEvent;
|
||||||
import org.hibernate.event.spi.PreCollectionRemoveEvent;
|
import org.hibernate.event.spi.PreCollectionRemoveEvent;
|
||||||
import org.hibernate.event.spi.PreCollectionUpdateEvent;
|
import org.hibernate.event.spi.PreCollectionUpdateEvent;
|
||||||
import org.hibernate.test.jpa.AbstractJPATest;
|
import org.hibernate.testing.TestForIssue;
|
||||||
import org.jboss.logging.Logger;
|
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
import static org.junit.Assert.assertNotNull;
|
|
||||||
import static org.junit.Assert.assertSame;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test HHH-6361: Collection events may contain wrong stored snapshot after
|
* Test HHH-6361: Collection events may contain wrong stored snapshot after
|
||||||
* merging a detached entity into the persistencecontext.
|
* merging a detached entity into the persistencecontext.
|
||||||
*
|
*
|
||||||
* @author Erik-Berndt Scheper
|
* @author Erik-Berndt Scheper
|
||||||
*/
|
*/
|
||||||
public class DetachedMultipleCollectionChangeTest extends AbstractJPATest {
|
@TestForIssue( jiraKey = "HHH-6361" )
|
||||||
|
public class DetachedMultipleCollectionChangeTest extends BaseCoreFunctionalTestCase {
|
||||||
private final Logger log = Logger
|
|
||||||
.getLogger(DetachedMultipleCollectionChangeTest.class);
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] getMappings() {
|
public String[] getMappings() {
|
||||||
|
@ -73,19 +70,15 @@ public class DetachedMultipleCollectionChangeTest extends AbstractJPATest {
|
||||||
public void testMergeMultipleCollectionChangeEvents() {
|
public void testMergeMultipleCollectionChangeEvents() {
|
||||||
MultipleCollectionListeners listeners = new MultipleCollectionListeners(
|
MultipleCollectionListeners listeners = new MultipleCollectionListeners(
|
||||||
sessionFactory());
|
sessionFactory());
|
||||||
|
|
||||||
List<MultipleCollectionRefEntity1> oldRefentities1;
|
|
||||||
List<MultipleCollectionRefEntity2> oldRefentities2;
|
|
||||||
int eventCount;
|
|
||||||
Session s;
|
|
||||||
|
|
||||||
oldRefentities1 = new ArrayList<MultipleCollectionRefEntity1>();
|
|
||||||
oldRefentities2 = new ArrayList<MultipleCollectionRefEntity2>();
|
|
||||||
|
|
||||||
listeners.clear();
|
listeners.clear();
|
||||||
eventCount = 0;
|
int eventCount = 0;
|
||||||
|
|
||||||
s = openSession();
|
List<MultipleCollectionRefEntity1> oldRefentities1
|
||||||
|
= new ArrayList<MultipleCollectionRefEntity1>();
|
||||||
|
List<MultipleCollectionRefEntity2> oldRefentities2
|
||||||
|
= new ArrayList<MultipleCollectionRefEntity2>();
|
||||||
|
|
||||||
|
Session s = openSession();
|
||||||
s.beginTransaction();
|
s.beginTransaction();
|
||||||
|
|
||||||
MultipleCollectionEntity mce = new MultipleCollectionEntity();
|
MultipleCollectionEntity mce = new MultipleCollectionEntity();
|
||||||
|
@ -225,9 +218,6 @@ public class DetachedMultipleCollectionChangeTest extends AbstractJPATest {
|
||||||
|
|
||||||
mce = (MultipleCollectionEntity) s.merge(mce);
|
mce = (MultipleCollectionEntity) s.merge(mce);
|
||||||
|
|
||||||
// assertEquals(2, mce.getRefEntities1().size());
|
|
||||||
// assertEquals(2, mce.getRefEntities2().size());
|
|
||||||
|
|
||||||
s.getTransaction().commit();
|
s.getTransaction().commit();
|
||||||
|
|
||||||
checkListener(listeners, listeners.getInitializeCollectionListener(),
|
checkListener(listeners, listeners.getInitializeCollectionListener(),
|
||||||
|
|
Loading…
Reference in New Issue