Package javango.contrib.hibernate

Examples of javango.contrib.hibernate.HibernateModule


import junit.framework.TestCase;

public class HibernateManagerTest extends TestCase {

  public void testManagerFactory() throws Exception {
      Injector injector = Guice.createInjector(new HibernateModule());
    AnnotationConfiguration cfg = injector.getInstance(HibernateUtil.class).getConfiguration();   
    new SchemaExport(cfg).drop(false, true);
    new SchemaExport(cfg).create(false, true);
   
      Managers managers = injector.getInstance(Managers.class);     
View Full Code Here


     
      assertNotNull(poll);
  }
 
  public void testPk() throws Exception {
      Injector injector = Guice.createInjector(new HibernateModule());
    AnnotationConfiguration cfg = injector.getInstance(HibernateUtil.class).getConfiguration();   
    new SchemaExport(cfg).drop(false, true);
    new SchemaExport(cfg).create(false, true);
   
      Managers managers = injector.getInstance(Managers.class);     
View Full Code Here

      assertEquals(Long.class, keyClasses[0]);
      assertEquals(1L, manager.getPk(poll));
  }
 
  public void testSearch() throws Exception {
      Injector injector = Guice.createInjector(new HibernateModule());
    AnnotationConfiguration cfg = injector.getInstance(HibernateUtil.class).getConfiguration();   
    new SchemaExport(cfg).drop(false, true);
    new SchemaExport(cfg).create(false, true);
   
      Managers managers = injector.getInstance(Managers.class);     
View Full Code Here

      assertEquals(2, choiceManager.filter("poll__question", "What is this").count());

  }
 
  public void testPropertySearch() throws Exception {
    Injector injector = Guice.createInjector(new HibernateModule());
    AnnotationConfiguration cfg = injector.getInstance(HibernateUtil.class).getConfiguration();   
    new SchemaExport(cfg).drop(false, true);
    new SchemaExport(cfg).create(false, true);
   
      Managers managers = injector.getInstance(Managers.class);     
View Full Code Here

      assertEquals(2, choiceManager.filterByProperty("id__ne", "votes").count());
      assertEquals(2, choiceManager.filterByProperty("id__gt", "votes").count());
  }
 
  public void testMultipleJoinSearches() throws Exception {
      Injector injector = Guice.createInjector(new HibernateModule());
    AnnotationConfiguration cfg = injector.getInstance(HibernateUtil.class).getConfiguration();   
    new SchemaExport(cfg).drop(false, true);
    new SchemaExport(cfg).create(false, true);
   
      Managers managers = injector.getInstance(Managers.class);     
View Full Code Here

      qs = qs.filter("poll__id__eq", 2L);
      assertEquals(0, qs.count());
  }
 
  public void testMultipleJoins() throws Exception {
      Injector injector = Guice.createInjector(new HibernateModule());
    AnnotationConfiguration cfg = injector.getInstance(HibernateUtil.class).getConfiguration();   
    new SchemaExport(cfg).drop(false, true);
    new SchemaExport(cfg).create(false, true);
   
      Managers managers = injector.getInstance(Managers.class);     
View Full Code Here

      qs = qs.filter("poll__user__name__ilike", "JOE%");
      assertEquals(2, qs.count());
  }
 
  public void testJoinedOrderBy() throws Exception {
      Injector injector = Guice.createInjector(new HibernateModule());
    AnnotationConfiguration cfg = injector.getInstance(HibernateUtil.class).getConfiguration();   
    new SchemaExport(cfg).drop(false, true);
    new SchemaExport(cfg).create(false, true);
   
      Managers managers = injector.getInstance(Managers.class);     
View Full Code Here

      QuerySet<Choice> qs = choiceManager.all().orderBy("-poll__user__name", "poll__pubDate", "choice");
      qs.list(); // TODO for now just tesitng the sql output ..  make the test complete...
  }
 
  public void testDistinctEntry() throws Exception {
      Injector injector = Guice.createInjector(new HibernateModule());
    AnnotationConfiguration cfg = injector.getInstance(HibernateUtil.class).getConfiguration();   
    new SchemaExport(cfg).drop(false, true);
    new SchemaExport(cfg).create(false, true);
   
      Managers managers = injector.getInstance(Managers.class);     
View Full Code Here

      assertEquals(1, l.size());
      // humm,  qs.count() does not work..  bug somewhere (probably limitation of hibernate).
  }

  public void testInSet() throws Exception {
    Injector injector = Guice.createInjector(new HibernateModule());
    AnnotationConfiguration cfg = injector.getInstance(HibernateUtil.class).getConfiguration();   
    new SchemaExport(cfg).drop(false, true);
    new SchemaExport(cfg).create(false, true);
   
    Managers managers = injector.getInstance(Managers.class);     
View Full Code Here

  Injector injector;
  @Override
  protected void setUp() throws Exception {
    super.setUp();
    List<Module> modules = new ArrayList<Module>();
    modules.add(new HibernateModule());
    injector = new javango.contrib.admin.tests.AdminTestSettings().createInjector(modules);
   
    Configuration cfg = injector.getInstance(HibernateUtil.class).getConfiguration();
    new SchemaExport(cfg).drop(false, true);
    new SchemaExport(cfg).create(false, true);
View Full Code Here

TOP

Related Classes of javango.contrib.hibernate.HibernateModule

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.