HHH-10876 : corrections due to backporting

This commit is contained in:
Gail Badner 2016-08-10 23:11:36 -07:00
parent d4b81560bf
commit ee2db37052
1 changed files with 5 additions and 15 deletions

View File

@ -10,29 +10,21 @@ import java.util.Map;
import org.hibernate.Session; import org.hibernate.Session;
import org.hibernate.Transaction; import org.hibernate.Transaction;
import org.hibernate.boot.SessionFactoryBuilder;
import org.hibernate.cfg.Environment; import org.hibernate.cfg.Environment;
import org.hibernate.dialect.SQLServer2012Dialect; import org.hibernate.dialect.SQLServer2012Dialect;
import org.hibernate.id.SequenceGenerator;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.testing.DialectChecks; import org.hibernate.testing.DialectChecks;
import org.hibernate.testing.RequiresDialectFeature; import org.hibernate.testing.RequiresDialectFeature;
import org.hibernate.testing.SkipForDialect; import org.hibernate.testing.SkipForDialect;
import org.hibernate.testing.TestForIssue; import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase; import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase;
import org.hibernate.test.util.jdbc.SQLStatementInterceptor;
import org.junit.Test; import org.junit.Test;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
public class SequenceGeneratorTest extends BaseNonConfigCoreFunctionalTestCase { public class SequenceGeneratorTest extends BaseNonConfigCoreFunctionalTestCase {
private SQLStatementInterceptor sqlStatementInterceptor;
@Override
protected void configureSessionFactoryBuilder(SessionFactoryBuilder sfb) {
sqlStatementInterceptor = new SQLStatementInterceptor( sfb );
}
@Override @Override
public String[] getMappings() { public String[] getMappings() {
return new String[] { "id/Person.hbm.xml" }; return new String[] { "id/Person.hbm.xml" };
@ -62,11 +54,9 @@ public class SequenceGeneratorTest extends BaseNonConfigCoreFunctionalTestCase {
s.close(); s.close();
assertTrue( person.getId() > 0 ); assertTrue( person.getId() > 0 );
assertTrue( sqlStatementInterceptor.getSqlQueries()
.stream() final EntityPersister persister = sessionFactory().getEntityPersister( Person.class.getName() );
.filter( sql -> sql.contains( "product_sequence" ) ) assertTrue( SequenceGenerator.class.isInstance( persister.getIdentifierGenerator() ) );
.findFirst()
.isPresent() );
} }
} }