use of org.hibernate.testing.FailureExpected in project hibernate-orm by hibernate.
the class EmbeddableWithOne2ManyTest method testJoinAcrossEmbedded.
@Test
@FailureExpected(jiraKey = "HHH-4883")
public void testJoinAcrossEmbedded() {
// NOTE : this may or may not work now with HHH-4883 fixed,
// but i cannot do this checking until HHH-4599 is done.
Session session = openSession();
session.beginTransaction();
session.createQuery("from Person p join p.name.aliases a where a.source = 'FBI'").list();
session.getTransaction().commit();
session.close();
}
use of org.hibernate.testing.FailureExpected in project hibernate-orm by hibernate.
the class EmbeddableWithOne2ManyTest method testBasicOps.
@Test
@FailureExpected(jiraKey = "HHH-4599")
public void testBasicOps() {
Session session = openSession();
session.beginTransaction();
Alias alias = new Alias("Public Enemy", "Number 1", "FBI");
session.persist(alias);
Person person = new Person("John", "Dillinger");
person.getName().getAliases().add(alias);
session.persist(person);
session.getTransaction().commit();
session.close();
session = openSession();
session.beginTransaction();
person = (Person) session.load(Person.class, person.getId());
session.delete(person);
List aliases = session.createQuery("from Alias").list();
assertEquals(0, aliases.size());
session.getTransaction().commit();
session.close();
}
use of org.hibernate.testing.FailureExpected in project hibernate-orm by hibernate.
the class DefaultCacheConcurrencyPropertyTest method testExplicitDefault.
@Test
@TestForIssue(jiraKey = "HHH-9763")
@FailureExpected(jiraKey = "HHH-9763")
public void testExplicitDefault() {
final StandardServiceRegistry ssr = new StandardServiceRegistryBuilder().applySetting(AvailableSettings.DEFAULT_CACHE_CONCURRENCY_STRATEGY, "read-only").build();
try {
assertEquals("read-only", ssr.getService(ConfigurationService.class).getSettings().get(AvailableSettings.DEFAULT_CACHE_CONCURRENCY_STRATEGY));
final MetadataImplementor metadata = (MetadataImplementor) new MetadataSources(ssr).addAnnotatedClass(TheEntity.class).buildMetadata();
assertEquals(AccessType.READ_ONLY, metadata.getMetadataBuildingOptions().getMappingDefaults().getImplicitCacheAccessType());
final SessionFactoryImplementor sf = (SessionFactoryImplementor) metadata.buildSessionFactory();
try {
final EntityPersister persister = sf.getMetamodel().entityPersister(TheEntity.class.getName());
assertNotNull(persister.getCacheAccessStrategy());
} finally {
sf.close();
}
} finally {
StandardServiceRegistryBuilder.destroy(ssr);
}
}
use of org.hibernate.testing.FailureExpected in project hibernate-orm by hibernate.
the class BrokenCollectionEventTest method testUpdateParentNoChildrenToNull.
@Test
@FailureExpected(jiraKey = "unknown")
public void testUpdateParentNoChildrenToNull() {
CollectionListeners listeners = new CollectionListeners(sessionFactory());
ParentWithCollection parent = createParentWithNoChildren("parent");
listeners.clear();
assertEquals(0, parent.getChildren().size());
Session s = openSession();
Transaction tx = s.beginTransaction();
parent = (ParentWithCollection) s.get(parent.getClass(), parent.getId());
Collection oldCollection = parent.getChildren();
parent.newChildren(null);
tx.commit();
s.close();
int index = 0;
if (((PersistentCollection) oldCollection).wasInitialized()) {
checkResult(listeners, listeners.getInitializeCollectionListener(), parent, oldCollection, index++);
}
checkResult(listeners, listeners.getPreCollectionRemoveListener(), parent, oldCollection, index++);
checkResult(listeners, listeners.getPostCollectionRemoveListener(), parent, oldCollection, index++);
// pre- and post- collection recreate events should be created when updating an entity with a "null" collection
checkResult(listeners, listeners.getPreCollectionRecreateListener(), parent, index++);
checkResult(listeners, listeners.getPostCollectionRecreateListener(), parent, index++);
checkNumberOfResults(listeners, index);
}
use of org.hibernate.testing.FailureExpected in project hibernate-orm by hibernate.
the class BrokenCollectionEventTest method testUpdateDetachedParentNoChildrenToNull.
@Test
@FailureExpected(jiraKey = "unknown")
public void testUpdateDetachedParentNoChildrenToNull() {
CollectionListeners listeners = new CollectionListeners(sessionFactory());
ParentWithCollection parent = createParentWithNoChildren("parent");
listeners.clear();
assertEquals(0, parent.getChildren().size());
Session s = openSession();
Transaction tx = s.beginTransaction();
Collection oldCollection = parent.getChildren();
parent.newChildren(null);
s.update(parent);
tx.commit();
s.close();
int index = 0;
checkResult(listeners, listeners.getPreCollectionRemoveListener(), parent, oldCollection, index++);
checkResult(listeners, listeners.getPostCollectionRemoveListener(), parent, oldCollection, index++);
// pre- and post- collection recreate events should be created when updating an entity with a "null" collection
checkResult(listeners, listeners.getPreCollectionRecreateListener(), parent, index++);
checkResult(listeners, listeners.getPostCollectionRecreateListener(), parent, index++);
checkNumberOfResults(listeners, index);
}
Aggregations