Fix Sybase failing test
This commit is contained in:
parent
718d1e4380
commit
a8201bacdb
|
@ -8,12 +8,12 @@ package org.hibernate.orm.test.query;
|
||||||
|
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
import org.hibernate.cfg.AvailableSettings;
|
import org.hibernate.cfg.AvailableSettings;
|
||||||
|
import org.hibernate.dialect.SybaseDialect;
|
||||||
import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider;
|
import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider;
|
||||||
import org.hibernate.jpa.QueryHints;
|
import org.hibernate.jpa.QueryHints;
|
||||||
import org.hibernate.query.NativeQuery;
|
import org.hibernate.query.NativeQuery;
|
||||||
|
@ -38,7 +38,10 @@ import static org.mockito.Mockito.verify;
|
||||||
@RequiresDialectFeature(DialectChecks.SupportsJdbcDriverProxying.class)
|
@RequiresDialectFeature(DialectChecks.SupportsJdbcDriverProxying.class)
|
||||||
public class QueryTimeOutTest extends BaseNonConfigCoreFunctionalTestCase {
|
public class QueryTimeOutTest extends BaseNonConfigCoreFunctionalTestCase {
|
||||||
|
|
||||||
private static final PreparedStatementSpyConnectionProvider CONNECTION_PROVIDER = new PreparedStatementSpyConnectionProvider( true, false );
|
private static final PreparedStatementSpyConnectionProvider CONNECTION_PROVIDER = new PreparedStatementSpyConnectionProvider(
|
||||||
|
true,
|
||||||
|
false
|
||||||
|
);
|
||||||
private static final String QUERY = "update AnEntity set name = 'abc'";
|
private static final String QUERY = "update AnEntity set name = 'abc'";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -58,7 +61,7 @@ public class QueryTimeOutTest extends BaseNonConfigCoreFunctionalTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestForIssue( jiraKey = "HHH-12075")
|
@TestForIssue(jiraKey = "HHH-12075")
|
||||||
public void testCreateQuerySetTimeout() {
|
public void testCreateQuerySetTimeout() {
|
||||||
doInHibernate(
|
doInHibernate(
|
||||||
this::sessionFactory, session -> {
|
this::sessionFactory, session -> {
|
||||||
|
@ -67,7 +70,19 @@ public class QueryTimeOutTest extends BaseNonConfigCoreFunctionalTestCase {
|
||||||
query.executeUpdate();
|
query.executeUpdate();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
verify( CONNECTION_PROVIDER.getPreparedStatement( QUERY ), times( 1 ) ).setQueryTimeout( 123 );
|
if ( getDialect() instanceof SybaseDialect ) {
|
||||||
|
verify(
|
||||||
|
CONNECTION_PROVIDER.getPreparedStatement(
|
||||||
|
"update AnEntity set AnEntity.name = 'abc'" ),
|
||||||
|
times( 1 )
|
||||||
|
).setQueryTimeout( 123 );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
verify(
|
||||||
|
CONNECTION_PROVIDER.getPreparedStatement( QUERY ),
|
||||||
|
times( 1 )
|
||||||
|
).setQueryTimeout( 123 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (SQLException ex) {
|
catch (SQLException ex) {
|
||||||
fail( "should not have thrown exception" );
|
fail( "should not have thrown exception" );
|
||||||
|
@ -77,7 +92,7 @@ public class QueryTimeOutTest extends BaseNonConfigCoreFunctionalTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestForIssue( jiraKey = "HHH-12075")
|
@TestForIssue(jiraKey = "HHH-12075")
|
||||||
public void testCreateQuerySetTimeoutHint() {
|
public void testCreateQuerySetTimeoutHint() {
|
||||||
doInHibernate(
|
doInHibernate(
|
||||||
this::sessionFactory, session -> {
|
this::sessionFactory, session -> {
|
||||||
|
@ -86,7 +101,19 @@ public class QueryTimeOutTest extends BaseNonConfigCoreFunctionalTestCase {
|
||||||
query.executeUpdate();
|
query.executeUpdate();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
verify( CONNECTION_PROVIDER.getPreparedStatement( QUERY ), times( 1 ) ).setQueryTimeout( 123 );
|
if ( getDialect() instanceof SybaseDialect ) {
|
||||||
|
verify(
|
||||||
|
CONNECTION_PROVIDER.getPreparedStatement(
|
||||||
|
"update AnEntity set AnEntity.name = 'abc'" ),
|
||||||
|
times( 1 )
|
||||||
|
).setQueryTimeout( 123 );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
verify(
|
||||||
|
CONNECTION_PROVIDER.getPreparedStatement( QUERY ),
|
||||||
|
times( 1 )
|
||||||
|
).setQueryTimeout( 123 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (SQLException ex) {
|
catch (SQLException ex) {
|
||||||
fail( "should not have thrown exception" );
|
fail( "should not have thrown exception" );
|
||||||
|
@ -96,7 +123,7 @@ public class QueryTimeOutTest extends BaseNonConfigCoreFunctionalTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestForIssue( jiraKey = "HHH-12075")
|
@TestForIssue(jiraKey = "HHH-12075")
|
||||||
public void testCreateNativeQuerySetTimeout() {
|
public void testCreateNativeQuerySetTimeout() {
|
||||||
doInHibernate(
|
doInHibernate(
|
||||||
this::sessionFactory, session -> {
|
this::sessionFactory, session -> {
|
||||||
|
@ -115,7 +142,7 @@ public class QueryTimeOutTest extends BaseNonConfigCoreFunctionalTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestForIssue( jiraKey = "HHH-12075")
|
@TestForIssue(jiraKey = "HHH-12075")
|
||||||
public void testCreateNativeQuerySetTimeoutHint() {
|
public void testCreateNativeQuerySetTimeoutHint() {
|
||||||
doInHibernate(
|
doInHibernate(
|
||||||
this::sessionFactory, session -> {
|
this::sessionFactory, session -> {
|
||||||
|
@ -134,7 +161,7 @@ public class QueryTimeOutTest extends BaseNonConfigCoreFunctionalTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestForIssue( jiraKey = "HHH-12075")
|
@TestForIssue(jiraKey = "HHH-12075")
|
||||||
public void testCreateSQLQuerySetTimeout() {
|
public void testCreateSQLQuerySetTimeout() {
|
||||||
doInHibernate(
|
doInHibernate(
|
||||||
this::sessionFactory, session -> {
|
this::sessionFactory, session -> {
|
||||||
|
@ -153,7 +180,7 @@ public class QueryTimeOutTest extends BaseNonConfigCoreFunctionalTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestForIssue( jiraKey = "HHH-12075")
|
@TestForIssue(jiraKey = "HHH-12075")
|
||||||
public void testCreateSQLQuerySetTimeoutHint() {
|
public void testCreateSQLQuerySetTimeoutHint() {
|
||||||
doInHibernate(
|
doInHibernate(
|
||||||
this::sessionFactory, session -> {
|
this::sessionFactory, session -> {
|
||||||
|
@ -171,8 +198,8 @@ public class QueryTimeOutTest extends BaseNonConfigCoreFunctionalTestCase {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Entity(name = "AnEntity" )
|
@Entity(name = "AnEntity")
|
||||||
@Table(name = "AnEntity" )
|
@Table(name = "AnEntity")
|
||||||
public static class AnEntity {
|
public static class AnEntity {
|
||||||
@Id
|
@Id
|
||||||
private int id;
|
private int id;
|
||||||
|
|
Loading…
Reference in New Issue