HHH-15509 fix tests
This commit is contained in:
parent
e76a26165f
commit
6c90b5d0a1
|
@ -64,7 +64,7 @@ public class MultiIdEntityLoadTests {
|
|||
// using ordered results
|
||||
scope.inTransaction(
|
||||
session -> {
|
||||
session.delete( session.load( BasicEntity.class, 2 ) );
|
||||
session.delete( session.get( BasicEntity.class, 2 ) );
|
||||
|
||||
// test control - no delete-checking
|
||||
{
|
||||
|
@ -115,7 +115,7 @@ public class MultiIdEntityLoadTests {
|
|||
// using un-ordered results
|
||||
scope.inTransaction(
|
||||
session -> {
|
||||
session.delete( session.load( BasicEntity.class, 2 ) );
|
||||
session.delete( session.get( BasicEntity.class, 2 ) );
|
||||
|
||||
// test control - no delete-checking
|
||||
{
|
||||
|
|
|
@ -10,6 +10,7 @@ import java.util.List;
|
|||
import java.util.Objects;
|
||||
|
||||
import org.hibernate.CacheMode;
|
||||
import org.hibernate.Hibernate;
|
||||
import org.hibernate.annotations.BatchSize;
|
||||
import org.hibernate.cache.spi.access.AccessType;
|
||||
import org.hibernate.cfg.AvailableSettings;
|
||||
|
@ -106,7 +107,7 @@ public class MultiLoadTest {
|
|||
|
||||
@Test
|
||||
@TestForIssue( jiraKey = "HHH-10984" )
|
||||
public void testUnflushedDeleteAndThenMultiLoad(SessionFactoryScope scope) {
|
||||
public void testUnflushedDeleteAndThenMultiLoadPart0(SessionFactoryScope scope) {
|
||||
scope.inTransaction(
|
||||
session -> {
|
||||
// delete one of them (but do not flush)...
|
||||
|
@ -115,10 +116,53 @@ public class MultiLoadTest {
|
|||
// as a baseline, assert based on how load() handles it
|
||||
SimpleEntity s5 = session.load( SimpleEntity.class, 5 );
|
||||
assertNotNull( s5 );
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestForIssue( jiraKey = "HHH-10984" )
|
||||
public void testUnflushedDeleteAndThenMultiLoadPart1(SessionFactoryScope scope) {
|
||||
scope.inTransaction(
|
||||
session -> {
|
||||
// delete one of them (but do not flush)...
|
||||
SimpleEntity s4 = session.load( SimpleEntity.class, 5 );
|
||||
Hibernate.initialize( s4 );
|
||||
session.delete( s4 );
|
||||
|
||||
// as a baseline, assert based on how load() handles it
|
||||
SimpleEntity s5 = session.load( SimpleEntity.class, 5 );
|
||||
assertNotNull( s5 );
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestForIssue( jiraKey = "HHH-10984" )
|
||||
public void testUnflushedDeleteAndThenMultiLoadPart2(SessionFactoryScope scope) {
|
||||
scope.inTransaction(
|
||||
session -> {
|
||||
// delete one of them (but do not flush)...
|
||||
SimpleEntity s4 = session.load( SimpleEntity.class, 5 );
|
||||
Hibernate.initialize( s4 );
|
||||
session.delete( s4 );
|
||||
|
||||
// and then, assert how get() handles it
|
||||
s5 = session.get( SimpleEntity.class, 5 );
|
||||
SimpleEntity s5 = session.get( SimpleEntity.class, 5 );
|
||||
assertNull( s5 );
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestForIssue( jiraKey = "HHH-10984" )
|
||||
public void testUnflushedDeleteAndThenMultiLoadPart3(SessionFactoryScope scope) {
|
||||
scope.inTransaction(
|
||||
session -> {
|
||||
// delete one of them (but do not flush)...
|
||||
SimpleEntity s4 = session.load( SimpleEntity.class, 5 );
|
||||
Hibernate.initialize( s4 );
|
||||
session.delete( s4 );
|
||||
|
||||
// finally assert how multiLoad handles it
|
||||
List<SimpleEntity> list = session.byMultipleIds( SimpleEntity.class ).multiLoad( ids( 56 ) );
|
||||
|
@ -127,6 +171,21 @@ public class MultiLoadTest {
|
|||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestForIssue( jiraKey = "HHH-10984" )
|
||||
public void testUnflushedDeleteAndThenMultiLoadPart4(SessionFactoryScope scope) {
|
||||
scope.inTransaction(
|
||||
session -> {
|
||||
// delete one of them (but do not flush)...
|
||||
session.delete( session.load( SimpleEntity.class, 5 ) );
|
||||
|
||||
// and then, assert how get() handles it
|
||||
SimpleEntity s5 = session.get( SimpleEntity.class, 5 );
|
||||
assertNotNull( s5 ); //because we didn't flush the deletion!
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestForIssue( jiraKey = "HHH-10617" )
|
||||
public void testDuplicatedRequestedIds(SessionFactoryScope scope) {
|
||||
|
|
|
@ -1170,6 +1170,7 @@ public class ReadOnlyProxyTest extends AbstractReadOnlyTest {
|
|||
s.setCacheMode( CacheMode.IGNORE );
|
||||
DataPoint dpProxyInit = s.load( DataPoint.class, dp.getId() );
|
||||
assertEquals( "original", dp.getDescription() );
|
||||
assertEquals( "original", dpProxyInit.getDescription() );
|
||||
s.delete( dpProxyInit );
|
||||
t.commit();
|
||||
s.close();
|
||||
|
|
Loading…
Reference in New Issue