Search in sources :

Example 81 with TestForIssue

use of org.hibernate.testing.TestForIssue in project hibernate-orm by hibernate.

the class GetterSetterSerializationTest method testPrivateFieldGetter.

@Test
@TestForIssue(jiraKey = "HHH-11202")
public void testPrivateFieldGetter() throws Exception {
    final AnEntity entity = new AnEntity(new PK(1L));
    final Getter getter = new GetterFieldImpl(AnEntity.class, "pk", ReflectHelper.findField(AnEntity.class, "pk"));
    final ByteArrayOutputStream baos = new ByteArrayOutputStream();
    final ObjectOutputStream oos = new ObjectOutputStream(baos);
    oos.writeObject(getter);
    final ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray()));
    final Getter getterClone = (Getter) ois.readObject();
    assertSame(getter.get(entity), getterClone.get(entity));
}
Also used : GetterFieldImpl(org.hibernate.property.access.spi.GetterFieldImpl) ByteArrayInputStream(java.io.ByteArrayInputStream) Getter(org.hibernate.property.access.spi.Getter) PK(org.hibernate.serialization.entity.PK) ByteArrayOutputStream(java.io.ByteArrayOutputStream) AnEntity(org.hibernate.serialization.entity.AnEntity) ObjectOutputStream(java.io.ObjectOutputStream) ObjectInputStream(java.io.ObjectInputStream) Test(org.junit.Test) TestForIssue(org.hibernate.testing.TestForIssue)

Example 82 with TestForIssue

use of org.hibernate.testing.TestForIssue in project hibernate-orm by hibernate.

the class JpaSchemaGeneratorTest method testSqlDropScriptSourceClasspath.

@SuppressWarnings("unchecked")
@Test
@TestForIssue(jiraKey = "HHH-8271")
public void testSqlDropScriptSourceClasspath() throws Exception {
    Map settings = buildSettings();
    settings.put(AvailableSettings.HBM2DDL_DROP_SOURCE, "metadata-then-script");
    settings.put(AvailableSettings.HBM2DDL_DATABASE_ACTION, "drop");
    settings.put(AvailableSettings.HBM2DDL_DROP_SCRIPT_SOURCE, getDropSqlScript());
    doTest(settings);
}
Also used : Map(java.util.Map) Test(org.junit.Test) TestForIssue(org.hibernate.testing.TestForIssue)

Example 83 with TestForIssue

use of org.hibernate.testing.TestForIssue in project hibernate-orm by hibernate.

the class JpaSchemaGeneratorTest method testSqlCreateScriptSourceUrl.

@SuppressWarnings("unchecked")
@Test
@TestForIssue(jiraKey = "HHH-8271")
public void testSqlCreateScriptSourceUrl() throws Exception {
    Map settings = buildSettings();
    settings.put(AvailableSettings.HBM2DDL_DATABASE_ACTION, "drop-and-create");
    settings.put(AvailableSettings.HBM2DDL_CREATE_SOURCE, "metadata-then-script");
    settings.put(AvailableSettings.HBM2DDL_CREATE_SCRIPT_SOURCE, getResourceUrlString(getCreateSqlScript()));
    doTest(settings);
}
Also used : Map(java.util.Map) Test(org.junit.Test) TestForIssue(org.hibernate.testing.TestForIssue)

Example 84 with TestForIssue

use of org.hibernate.testing.TestForIssue in project hibernate-orm by hibernate.

the class JpaSchemaGeneratorTest method testSqlLoadScriptSourceClasspath.

@SuppressWarnings("unchecked")
@Test
@TestForIssue(jiraKey = "HHH-8271")
public void testSqlLoadScriptSourceClasspath() throws Exception {
    Map settings = buildSettings();
    settings.put(AvailableSettings.HBM2DDL_DATABASE_ACTION, "drop-and-create");
    settings.put(AvailableSettings.HBM2DDL_LOAD_SCRIPT_SOURCE, getLoadSqlScript());
    doTest(settings);
}
Also used : Map(java.util.Map) Test(org.junit.Test) TestForIssue(org.hibernate.testing.TestForIssue)

Example 85 with TestForIssue

use of org.hibernate.testing.TestForIssue in project hibernate-orm by hibernate.

the class JpaSchemaGeneratorTest method testSqlDropScriptSourceUrl.

@SuppressWarnings("unchecked")
@Test
@TestForIssue(jiraKey = "HHH-8271")
public void testSqlDropScriptSourceUrl() throws Exception {
    Map settings = buildSettings();
    settings.put(AvailableSettings.HBM2DDL_DROP_SOURCE, "metadata-then-script");
    settings.put(AvailableSettings.HBM2DDL_DATABASE_ACTION, "drop");
    settings.put(AvailableSettings.HBM2DDL_DROP_SCRIPT_SOURCE, getResourceUrlString(getDropSqlScript()));
    doTest(settings);
}
Also used : Map(java.util.Map) Test(org.junit.Test) TestForIssue(org.hibernate.testing.TestForIssue)

Aggregations

TestForIssue (org.hibernate.testing.TestForIssue)649 Test (org.junit.Test)647 Session (org.hibernate.Session)357 EntityManager (javax.persistence.EntityManager)97 List (java.util.List)91 Transaction (org.hibernate.Transaction)88 MetadataSources (org.hibernate.boot.MetadataSources)47 ArrayList (java.util.ArrayList)38 CriteriaBuilder (javax.persistence.criteria.CriteriaBuilder)38 Query (org.hibernate.Query)28 MetadataImplementor (org.hibernate.boot.spi.MetadataImplementor)25 Metadata (org.hibernate.boot.Metadata)24 StandardServiceRegistryBuilder (org.hibernate.boot.registry.StandardServiceRegistryBuilder)24 StandardServiceRegistry (org.hibernate.boot.registry.StandardServiceRegistry)23 Map (java.util.Map)22 CollectionEntry (org.hibernate.engine.spi.CollectionEntry)19 HashMap (java.util.HashMap)18 SessionImplementor (org.hibernate.engine.spi.SessionImplementor)18 PersistentClass (org.hibernate.mapping.PersistentClass)18 HibernateException (org.hibernate.HibernateException)16