    1   /***
    2    * JFoxSOAF, Service-Oriented Application Framework
    3    *
    4    * Copyright (C) www.huihoo.org
    5    *
    6    * Distributable under GNU LGPL For more information, please visit:
    7    * http://www.huihoo.org/jfox/jfoxsoaf
    8    */
    9
    10  package org.huihoo.jfox.soaf.services.persistence;
    11
    12  import junit.framework.TestCase;
    13  import net.sf.hibernate.HibernateException;
    14
    15  import org.huihoo.jfox.soaf.services.logging.LoggingServiceImpl;
    16
    17  /***
    18   * JUnit test case for the
    19   * {@link org.huihoo.jfox.soaf.services.persistence.HibernateService).
    20   *
    21   * @author <a href="mailto:founder_chen@yahoo.com">Peter Cheng </a>
    22   * @version $Revision: 1.2 $ $Date: 2004/10/25 08:31:34 $
    23   * @version Revision: 1.0
    24   */
    25
    26  public class HibernateServiceImplTest extends TestCase {
    27
    28      private HibernateService hService = null;
    29
    30      /***
    31       * @see TestCase#setUp()
    32       */
    33      protected void setUp() throws Exception {
    34          super.setUp();
    35          hService = new HibernateServiceImpl(new LoggingServiceImpl());
    36      }
    37
    38      /***
    39       * @see TestCase#tearDown()
    40       */
    41      protected void tearDown() throws Exception {
    42          super.tearDown();
    43      }
    44
    45      /***
    46       * Test for Session openSession()
    47       */
    48      public void testOpenSession() {
    49          try {
    50              assertNotNull(hService.openSession());
    51          } catch (HibernateException e) {
    52              e.printStackTrace();
    53          }
    54      }
    55
    56      /***
    57       * Test for Configuration getConfiguration()
    58       */
    59      public void testGetConfiguration() {
    60          try {
    61              assertNotNull(hService.getConfiguration());
    62          } catch (HibernateException e) {
    63              e.printStackTrace();
    64          }
    65      }
    66
    67      /***
    68       * Test for SessionFactory getSessionFactory()
    69       */
    70      public void testGetSessionFactory() {
    71          try {
    72              assertNotNull(hService.getSessionFactory());
    73          } catch (HibernateException e) {
    74              e.printStackTrace();
    75          }
    76      }
    77
    78  }