Examples of DateMidnight


Examples of org.joda.time.DateMidnight

@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

Examples of org.joda.time.DateMidnight

        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

Examples of org.joda.time.DateMidnight

  @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

Examples of org.joda.time.DateMidnight

  @Resource
  private SessionFactory sessionFactory;

  @Test
  public void testJoda() {
    final DateMidnight date = new DateMidnight(1970, 1, 1);
    final Book book = new Book("SpringNamespaceTest", date);
    dao.create(book);
    Assert.assertEquals(dao.findByPublishDate(date), Arrays.asList(book));
  }
View Full Code Here

Examples of org.joda.time.DateMidnight

    Assert.assertEquals(dao.findByPublishDate(date), Arrays.asList(book));
  }

  @Test
  public void testCrud() {
    final Book b = new Book("Crud", new DateMidnight());
    dao.create(b);
    Assert.assertTrue(sessionFactory.getCurrentSession().contains(b));
    dao.update(b);
    Assert.assertTrue(sessionFactory.getCurrentSession().contains(b));
    Assert.assertSame(b, dao.get(b.getPrimaryKey()));
View Full Code Here

Examples of org.joda.time.DateMidnight

    Assert.assertNull(dao.get(b.getPrimaryKey()));
  }

  @Test
  public void testSaveOrUpdate() {
    final Book b = new Book("SaveOrUpdate", new DateMidnight());
    dao.saveOrUpdate(b);
    Assert.assertTrue(sessionFactory.getCurrentSession().contains(b));
    Assert.assertSame(b, dao.get(b.getPrimaryKey()));
    dao.delete(b);
  }
View Full Code Here

Examples of org.joda.time.DateMidnight

    dao.delete(b);
  }

  @Test
  public void testDao() {
    final Book book = new Book("SpringNamespaceTest", new DateMidnight());
    dao.create(book);
    final Set<Book> books = dao.findAll();
    Assert.assertEquals(books, Collections.singleton(book));
    final Book byTitle = dao.findByTitle("SpringNamespaceTest");
    Assert.assertEquals(byTitle, book);
View Full Code Here

Examples of org.joda.time.DateMidnight

    Assert.assertEquals(byTitle, book);
  }

  @Test
  public void testLimitOffset() {
    final Book b1 = new Book("_aaa", new DateMidnight());
    dao.create(b1);
    final Book b2 = new Book("_bbb", new DateMidnight());
    dao.create(b2);
    final Book b3 = new Book("_ccc", new DateMidnight());
    dao.create(b3);
    final List<Book> books = dao.findLimitOffset(1, 1);
    Assert.assertEquals(books, Arrays.asList(b2));
  }
View Full Code Here

Examples of org.joda.time.DateMidnight

    Assert.assertEquals(books, Arrays.asList(b2));
  }

  @Test
  public void testParameterList() {
    final Book b1 = new Book("param1", new DateMidnight());
    dao.create(b1);
    final Book b2 = new Book("param2", new DateMidnight());
    dao.create(b2);
    final Book b3 = new Book("param3", new DateMidnight());
    dao.create(b3);
    final List<Book> books1 = dao.findByIds(1, new long[] { b1.getPrimaryKey(), b2.getPrimaryKey() });
    Assert.assertEquals(books1, Arrays.asList(b1));
    final List<Book> books2 = dao.findByObjectIds(new Long[] { b1.getPrimaryKey(), b2.getPrimaryKey() });
    Assert.assertEquals(books2, Arrays.asList(b1, b2));
View Full Code Here

Examples of org.joda.time.DateMidnight

    @Test
    public void testCurrentDate()
            throws Exception
    {
        // current date is the time at midnight in the session time zone
        DateMidnight dateMidnight = new DateMidnight(session.getStartTime(), DateTimeZone.UTC).withZoneRetainFields(DATE_TIME_ZONE);
        assertFunction("CURRENT_DATE", toDate(dateMidnight.getMillis()));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.