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.util.Map;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.cfg.AvailableSettings;
|
||||
import org.hibernate.dialect.SybaseDialect;
|
||||
import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider;
|
||||
import org.hibernate.jpa.QueryHints;
|
||||
import org.hibernate.query.NativeQuery;
|
||||
|
@ -38,7 +38,10 @@ import static org.mockito.Mockito.verify;
|
|||
@RequiresDialectFeature(DialectChecks.SupportsJdbcDriverProxying.class)
|
||||
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'";
|
||||
|
||||
@Override
|
||||
|
@ -58,7 +61,7 @@ public class QueryTimeOutTest extends BaseNonConfigCoreFunctionalTestCase {
|
|||
}
|
||||
|
||||
@Test
|
||||
@TestForIssue( jiraKey = "HHH-12075")
|
||||
@TestForIssue(jiraKey = "HHH-12075")
|
||||
public void testCreateQuerySetTimeout() {
|
||||
doInHibernate(
|
||||
this::sessionFactory, session -> {
|
||||
|
@ -67,7 +70,19 @@ public class QueryTimeOutTest extends BaseNonConfigCoreFunctionalTestCase {
|
|||
query.executeUpdate();
|
||||
|
||||
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) {
|
||||
fail( "should not have thrown exception" );
|
||||
|
@ -77,7 +92,7 @@ public class QueryTimeOutTest extends BaseNonConfigCoreFunctionalTestCase {
|
|||
}
|
||||
|
||||
@Test
|
||||
@TestForIssue( jiraKey = "HHH-12075")
|
||||
@TestForIssue(jiraKey = "HHH-12075")
|
||||
public void testCreateQuerySetTimeoutHint() {
|
||||
doInHibernate(
|
||||
this::sessionFactory, session -> {
|
||||
|
@ -86,7 +101,19 @@ public class QueryTimeOutTest extends BaseNonConfigCoreFunctionalTestCase {
|
|||
query.executeUpdate();
|
||||
|
||||
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) {
|
||||
fail( "should not have thrown exception" );
|
||||
|
@ -96,7 +123,7 @@ public class QueryTimeOutTest extends BaseNonConfigCoreFunctionalTestCase {
|
|||
}
|
||||
|
||||
@Test
|
||||
@TestForIssue( jiraKey = "HHH-12075")
|
||||
@TestForIssue(jiraKey = "HHH-12075")
|
||||
public void testCreateNativeQuerySetTimeout() {
|
||||
doInHibernate(
|
||||
this::sessionFactory, session -> {
|
||||
|
@ -115,7 +142,7 @@ public class QueryTimeOutTest extends BaseNonConfigCoreFunctionalTestCase {
|
|||
}
|
||||
|
||||
@Test
|
||||
@TestForIssue( jiraKey = "HHH-12075")
|
||||
@TestForIssue(jiraKey = "HHH-12075")
|
||||
public void testCreateNativeQuerySetTimeoutHint() {
|
||||
doInHibernate(
|
||||
this::sessionFactory, session -> {
|
||||
|
@ -134,7 +161,7 @@ public class QueryTimeOutTest extends BaseNonConfigCoreFunctionalTestCase {
|
|||
}
|
||||
|
||||
@Test
|
||||
@TestForIssue( jiraKey = "HHH-12075")
|
||||
@TestForIssue(jiraKey = "HHH-12075")
|
||||
public void testCreateSQLQuerySetTimeout() {
|
||||
doInHibernate(
|
||||
this::sessionFactory, session -> {
|
||||
|
@ -153,7 +180,7 @@ public class QueryTimeOutTest extends BaseNonConfigCoreFunctionalTestCase {
|
|||
}
|
||||
|
||||
@Test
|
||||
@TestForIssue( jiraKey = "HHH-12075")
|
||||
@TestForIssue(jiraKey = "HHH-12075")
|
||||
public void testCreateSQLQuerySetTimeoutHint() {
|
||||
doInHibernate(
|
||||
this::sessionFactory, session -> {
|
||||
|
@ -171,8 +198,8 @@ public class QueryTimeOutTest extends BaseNonConfigCoreFunctionalTestCase {
|
|||
);
|
||||
}
|
||||
|
||||
@Entity(name = "AnEntity" )
|
||||
@Table(name = "AnEntity" )
|
||||
@Entity(name = "AnEntity")
|
||||
@Table(name = "AnEntity")
|
||||
public static class AnEntity {
|
||||
@Id
|
||||
private int id;
|
||||
|
|
Loading…
Reference in New Issue