From 1f541170c7c170319ec19f070cc876f85562dba9 Mon Sep 17 00:00:00 2001 From: Andrea Boriero Date: Thu, 25 Nov 2021 18:18:45 +0100 Subject: [PATCH] Re-enable additional tests --- .../{ => orm}/test/rowid/Point.hbm.xml | 4 +- .../hibernate/{ => orm}/test/rowid/Point.java | 2 +- .../test/rowid/RowIdTest2.java} | 78 ++++++++++--------- .../{ => orm}/test/rowid/RowIdType.java | 2 +- 4 files changed, 44 insertions(+), 42 deletions(-) rename hibernate-core/src/test/java/org/hibernate/{ => orm}/test/rowid/Point.hbm.xml (84%) rename hibernate-core/src/test/java/org/hibernate/{ => orm}/test/rowid/Point.java (96%) rename hibernate-core/src/test/java/org/hibernate/{test/rowid/RowIdTest.java => orm/test/rowid/RowIdTest2.java} (51%) rename hibernate-core/src/test/java/org/hibernate/{ => orm}/test/rowid/RowIdType.java (97%) diff --git a/hibernate-core/src/test/java/org/hibernate/test/rowid/Point.hbm.xml b/hibernate-core/src/test/java/org/hibernate/orm/test/rowid/Point.hbm.xml similarity index 84% rename from hibernate-core/src/test/java/org/hibernate/test/rowid/Point.hbm.xml rename to hibernate-core/src/test/java/org/hibernate/orm/test/rowid/Point.hbm.xml index 728defca2b..c74c28f592 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/rowid/Point.hbm.xml +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/rowid/Point.hbm.xml @@ -13,9 +13,9 @@ --> - + - + diff --git a/hibernate-core/src/test/java/org/hibernate/test/rowid/Point.java b/hibernate-core/src/test/java/org/hibernate/orm/test/rowid/Point.java similarity index 96% rename from hibernate-core/src/test/java/org/hibernate/test/rowid/Point.java rename to hibernate-core/src/test/java/org/hibernate/orm/test/rowid/Point.java index b7de7d4bd6..1045c6959d 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/rowid/Point.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/rowid/Point.java @@ -6,7 +6,7 @@ */ //$Id: Point.java 6477 2005-04-21 07:39:21Z oneovthafew $ -package org.hibernate.test.rowid; +package org.hibernate.orm.test.rowid; import java.io.Serializable; import java.math.BigDecimal; diff --git a/hibernate-core/src/test/java/org/hibernate/test/rowid/RowIdTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/rowid/RowIdTest2.java similarity index 51% rename from hibernate-core/src/test/java/org/hibernate/test/rowid/RowIdTest.java rename to hibernate-core/src/test/java/org/hibernate/orm/test/rowid/RowIdTest2.java index 25ff4112e2..d194c97a51 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/rowid/RowIdTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/rowid/RowIdTest2.java @@ -4,60 +4,62 @@ * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ -package org.hibernate.test.rowid; +package org.hibernate.orm.test.rowid; import java.math.BigDecimal; import java.sql.Statement; + +import org.hibernate.Transaction; +import org.hibernate.dialect.OracleDialect; + +import org.hibernate.testing.orm.junit.DomainModel; +import org.hibernate.testing.orm.junit.RequiresDialect; +import org.hibernate.testing.orm.junit.SessionFactory; +import org.hibernate.testing.orm.junit.SessionFactoryScope; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import jakarta.persistence.criteria.CriteriaBuilder; import jakarta.persistence.criteria.CriteriaQuery; -import org.hibernate.Session; -import org.hibernate.Transaction; -import org.hibernate.dialect.Oracle9iDialect; -import org.hibernate.engine.spi.SessionImplementor; - -import org.hibernate.testing.RequiresDialect; -import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; -import org.junit.Test; /** * @author Gavin King */ -@RequiresDialect( value = Oracle9iDialect.class ) -public class RowIdTest extends BaseCoreFunctionalTestCase { - public String[] getMappings() { - return new String[] { "rowid/Point.hbm.xml" }; - } +@RequiresDialect(value = OracleDialect.class, version = 900) +@DomainModel( + xmlMappings = "org/hibernate/orm/test/rowid/Point.hbm.xml" +) +@SessionFactory( + exportSchema = false - public String getCacheConcurrencyStrategy() { - return null; - } +) +public class RowIdTest2 { - public boolean createSchema() { - return false; - } - - public void afterSessionFactoryBuilt() { - super.afterSessionFactoryBuilt(); - final Session session = sessionFactory().openSession(); - session.doWork( - connection -> { - Statement st = ((SessionImplementor)session).getJdbcCoordinator().getStatementPreparer().createStatement(); - try { - ((SessionImplementor)session).getJdbcCoordinator().getResultSetReturn().execute( st, "drop table Point"); - } - catch (Exception ignored) { - } - ((SessionImplementor)session).getJdbcCoordinator().getResultSetReturn().execute( st, "create table Point (\"x\" number(19,2) not null, \"y\" number(19,2) not null, description varchar2(255) )"); - ((SessionImplementor)session).getJdbcCoordinator().getResourceRegistry().release( st ); - } + @BeforeAll + public void setUp(SessionFactoryScope scope) { + scope.inSession( + session -> session.doWork( + connection -> { + Statement st = session.getJdbcCoordinator().getStatementPreparer().createStatement(); + try { + session.getJdbcCoordinator().getResultSetReturn().execute( st, "drop table Point" ); + } + catch (Exception ignored) { + } + session.getJdbcCoordinator().getResultSetReturn().execute( + st, + "create table Point (\"x\" number(19,2) not null, \"y\" number(19,2) not null, description varchar2(255) )" + ); + session.getJdbcCoordinator().getResourceRegistry().release( st ); + } + ) ); - session.close(); } @Test - public void testRowId() { - inSession( + public void testRowId(SessionFactoryScope scope) { + scope.inSession( s -> { try { Transaction t = s.beginTransaction(); diff --git a/hibernate-core/src/test/java/org/hibernate/test/rowid/RowIdType.java b/hibernate-core/src/test/java/org/hibernate/orm/test/rowid/RowIdType.java similarity index 97% rename from hibernate-core/src/test/java/org/hibernate/test/rowid/RowIdType.java rename to hibernate-core/src/test/java/org/hibernate/orm/test/rowid/RowIdType.java index 5fbd2fc292..a6ef8fb81a 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/rowid/RowIdType.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/rowid/RowIdType.java @@ -6,7 +6,7 @@ */ //$Id: RowIdType.java 6477 2005-04-21 07:39:21Z oneovthafew $ -package org.hibernate.test.rowid; +package org.hibernate.orm.test.rowid; import java.io.Serializable; import java.sql.PreparedStatement;