Package org.jrest4guice.core.guice

Examples of org.jrest4guice.core.guice.GuiceContext


  private static String pk;
 
  @SuppressWarnings("unchecked")
  @BeforeClass
  public static void setUpBeforeClass() throws Exception {
    GuiceContext context = GuiceContext.getInstance();
    context.addModuleProvider(
            new JpaGuiceModuleProvider(),
            (new DaoModuleProvider("org.jrest4guice.dao.test.jpa", "org.jrest4guice.dao.jpa"))
                    .addActionContextProviders(new JpaContextProvider())).init();
    bookDao = context.getBean(BookDao.class);
   
    Book b0 = getNewBook("Book 0", 10f, 10);
    Book b1 = getNewBook("Book 1", 10f, 20);
    Book b2 = getNewBook("Book 2", 10f, 30);
    Book b3 = getNewBook("Book 3", 10f, 40);
    Book b4 = getNewBook("Book 4", 10f, 50);
    Book b5 = getNewBook("Book 5", 20f, 60);
    Book b6 = getNewBook("Book 6", 20f, 70);
    Book b7 = getNewBook("Book 7", 20f, 80);
    Book b8 = getNewBook("Book 8", 20f, 90);
    Book b9 = getNewBook("Book 9", 20f, 100);
    bookDao.create(b0, b1, b2, b3, b4, b5, b6, b7, b8, b9);
   
    pk = b0.getId();
    Assert.assertNotNull(b0.getId());
    Assert.assertNotNull(b1.getId());
    Assert.assertNotNull(b2.getId());
    Assert.assertNotNull(b3.getId());
    Assert.assertNotNull(b4.getId());
    Assert.assertNotNull(b5.getId());
    Assert.assertNotNull(b6.getId());
    Assert.assertNotNull(b7.getId());
    Assert.assertNotNull(b8.getId());
    Assert.assertNotNull(b9.getId());
   
    dao = context.getBean(RetrieveDao.class);
    Assert.assertNotNull(dao);
  }
View Full Code Here


  private static BookDao dao;
 
  @SuppressWarnings("unchecked")
  @BeforeClass
  public static void setup() {
    GuiceContext context = GuiceContext.getInstance();
    context.addModuleProvider(
            (new DaoModuleProvider("org.jrest4guice.dao.test.jpa", "org.jrest4guice.dao.jpa"))
                    .addActionContextProviders(new JpaContextProvider()),
            new JpaGuiceModuleProvider()).init();
    dao = context.getBean(BookDao.class);
   
    Book b0 = getNewBook("Book 0", 10f, 10);
    Book b1 = getNewBook("Book 1", 10f, 20);
    Book b2 = getNewBook("Book 2", 10f, 30);
    Book b3 = getNewBook("Book 3", 10f, 40);
View Full Code Here

    // DaoContext context = DaoContext.getInstance();
    // context.addScanPaths("org.jrest4guice.dao.jpa", "org.jrest4guice.dao.test.jpa");
    // context.init();
    // BookDao dao = context.getBean(BookDao.class);
   
    GuiceContext context = GuiceContext.getInstance();
    context.addModuleProvider(new DaoModuleProvider("org.jrest4guice.dao.test.jpa", "org.jrest4guice.dao.jpa"),
            new JpaGuiceModuleProvider()).init();
    BookDao dao = context.getBean(BookDao.class);
    Assert.assertNotNull(dao);
   
    Book b1 = getNewBook("Book 1", 10f, 10);
    Book b2 = getNewBook("Book 2", 10f, 10);
    dao.create(b1, b2);
View Full Code Here

TOP

Related Classes of org.jrest4guice.core.guice.GuiceContext

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.