use of org.apache.tapestry5.hibernate.internal.DefaultHibernateConfigurer in project tapestry-5 by apache.
the class DefaultHibernateConfigurerFilterTest method configure_with_default_configuration_off.
public void configure_with_default_configuration_off() throws Exception {
Configuration config = newMock(Configuration.class);
replay();
new DefaultHibernateConfigurer(false).configure(config);
verify();
}
use of org.apache.tapestry5.hibernate.internal.DefaultHibernateConfigurer in project tapestry-5 by apache.
the class HibernateSessionSourceImplTest method startup_without_packages.
@Test
public void startup_without_packages() {
Collection<String> packageNames = CollectionFactory.newList("org.example.myapp.entities", "org.example.app0.entities");
HibernateEntityPackageManager packageManager = newMock(HibernateEntityPackageManager.class);
TestBase.expect(packageManager.getPackageNames()).andReturn(packageNames);
ClasspathScannerImpl scanner = new ClasspathScannerImpl(new ClasspathURLConverterImpl());
ClassNameLocatorImpl classNameLocator = new ClassNameLocatorImpl(scanner);
List<HibernateConfigurer> filters = Arrays.asList(new DefaultHibernateConfigurer(true), new PackageNameHibernateConfigurer(packageManager, classNameLocator));
replay();
HibernateSessionSource source = new HibernateSessionSourceImpl(log, filters);
Session session = source.create();
Assert.assertNotNull(session);
// make sure it found the entity in the package
ClassMetadata meta = session.getSessionFactory().getClassMetadata(User.class);
Assert.assertEquals(meta.getEntityName(), "org.example.app0.entities.User");
verify();
}
use of org.apache.tapestry5.hibernate.internal.DefaultHibernateConfigurer in project tapestry-5 by apache.
the class DefaultHibernateConfigurerFilterTest method configure_with_default_configuration_on.
public void configure_with_default_configuration_on() throws Exception {
Configuration config = newMock(Configuration.class);
expect(config.configure()).andReturn(config);
replay();
new DefaultHibernateConfigurer(true).configure(config);
verify();
}
Aggregations