Package net.sf.autodao.impl

Examples of net.sf.autodao.impl.Book


  @Resource
  private BookDao dao;

  @Test
  public void testDao() {
    final Book book = new Book("ArbitraryResultTypeTest", new DateMidnight());
    dao.create(book);
    final List<String> titles = dao.findTitles();
    Assert.assertEquals(titles, Arrays.asList(book.getTitle()));
  }
View Full Code Here


  }

  @Test
  public void testSqlQuery() {
    final DateMidnight date = new DateMidnight();
    final Book book = new Book("sql query", date);
    dao.create(book);
    final List<Object[]> list = dao.getBookByTitle("sql query");
    Assert.assertTrue(list.size() == 1);
    Assert.assertEquals(list.get(0), new Object[] { BigInteger.valueOf(book.getPrimaryKey()), new Timestamp(date.getMillis()), book.getTitle() });
  }
View Full Code Here

  }

  @Test
  public void testSqlNamedQuery() {
    final DateMidnight date = new DateMidnight();
    final Book book = new Book("sql named query", date);
    dao.create(book);
    final BigInteger count = dao.countBooks();
    Assert.assertEquals(count, BigInteger.valueOf(1));
  }
View Full Code Here

  @Resource
  private BookDao dao;

  @Test
  public void testDao() {
    final Book book = new Book("ArbitraryResultTypeTest", new DateMidnight());
    dao.create(book);
    final List<String> titles = dao.findTitles();
    Assert.assertEquals(titles, Arrays.asList(book.getTitle()));
  }
View Full Code Here

  }

  @Test
  public void testSqlQuery() {
    final DateMidnight date = new DateMidnight();
    final Book book = new Book("sql query", date);
    dao.create(book);
    final List<Object[]> list = dao.getBookByTitle("sql query");
    Assert.assertTrue(list.size() == 1);
    Assert.assertEquals(list.get(0), new Object[] { BigInteger.valueOf(book.getPrimaryKey()), new Timestamp(date.getMillis()), book.getTitle() });
  }
View Full Code Here

  }

  @Test
  public void testSqlNamedQuery() {
    final DateMidnight date = new DateMidnight();
    final Book book = new Book("sql named query", date);
    dao.create(book);
    final BigInteger count = dao.countBooks();
    Assert.assertEquals(count, BigInteger.valueOf(1));
  }
View Full Code Here

public class ExplicitEntityTest extends AbstractTransactionalTestNGSpringContextTests {

  @SuppressWarnings({ "unchecked" })
  @Test
  public void testDao() {
    final Book book = new Book("ExplicitEntityTest", new DateMidnight());
    final NoEntityDao dao = applicationContext.getBean("dao", NoEntityDao.class);
    dao.create(book);
  }
View Full Code Here

@ContextConfiguration(locations = "classpath:namedParamContext.xml")
public class NamedParamTest extends AbstractTransactionalTestNGSpringContextTests {

  @Test
  public void test() {
    final Book book = new Book("NamedParamTest", new DateMidnight());
    final NamedParamDao dao = applicationContext.getBean("dao", NamedParamDao.class);
    dao.create(book);
    final Book fromDb = dao.findNamedByTitle("NamedParamTest");
    Assert.assertEquals(book, fromDb);
  }
View Full Code Here

        AutoDiscoveredExcludedDao.class.getName() + " must have been skipped");
  }

  @Test
  public void testDao() {
    final Book book = new Book("AutoDiscoveredDaoTest", new DateMidnight());
    sessionFactory.getCurrentSession().save(book);
    final List<Book> books = dao.findBooks();
    Assert.assertEquals(books, Collections.singleton(book));
  }
View Full Code Here

  @Resource
  private SessionFactory sessionFactory;

  @Test
  public void testDao() {
    final Book book = new Book("SpringNamespaceTest", new DateMidnight());
    sessionFactory.getCurrentSession().save(book);
    final List<Book> books = dao.findBooks();
    Assert.assertEquals(books, Collections.singleton(book));
  }
View Full Code Here

TOP

Related Classes of net.sf.autodao.impl.Book

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.