mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-07 11:48:18 +00:00
Migrate tests from org.hibernate.jpa.test to org.hibernate.orm.test.jpa (2)
Signed-off-by: Jan Schatteman <jschatte@redhat.com>
This commit is contained in:
parent
0ecb05614f
commit
470af28795
@ -1,117 +0,0 @@
|
||||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
|
||||
//$Id$
|
||||
|
||||
package org.hibernate.jpa.test.connection;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import javax.persistence.SharedCacheMode;
|
||||
import javax.persistence.ValidationMode;
|
||||
import javax.persistence.spi.ClassTransformer;
|
||||
import javax.persistence.spi.PersistenceUnitInfo;
|
||||
import javax.persistence.spi.PersistenceUnitTransactionType;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.hibernate.cfg.Environment;
|
||||
import org.hibernate.jpa.HibernatePersistenceProvider;
|
||||
import org.hibernate.jpa.test.Distributor;
|
||||
import org.hibernate.jpa.test.Item;
|
||||
import org.hibernate.jpa.test.xml.Light;
|
||||
import org.hibernate.jpa.test.xml.Lighter;
|
||||
|
||||
/**
|
||||
* @author Emmanuel Bernard
|
||||
*/
|
||||
public class PersistenceUnitInfoImpl implements PersistenceUnitInfo {
|
||||
private Properties properties = new Properties();
|
||||
private List<String> mappingFiles;
|
||||
private URL puRoot;
|
||||
|
||||
public PersistenceUnitInfoImpl(URL puRoot, String[] mappingFiles) {
|
||||
this.mappingFiles = new ArrayList<>( mappingFiles.length );
|
||||
this.mappingFiles.addAll( Arrays.asList( mappingFiles ) );
|
||||
this.puRoot = puRoot;
|
||||
}
|
||||
|
||||
public String getPersistenceUnitName() {
|
||||
return "persistenceinfo";
|
||||
}
|
||||
|
||||
public String getPersistenceProviderClassName() {
|
||||
return HibernatePersistenceProvider.class.getName();
|
||||
}
|
||||
|
||||
public DataSource getJtaDataSource() {
|
||||
return new FakeDataSource();
|
||||
}
|
||||
|
||||
public DataSource getNonJtaDataSource() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<String> getMappingFileNames() {
|
||||
return mappingFiles;
|
||||
}
|
||||
|
||||
public List<URL> getJarFileUrls() {
|
||||
return new ArrayList<URL>();
|
||||
}
|
||||
|
||||
public List<String> getManagedClassNames() {
|
||||
List<String> classes = new ArrayList<String>();
|
||||
classes.add( Item.class.getName() );
|
||||
classes.add( Distributor.class.getName() );
|
||||
classes.add( Light.class.getName() );
|
||||
classes.add( Lighter.class.getName() );
|
||||
return classes;
|
||||
}
|
||||
|
||||
public Properties getProperties() {
|
||||
properties.setProperty( Environment.HBM2DDL_AUTO, "create-drop" );
|
||||
return properties;
|
||||
}
|
||||
|
||||
public String getPersistenceXMLSchemaVersion() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public ClassLoader getClassLoader() {
|
||||
return Thread.currentThread().getContextClassLoader();
|
||||
}
|
||||
|
||||
public PersistenceUnitTransactionType getTransactionType() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public URL getPersistenceUnitRootUrl() {
|
||||
return puRoot;
|
||||
}
|
||||
|
||||
public boolean excludeUnlistedClasses() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public SharedCacheMode getSharedCacheMode() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public ValidationMode getValidationMode() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void addTransformer(ClassTransformer transformer) {
|
||||
}
|
||||
|
||||
public ClassLoader getNewTempClassLoader() {
|
||||
return Thread.currentThread().getContextClassLoader();
|
||||
}
|
||||
}
|
@ -1,104 +0,0 @@
|
||||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
package org.hibernate.jpa.test.connection;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.PersistenceException;
|
||||
import javax.persistence.criteria.CriteriaBuilder;
|
||||
import javax.persistence.criteria.CriteriaQuery;
|
||||
|
||||
import org.hibernate.cfg.AvailableSettings;
|
||||
import org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl;
|
||||
import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider;
|
||||
import org.hibernate.exception.SQLGrammarException;
|
||||
import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase;
|
||||
|
||||
import org.hibernate.testing.TestForIssue;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Andrea Boriero
|
||||
*/
|
||||
@TestForIssue(jiraKey = "HHH-11257")
|
||||
public class TestConnectionPool
|
||||
extends BaseEntityManagerFunctionalTestCase {
|
||||
|
||||
private final static int CONNECTION_POOL_SIZE = 2;
|
||||
|
||||
@Override
|
||||
public Class[] getAnnotatedClasses() {
|
||||
return new Class[] { TestEntity.class };
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean createSchema() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addConfigOptions(Map options) {
|
||||
options.put(
|
||||
AvailableSettings.POOL_SIZE,
|
||||
Integer.valueOf( CONNECTION_POOL_SIZE )
|
||||
);
|
||||
options.put( "hibernate.connection.customProperty", "x" );
|
||||
options.put( AvailableSettings.CONNECTION_PROVIDER_DISABLES_AUTOCOMMIT, "true" );
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestForIssue(jiraKey = "HHH-13700")
|
||||
public void testConnectionPoolPropertyFiltering() {
|
||||
ConnectionProvider cp = serviceRegistry().getService( ConnectionProvider.class );
|
||||
DriverManagerConnectionProviderImpl dmcp = (DriverManagerConnectionProviderImpl) cp;
|
||||
Properties connectionProperties = dmcp.getConnectionProperties();
|
||||
Assert.assertEquals( "x", connectionProperties.getProperty( "customProperty" ) );
|
||||
Assert.assertNull( connectionProperties.getProperty( "pool_size" ) );
|
||||
Assert.assertNull( connectionProperties.getProperty( "provider_disables_autocommit" ) );
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConnectionPoolDoesNotConsumeAllConnections() {
|
||||
for ( int i = 0; i < CONNECTION_POOL_SIZE + 1; ++i ) {
|
||||
EntityManager entityManager = getOrCreateEntityManager();
|
||||
try {
|
||||
for ( int j = 0; j < 2; j++ ) {
|
||||
try {
|
||||
final CriteriaBuilder builder = entityManager.getCriteriaBuilder();
|
||||
final CriteriaQuery<TestEntity> criteriaQuery = builder.createQuery(
|
||||
TestEntity.class );
|
||||
criteriaQuery.select( criteriaQuery.from( TestEntity.class ) );
|
||||
|
||||
entityManager.createQuery( criteriaQuery ).getResultList();
|
||||
}
|
||||
catch ( PersistenceException e ) {
|
||||
if ( e.getCause() instanceof SQLGrammarException ) {
|
||||
//expected, the schema was not created
|
||||
}
|
||||
else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
finally {
|
||||
entityManager.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Entity(name = "Test_Entity")
|
||||
public static class TestEntity {
|
||||
|
||||
@Id
|
||||
public long id;
|
||||
}
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
package org.hibernate.jpa.test.criteria;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.criteria.CollectionJoin;
|
||||
import javax.persistence.criteria.CriteriaQuery;
|
||||
import javax.persistence.criteria.Root;
|
||||
|
||||
import org.hibernate.jpa.test.metamodel.AbstractMetamodelSpecificTest;
|
||||
import org.hibernate.jpa.test.metamodel.LineItem;
|
||||
import org.hibernate.jpa.test.metamodel.LineItem_;
|
||||
import org.hibernate.jpa.test.metamodel.Order;
|
||||
import org.hibernate.jpa.test.metamodel.Order_;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Similar to {@link org.hibernate.orm.test.query.hql.OnKeywordTest}, but here testing from JPA criteria queries.
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class OnKeywordTest extends AbstractMetamodelSpecificTest {
|
||||
@Test
|
||||
public void basicTest() {
|
||||
EntityManager em = getOrCreateEntityManager();
|
||||
CriteriaQuery<Order> criteria = em.getCriteriaBuilder().createQuery( Order.class );
|
||||
Root<Order> root = criteria.from( Order.class );
|
||||
criteria.select( root );
|
||||
CollectionJoin<Order,LineItem> lineItemsJoin = root.join( Order_.lineItems );
|
||||
lineItemsJoin.on(
|
||||
em.getCriteriaBuilder().gt(
|
||||
lineItemsJoin.get( LineItem_.quantity ),
|
||||
em.getCriteriaBuilder().literal( 20 )
|
||||
)
|
||||
);
|
||||
em.createQuery( criteria ).getResultList();
|
||||
em.close();
|
||||
}
|
||||
}
|
@ -1,65 +0,0 @@
|
||||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
package org.hibernate.jpa.test.criteria.basic;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.util.List;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.criteria.CriteriaBuilder;
|
||||
import javax.persistence.criteria.CriteriaQuery;
|
||||
import javax.persistence.criteria.Root;
|
||||
|
||||
import org.hibernate.dialect.DerbyDialect;
|
||||
import org.hibernate.jpa.test.metamodel.AbstractMetamodelSpecificTest;
|
||||
import org.hibernate.jpa.test.metamodel.Product;
|
||||
import org.hibernate.jpa.test.metamodel.Product_;
|
||||
|
||||
import org.hibernate.testing.SkipForDialect;
|
||||
import org.hibernate.testing.TestForIssue;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
public class CastTest extends AbstractMetamodelSpecificTest {
|
||||
private static final int QUANTITY = 2;
|
||||
|
||||
@Test
|
||||
@SkipForDialect(value = DerbyDialect.class,comment = "Derby does not support cast from INTEGER to VARCHAR")
|
||||
@TestForIssue( jiraKey = "HHH-5755" )
|
||||
public void testCastToString() {
|
||||
EntityManager em = getOrCreateEntityManager();
|
||||
em.getTransaction().begin();
|
||||
Product product = new Product();
|
||||
product.setId( "product1" );
|
||||
product.setPrice( 1.23d );
|
||||
product.setQuantity( QUANTITY );
|
||||
product.setPartNumber( ((long)Integer.MAX_VALUE) + 1 );
|
||||
product.setRating( 1.999f );
|
||||
product.setSomeBigInteger( BigInteger.valueOf( 987654321 ) );
|
||||
product.setSomeBigDecimal( BigDecimal.valueOf( 987654.321 ) );
|
||||
em.persist( product );
|
||||
em.getTransaction().commit();
|
||||
em.close();
|
||||
|
||||
em = getOrCreateEntityManager();
|
||||
em.getTransaction().begin();
|
||||
CriteriaBuilder builder = em.getCriteriaBuilder();
|
||||
CriteriaQuery<Product> criteria = builder.createQuery( Product.class );
|
||||
Root<Product> root = criteria.from( Product.class );
|
||||
criteria.where( builder.equal(root.get(Product_.quantity).as( String.class ), builder.literal(String.valueOf(QUANTITY))) );
|
||||
List<Product> result = em.createQuery( criteria ).getResultList();
|
||||
Assert.assertEquals( 1, result.size() );
|
||||
em.getTransaction().commit();
|
||||
em.close();
|
||||
|
||||
em = getOrCreateEntityManager();
|
||||
em.getTransaction().begin();
|
||||
em.createQuery( "delete Product" ).executeUpdate();
|
||||
em.getTransaction().commit();
|
||||
em.close();
|
||||
}
|
||||
}
|
@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
//$Id$
|
||||
package org.hibernate.jpa.test.connection;
|
||||
package org.hibernate.orm.test.jpa.connection;
|
||||
import java.io.PrintWriter;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
@ -7,7 +7,7 @@
|
||||
|
||||
//$Id$
|
||||
|
||||
package org.hibernate.jpa.test.connection;
|
||||
package org.hibernate.orm.test.jpa.connection;
|
||||
|
||||
import java.net.URL;
|
||||
import java.nio.file.Files;
|
||||
@ -31,8 +31,8 @@
|
||||
import org.hibernate.jpa.test.xml.Lighter;
|
||||
|
||||
import org.hibernate.testing.util.jpa.PersistenceUnitInfoAdapter;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* @author Emmanuel Bernard
|
||||
@ -58,7 +58,7 @@ public void testDatasourceInjection() throws Exception {
|
||||
|
||||
try ( final SessionImplementor session = sf.openSession().unwrap( SessionImplementor.class ) ) {
|
||||
session.createQuery( "select i from Item i" ).list();
|
||||
Assert.fail( "Expecting FakeDataSourceException" );
|
||||
Assertions.fail( "Expecting FakeDataSourceException" );
|
||||
}
|
||||
catch (PersistenceException pe) {
|
||||
try {
|
@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
//$Id$
|
||||
package org.hibernate.jpa.test.connection;
|
||||
package org.hibernate.orm.test.jpa.connection;
|
||||
import java.io.PrintWriter;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
//$Id$
|
||||
package org.hibernate.jpa.test.connection;
|
||||
package org.hibernate.orm.test.jpa.connection;
|
||||
|
||||
|
||||
/**
|
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
package org.hibernate.orm.test.jpa.criteria;
|
||||
|
||||
import org.hibernate.jpa.test.metamodel.Address;
|
||||
import org.hibernate.jpa.test.metamodel.Alias;
|
||||
import org.hibernate.jpa.test.metamodel.Country;
|
||||
import org.hibernate.jpa.test.metamodel.CreditCard;
|
||||
import org.hibernate.jpa.test.metamodel.Customer;
|
||||
import org.hibernate.jpa.test.metamodel.Entity1;
|
||||
import org.hibernate.jpa.test.metamodel.Entity2;
|
||||
import org.hibernate.jpa.test.metamodel.Entity3;
|
||||
import org.hibernate.jpa.test.metamodel.Info;
|
||||
import org.hibernate.jpa.test.metamodel.LineItem;
|
||||
import org.hibernate.jpa.test.metamodel.Order;
|
||||
import org.hibernate.jpa.test.metamodel.Phone;
|
||||
import org.hibernate.jpa.test.metamodel.Product;
|
||||
import org.hibernate.jpa.test.metamodel.ShelfLife;
|
||||
import org.hibernate.jpa.test.metamodel.Spouse;
|
||||
import org.hibernate.jpa.test.metamodel.Thing;
|
||||
import org.hibernate.jpa.test.metamodel.ThingWithQuantity;
|
||||
import org.hibernate.jpa.test.metamodel.VersionedEntity;
|
||||
|
||||
import org.hibernate.testing.orm.junit.Jpa;
|
||||
|
||||
/**
|
||||
* @author Jan Schatteman
|
||||
*/
|
||||
|
||||
@Jpa(annotatedClasses = {
|
||||
Address.class,
|
||||
Alias.class,
|
||||
Country.class,
|
||||
CreditCard.class,
|
||||
Customer.class,
|
||||
Entity1.class,
|
||||
Entity2.class,
|
||||
Entity3.class,
|
||||
Info.class,
|
||||
LineItem.class,
|
||||
Order.class,
|
||||
Phone.class,
|
||||
Product.class,
|
||||
ShelfLife.class,
|
||||
Spouse.class,
|
||||
Thing.class,
|
||||
ThingWithQuantity.class,
|
||||
VersionedEntity.class
|
||||
})
|
||||
public abstract class AbstractCriteriaTest {
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
package org.hibernate.orm.test.jpa.criteria;
|
||||
|
||||
import javax.persistence.criteria.CollectionJoin;
|
||||
import javax.persistence.criteria.CriteriaQuery;
|
||||
import javax.persistence.criteria.Root;
|
||||
|
||||
import org.hibernate.jpa.test.metamodel.LineItem;
|
||||
import org.hibernate.jpa.test.metamodel.LineItem_;
|
||||
import org.hibernate.jpa.test.metamodel.Order;
|
||||
import org.hibernate.jpa.test.metamodel.Order_;
|
||||
|
||||
import org.hibernate.testing.orm.junit.EntityManagerFactoryScope;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Similar to {@link org.hibernate.orm.test.query.hql.OnKeywordTest}, but here testing from JPA criteria queries.
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class OnKeywordTest extends AbstractCriteriaTest {
|
||||
@Test
|
||||
public void basicTest(EntityManagerFactoryScope scope) {
|
||||
|
||||
scope.inTransaction(
|
||||
entityManager -> {
|
||||
try {
|
||||
CriteriaQuery<Order> criteria = entityManager.getCriteriaBuilder().createQuery( Order.class );
|
||||
Root<Order> root = criteria.from( Order.class );
|
||||
criteria.select( root );
|
||||
CollectionJoin<Order,LineItem> lineItemsJoin = root.join( Order_.lineItems );
|
||||
lineItemsJoin.on(
|
||||
entityManager.getCriteriaBuilder().gt(
|
||||
lineItemsJoin.get( LineItem_.quantity ),
|
||||
entityManager.getCriteriaBuilder().literal( 20 )
|
||||
)
|
||||
);
|
||||
entityManager.createQuery( criteria ).getResultList();
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
package org.hibernate.orm.test.jpa.criteria.basic;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.util.List;
|
||||
import javax.persistence.criteria.CriteriaBuilder;
|
||||
import javax.persistence.criteria.CriteriaQuery;
|
||||
import javax.persistence.criteria.Root;
|
||||
|
||||
import org.hibernate.dialect.DerbyDialect;
|
||||
import org.hibernate.jpa.test.metamodel.Product;
|
||||
import org.hibernate.jpa.test.metamodel.Product_;
|
||||
import org.hibernate.orm.test.jpa.criteria.AbstractCriteriaTest;
|
||||
|
||||
import org.hibernate.testing.SkipForDialect;
|
||||
import org.hibernate.testing.TestForIssue;
|
||||
import org.hibernate.testing.orm.junit.EntityManagerFactoryScope;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class CastTest extends AbstractCriteriaTest {
|
||||
private static final int QUANTITY = 2;
|
||||
|
||||
@AfterEach
|
||||
public void tearDown(EntityManagerFactoryScope scope) {
|
||||
scope.inTransaction(
|
||||
entityManager -> {
|
||||
entityManager.createQuery( "delete from Product" ).executeUpdate();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
@SkipForDialect(value = DerbyDialect.class, comment = "Derby does not support cast from INTEGER to VARCHAR")
|
||||
@TestForIssue(jiraKey = "HHH-5755")
|
||||
public void testCastToString(EntityManagerFactoryScope scope) {
|
||||
scope.inTransaction(
|
||||
entityManager -> {
|
||||
Product product = new Product();
|
||||
product.setId( "product1" );
|
||||
product.setPrice( 1.23d );
|
||||
product.setQuantity( QUANTITY );
|
||||
product.setPartNumber( ( (long) Integer.MAX_VALUE ) + 1 );
|
||||
product.setRating( 1.999f );
|
||||
product.setSomeBigInteger( BigInteger.valueOf( 987654321 ) );
|
||||
product.setSomeBigDecimal( BigDecimal.valueOf( 987654.321 ) );
|
||||
entityManager.persist( product );
|
||||
}
|
||||
);
|
||||
|
||||
scope.inTransaction(
|
||||
entityManager -> {
|
||||
CriteriaBuilder builder = entityManager.getCriteriaBuilder();
|
||||
CriteriaQuery<Product> criteria = builder.createQuery( Product.class );
|
||||
Root<Product> root = criteria.from( Product.class );
|
||||
criteria.where( builder.equal(
|
||||
root.get( Product_.quantity ).as( String.class ),
|
||||
builder.literal( String.valueOf( QUANTITY ) )
|
||||
) );
|
||||
List<Product> result = entityManager.createQuery( criteria ).getResultList();
|
||||
Assertions.assertEquals( 1, result.size() );
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
@ -4,30 +4,31 @@
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
package org.hibernate.jpa.test.ejb3configuration;
|
||||
package org.hibernate.orm.test.jpa.ejb3configuration;
|
||||
|
||||
import java.util.Collections;
|
||||
import javax.persistence.SharedCacheMode;
|
||||
import javax.persistence.ValidationMode;
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.jpa.AvailableSettings;
|
||||
import org.hibernate.cfg.AvailableSettings;
|
||||
import org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl;
|
||||
import org.hibernate.jpa.boot.spi.Bootstrap;
|
||||
import org.hibernate.jpa.test.PersistenceUnitInfoAdapter;
|
||||
|
||||
import org.hibernate.testing.junit4.BaseUnitTestCase;
|
||||
import org.junit.Test;
|
||||
import org.hibernate.testing.orm.junit.BaseUnitTest;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
|
||||
/**
|
||||
* Test passing along various config settings that take objects other than strings as values.
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class ConfigurationObjectSettingTest extends BaseUnitTestCase {
|
||||
@BaseUnitTest
|
||||
public class ConfigurationObjectSettingTest {
|
||||
@Test
|
||||
public void testContainerBootstrapSharedCacheMode() {
|
||||
// first, via the integration vars
|
||||
@ -36,17 +37,17 @@ public void testContainerBootstrapSharedCacheMode() {
|
||||
// as object
|
||||
EntityManagerFactoryBuilderImpl builder = (EntityManagerFactoryBuilderImpl) Bootstrap.getEntityManagerFactoryBuilder(
|
||||
empty,
|
||||
Collections.singletonMap( AvailableSettings.SHARED_CACHE_MODE, SharedCacheMode.DISABLE_SELECTIVE )
|
||||
Collections.singletonMap( AvailableSettings.JPA_SHARED_CACHE_MODE, SharedCacheMode.DISABLE_SELECTIVE )
|
||||
);
|
||||
assertEquals( SharedCacheMode.DISABLE_SELECTIVE, builder.getConfigurationValues().get( AvailableSettings.SHARED_CACHE_MODE ) );
|
||||
assertEquals( SharedCacheMode.DISABLE_SELECTIVE, builder.getConfigurationValues().get( AvailableSettings.JPA_SHARED_CACHE_MODE ) );
|
||||
}
|
||||
{
|
||||
// as string
|
||||
EntityManagerFactoryBuilderImpl builder = (EntityManagerFactoryBuilderImpl) Bootstrap.getEntityManagerFactoryBuilder(
|
||||
empty,
|
||||
Collections.singletonMap( AvailableSettings.SHARED_CACHE_MODE, SharedCacheMode.DISABLE_SELECTIVE.name() )
|
||||
Collections.singletonMap( AvailableSettings.JPA_SHARED_CACHE_MODE, SharedCacheMode.DISABLE_SELECTIVE.name() )
|
||||
);
|
||||
assertEquals( SharedCacheMode.DISABLE_SELECTIVE.name(), builder.getConfigurationValues().get( AvailableSettings.SHARED_CACHE_MODE ) );
|
||||
assertEquals( SharedCacheMode.DISABLE_SELECTIVE.name(), builder.getConfigurationValues().get( AvailableSettings.JPA_SHARED_CACHE_MODE ) );
|
||||
}
|
||||
|
||||
// next, via the PUI
|
||||
@ -61,16 +62,16 @@ public SharedCacheMode getSharedCacheMode() {
|
||||
adapter,
|
||||
null
|
||||
);
|
||||
assertEquals( SharedCacheMode.ENABLE_SELECTIVE, builder.getConfigurationValues().get( AvailableSettings.SHARED_CACHE_MODE ) );
|
||||
assertEquals( SharedCacheMode.ENABLE_SELECTIVE, builder.getConfigurationValues().get( AvailableSettings.JPA_SHARED_CACHE_MODE ) );
|
||||
}
|
||||
|
||||
// via both, integration vars should take precedence
|
||||
{
|
||||
EntityManagerFactoryBuilderImpl builder = (EntityManagerFactoryBuilderImpl) Bootstrap.getEntityManagerFactoryBuilder(
|
||||
adapter,
|
||||
Collections.singletonMap( AvailableSettings.SHARED_CACHE_MODE, SharedCacheMode.DISABLE_SELECTIVE )
|
||||
Collections.singletonMap( AvailableSettings.JPA_SHARED_CACHE_MODE, SharedCacheMode.DISABLE_SELECTIVE )
|
||||
);
|
||||
assertEquals( SharedCacheMode.DISABLE_SELECTIVE, builder.getConfigurationValues().get( AvailableSettings.SHARED_CACHE_MODE ) );
|
||||
assertEquals( SharedCacheMode.DISABLE_SELECTIVE, builder.getConfigurationValues().get( AvailableSettings.JPA_SHARED_CACHE_MODE ) );
|
||||
}
|
||||
}
|
||||
|
||||
@ -82,17 +83,17 @@ public void testContainerBootstrapValidationMode() {
|
||||
// as object
|
||||
EntityManagerFactoryBuilderImpl builder = (EntityManagerFactoryBuilderImpl) Bootstrap.getEntityManagerFactoryBuilder(
|
||||
empty,
|
||||
Collections.singletonMap( AvailableSettings.VALIDATION_MODE, ValidationMode.CALLBACK )
|
||||
Collections.singletonMap( AvailableSettings.JPA_VALIDATION_MODE, ValidationMode.CALLBACK )
|
||||
);
|
||||
assertEquals( ValidationMode.CALLBACK, builder.getConfigurationValues().get( AvailableSettings.VALIDATION_MODE ) );
|
||||
assertEquals( ValidationMode.CALLBACK, builder.getConfigurationValues().get( AvailableSettings.JPA_VALIDATION_MODE ) );
|
||||
}
|
||||
{
|
||||
// as string
|
||||
EntityManagerFactoryBuilderImpl builder = (EntityManagerFactoryBuilderImpl) Bootstrap.getEntityManagerFactoryBuilder(
|
||||
empty,
|
||||
Collections.singletonMap( AvailableSettings.VALIDATION_MODE, ValidationMode.CALLBACK.name() )
|
||||
Collections.singletonMap( AvailableSettings.JPA_VALIDATION_MODE, ValidationMode.CALLBACK.name() )
|
||||
);
|
||||
assertEquals( ValidationMode.CALLBACK.name(), builder.getConfigurationValues().get( AvailableSettings.VALIDATION_MODE ) );
|
||||
assertEquals( ValidationMode.CALLBACK.name(), builder.getConfigurationValues().get( AvailableSettings.JPA_VALIDATION_MODE ) );
|
||||
}
|
||||
|
||||
// next, via the PUI
|
||||
@ -107,16 +108,16 @@ public ValidationMode getValidationMode() {
|
||||
adapter,
|
||||
null
|
||||
);
|
||||
assertEquals( ValidationMode.CALLBACK, builder.getConfigurationValues().get( AvailableSettings.VALIDATION_MODE ) );
|
||||
assertEquals( ValidationMode.CALLBACK, builder.getConfigurationValues().get( AvailableSettings.JPA_VALIDATION_MODE ) );
|
||||
}
|
||||
|
||||
// via both, integration vars should take precedence
|
||||
{
|
||||
EntityManagerFactoryBuilderImpl builder = (EntityManagerFactoryBuilderImpl) Bootstrap.getEntityManagerFactoryBuilder(
|
||||
adapter,
|
||||
Collections.singletonMap( AvailableSettings.VALIDATION_MODE, ValidationMode.NONE )
|
||||
Collections.singletonMap( AvailableSettings.JPA_VALIDATION_MODE, ValidationMode.NONE )
|
||||
);
|
||||
assertEquals( ValidationMode.NONE, builder.getConfigurationValues().get( AvailableSettings.VALIDATION_MODE ) );
|
||||
assertEquals( ValidationMode.NONE, builder.getConfigurationValues().get( AvailableSettings.JPA_VALIDATION_MODE ) );
|
||||
}
|
||||
}
|
||||
|
||||
@ -127,7 +128,7 @@ public void testContainerBootstrapValidationFactory() {
|
||||
try {
|
||||
Bootstrap.getEntityManagerFactoryBuilder(
|
||||
adapter,
|
||||
Collections.singletonMap( AvailableSettings.VALIDATION_FACTORY, token )
|
||||
Collections.singletonMap( AvailableSettings.JPA_VALIDATION_FACTORY, token )
|
||||
);
|
||||
fail( "Was expecting error as token did not implement ValidatorFactory" );
|
||||
}
|
@ -4,7 +4,7 @@
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
package org.hibernate.jpa.test.ejb3configuration;
|
||||
package org.hibernate.orm.test.jpa.ejb3configuration;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
@ -17,28 +17,38 @@
|
||||
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.cfg.AvailableSettings;
|
||||
import org.hibernate.jpa.HibernateEntityManager;
|
||||
import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase;
|
||||
import org.hibernate.jpa.test.Cat;
|
||||
import org.hibernate.jpa.test.Distributor;
|
||||
import org.hibernate.jpa.test.Item;
|
||||
import org.hibernate.jpa.test.Kitten;
|
||||
import org.hibernate.jpa.test.Wallet;
|
||||
import org.hibernate.testing.orm.junit.EntityManagerFactoryScope;
|
||||
import org.hibernate.testing.orm.junit.Jpa;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
/**
|
||||
* @author Emmanuel Bernard
|
||||
*/
|
||||
public class EntityManagerFactorySerializationTest extends BaseEntityManagerFunctionalTestCase {
|
||||
|
||||
@Jpa(annotatedClasses = {
|
||||
Item.class,
|
||||
Distributor.class,
|
||||
Wallet.class,
|
||||
Cat.class,
|
||||
Kitten.class
|
||||
})
|
||||
public class EntityManagerFactorySerializationTest {
|
||||
|
||||
@Test
|
||||
public void testSerialization() throws Exception {
|
||||
public void testSerialization(EntityManagerFactoryScope scope) throws Exception {
|
||||
EntityManagerFactory emf = scope.getEntityManagerFactory();
|
||||
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||
ObjectOutput out = new ObjectOutputStream( stream );
|
||||
out.writeObject( entityManagerFactory() );
|
||||
out.writeObject( emf );
|
||||
out.close();
|
||||
byte[] serialized = stream.toByteArray();
|
||||
stream.close();
|
||||
@ -94,8 +104,8 @@ public void testSerialization() throws Exception {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEntityManagerFactorySerialization() throws Exception {
|
||||
EntityManagerFactory entityManagerFactory = entityManagerFactory();
|
||||
public void testEntityManagerFactorySerialization(EntityManagerFactoryScope scope) throws Exception {
|
||||
EntityManagerFactory entityManagerFactory = scope.getEntityManagerFactory();
|
||||
|
||||
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||
ObjectOutput out = new ObjectOutputStream( stream );
|
||||
@ -109,27 +119,18 @@ public void testEntityManagerFactorySerialization() throws Exception {
|
||||
in.close();
|
||||
byteIn.close();
|
||||
|
||||
assertTrue("deserialized EntityManagerFactory should be the same original EntityManagerFactory instance",
|
||||
entityManagerFactory2 == entityManagerFactory);
|
||||
assertTrue(
|
||||
entityManagerFactory2 == entityManagerFactory,
|
||||
"deserialized EntityManagerFactory should be the same original EntityManagerFactory instance"
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEntityManagerFactoryProperties() {
|
||||
EntityManagerFactory entityManagerFactory = entityManagerFactory();
|
||||
public void testEntityManagerFactoryProperties(EntityManagerFactoryScope scope) {
|
||||
EntityManagerFactory entityManagerFactory = scope.getEntityManagerFactory();
|
||||
assertTrue( entityManagerFactory.getProperties().containsKey( AvailableSettings.USER ) );
|
||||
if ( entityManagerFactory.getProperties().containsKey( AvailableSettings.PASS ) ) {
|
||||
assertEquals( "****", entityManagerFactory.getProperties().get( AvailableSettings.PASS ) );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class[] getAnnotatedClasses() {
|
||||
return new Class[]{
|
||||
Item.class,
|
||||
Distributor.class,
|
||||
Wallet.class,
|
||||
Cat.class,
|
||||
Kitten.class
|
||||
};
|
||||
}
|
||||
}
|
@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
//$Id$
|
||||
package org.hibernate.jpa.test.ejb3configuration;
|
||||
package org.hibernate.orm.test.jpa.ejb3configuration;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
@ -4,7 +4,7 @@
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
package org.hibernate.jpa.test.ejb3configuration;
|
||||
package org.hibernate.orm.test.jpa.ejb3configuration;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
@ -16,8 +16,6 @@
|
||||
import org.hibernate.boot.Metadata;
|
||||
import org.hibernate.boot.MetadataSources;
|
||||
import org.hibernate.boot.SessionFactoryBuilder;
|
||||
import org.hibernate.boot.model.naming.ImplicitNamingStrategyJpaCompliantImpl;
|
||||
import org.hibernate.boot.registry.StandardServiceRegistry;
|
||||
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
|
||||
import org.hibernate.boot.registry.internal.StandardServiceRegistryImpl;
|
||||
import org.hibernate.cfg.Environment;
|
||||
@ -29,13 +27,13 @@
|
||||
import org.hibernate.jpa.test.PersistenceUnitDescriptorAdapter;
|
||||
import org.hibernate.jpa.test.SettingsGenerator;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
|
||||
import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate;
|
||||
import static org.hibernate.testing.transaction.TransactionUtil.doInJPA;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
|
||||
/**
|
||||
* @author Emmanuel Bernard
|
||||
@ -51,7 +49,7 @@ public Class[] getAnnotatedClasses() {
|
||||
|
||||
private EntityManagerFactory entityManagerFactory;
|
||||
|
||||
@After
|
||||
@AfterEach
|
||||
public void releaseResources() {
|
||||
if ( entityManagerFactory != null ) {
|
||||
entityManagerFactory.close();
|
@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
//$
|
||||
package org.hibernate.jpa.test.ejb3configuration;
|
||||
package org.hibernate.orm.test.jpa.ejb3configuration;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
@ -4,7 +4,7 @@
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
package org.hibernate.jpa.test.ejb3configuration;
|
||||
package org.hibernate.orm.test.jpa.ejb3configuration;
|
||||
|
||||
import javax.persistence.EntityManagerFactory;
|
||||
import java.util.Collections;
|
||||
@ -15,17 +15,18 @@
|
||||
import org.hibernate.jpa.test.MyNamingStrategy;
|
||||
import org.hibernate.jpa.test.PersistenceUnitInfoAdapter;
|
||||
|
||||
import org.hibernate.testing.junit4.BaseUnitTestCase;
|
||||
import org.junit.Test;
|
||||
import org.hibernate.testing.orm.junit.BaseUnitTest;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.hibernate.testing.junit4.ExtraAssertions.assertTyping;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.hibernate.testing.junit5.ExtraAssertions.assertTyping;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
|
||||
/**
|
||||
* @author Gail Badner
|
||||
*/
|
||||
public class NamingStrategyConfigurationTest extends BaseUnitTestCase {
|
||||
@BaseUnitTest
|
||||
public class NamingStrategyConfigurationTest {
|
||||
|
||||
@Test
|
||||
public void testNamingStrategyFromProperty() {
|
||||
@ -35,7 +36,10 @@ public void testNamingStrategyFromProperty() {
|
||||
PersistenceUnitInfoAdapter adapter = new PersistenceUnitInfoAdapter();
|
||||
EntityManagerFactoryBuilderImpl builder = (EntityManagerFactoryBuilderImpl) Bootstrap.getEntityManagerFactoryBuilder(
|
||||
adapter,
|
||||
Collections.singletonMap( AvailableSettings.PHYSICAL_NAMING_STRATEGY, MyNamingStrategy.class.getName() )
|
||||
Collections.singletonMap(
|
||||
AvailableSettings.PHYSICAL_NAMING_STRATEGY,
|
||||
MyNamingStrategy.class.getName()
|
||||
)
|
||||
);
|
||||
final EntityManagerFactory emf = builder.build();
|
||||
try {
|
||||
@ -48,8 +52,9 @@ public void testNamingStrategyFromProperty() {
|
||||
MyNamingStrategy.class,
|
||||
builder.getMetadata().getMetadataBuildingOptions().getPhysicalNamingStrategy()
|
||||
);
|
||||
}finally {
|
||||
if(emf != null){
|
||||
}
|
||||
finally {
|
||||
if ( emf != null ) {
|
||||
emf.close();
|
||||
}
|
||||
}
|
@ -4,7 +4,7 @@
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
package org.hibernate.jpa.test.ejb3configuration;
|
||||
package org.hibernate.orm.test.jpa.ejb3configuration;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Arrays;
|
||||
@ -39,6 +39,7 @@
|
||||
import org.hibernate.jpa.boot.spi.Bootstrap;
|
||||
import org.hibernate.jpa.test.PersistenceUnitDescriptorAdapter;
|
||||
import org.hibernate.jpa.test.SettingsGenerator;
|
||||
import org.hibernate.jpa.test.ejb3configuration.Bell;
|
||||
import org.hibernate.mapping.Collection;
|
||||
import org.hibernate.mapping.PersistentClass;
|
||||
import org.hibernate.metadata.ClassMetadata;
|
||||
@ -67,8 +68,8 @@
|
||||
import org.hibernate.type.VersionType;
|
||||
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:emmanuel@hibernate.org">Emmanuel Bernard</a>
|
||||
@ -89,9 +90,9 @@ public void testPersisterClassProvider() {
|
||||
entityManagerFactory.close();
|
||||
}
|
||||
catch ( PersistenceException e ) {
|
||||
Assert.assertNotNull( e.getCause() );
|
||||
Assert.assertNotNull( e.getCause().getCause() );
|
||||
Assert.assertEquals( GoofyException.class, e.getCause().getCause().getClass() );
|
||||
Assertions.assertNotNull( e.getCause() );
|
||||
Assertions.assertNotNull( e.getCause().getCause() );
|
||||
Assertions.assertEquals( GoofyException.class, e.getCause().getCause().getClass() );
|
||||
|
||||
}
|
||||
}
|
@ -4,14 +4,14 @@
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
package org.hibernate.jpa.test.ejb3configuration;
|
||||
package org.hibernate.orm.test.jpa.ejb3configuration;
|
||||
|
||||
import javax.persistence.EntityManagerFactory;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.hibernate.SessionFactoryObserver;
|
||||
@ -38,7 +38,7 @@ public void testSessionFactoryObserverProperty() {
|
||||
try {
|
||||
final EntityManagerFactory entityManagerFactory = builder.build();
|
||||
entityManagerFactory.close();
|
||||
Assert.fail( "GoofyException should have been thrown" );
|
||||
Assertions.fail( "GoofyException should have been thrown" );
|
||||
}
|
||||
catch ( GoofyException e ) {
|
||||
//success
|
@ -4,7 +4,7 @@
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
package org.hibernate.jpa.test.ejb3configuration.id;
|
||||
package org.hibernate.orm.test.jpa.ejb3configuration.id;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
@ -4,7 +4,7 @@
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
package org.hibernate.jpa.test.ejb3configuration.id;
|
||||
package org.hibernate.orm.test.jpa.ejb3configuration.id;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:emmanuel@hibernate.org">Emmanuel Bernard</a>
|
@ -4,7 +4,7 @@
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
package org.hibernate.jpa.test.ejb3configuration.id;
|
||||
package org.hibernate.orm.test.jpa.ejb3configuration.id;
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
@ -4,7 +4,7 @@
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
package org.hibernate.jpa.test.ejb3configuration.id;
|
||||
package org.hibernate.orm.test.jpa.ejb3configuration.id;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
@ -4,7 +4,7 @@
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
package org.hibernate.jpa.test.ejb3configuration.id;
|
||||
package org.hibernate.orm.test.jpa.ejb3configuration.id;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.EntityManagerFactory;
|
||||
@ -17,8 +17,8 @@
|
||||
import org.hibernate.jpa.AvailableSettings;
|
||||
import org.hibernate.jpa.boot.spi.Bootstrap;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:emmanuel@hibernate.org">Emmanuel Bernard</a>
|
||||
@ -43,7 +43,7 @@ public void testIdentifierGeneratorStrategyProvider() {
|
||||
try {
|
||||
entityManager.persist( new Cable() );
|
||||
entityManager.flush();
|
||||
Assert.fail( "FunkyException should have been thrown when the id is generated" );
|
||||
Assertions.fail( "FunkyException should have been thrown when the id is generated" );
|
||||
}
|
||||
catch ( FunkyException e ) {
|
||||
entityManager.close();
|
@ -21,7 +21,7 @@
|
||||
import org.hibernate.dialect.H2Dialect;
|
||||
import org.hibernate.engine.jdbc.connections.internal.UserSuppliedConnectionProviderImpl;
|
||||
import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase;
|
||||
import org.hibernate.jpa.test.connection.BaseDataSource;
|
||||
import org.hibernate.orm.test.jpa.connection.BaseDataSource;
|
||||
|
||||
import org.hibernate.testing.RequiresDialect;
|
||||
import org.hibernate.testing.TestForIssue;
|
||||
|
Loading…
x
Reference in New Issue
Block a user