    1   /***
    2    * @(#)SessionFactoryServiceImplTest.java
    3    *
    4    * JFoxSOAF, Service-Oriented Application Framework
    5    *
    6    * Copyright(c) JFoxSOAF Team
    7    *
    8    * Licensed under the GNU LGPL, Version 2.1 (the "License");
    9    * you may not use this file except in compliance with the License.
    10   * You may obtain a copy of the License at
    11   *
    12   * http://www.gnu.org/copyleft/lesser.html
    13   *
    14   * Unless required by applicable law or agreed to in writing, software
    15   * distributed under the License is distributed on an "AS IS" BASIS,
    16   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    17   * See the License for the specific language governing permissions and
    18   * limitations under the License.
    19   *
    20   * For more information, please visit:
    21   * http://www.jfox.cn/confluence/display/JFoxSOAF/Home
    22   * http://www.huihoo.org/jfox/jfoxsoaf
    23   */
    24
    25  package org.huihoo.jfox.soaf.services.persistence;
    26
    27  import junit.framework.TestCase;
    28  import net.sf.hibernate.SessionFactory;
    29
    30  import org.huihoo.jfox.soaf.container.ServiceFactory;
    31  import org.huihoo.jfox.soaf.container.ServiceLoader;
    32
    33  /***
    34   * JUnit test case for the
    35   * {@link org.huihoo.jfox.soaf.services.persistence.SessionFactoryServiceImpl).
    36   *
    37   * @author <a href="mailto:founder_chen@yahoo.com">Peter Cheng </a>
    38   * @version $Revision:$ $Date:$
    39   * @version Revision: 1.0
    40   */
    41
    42  public class SessionFactoryServiceImplTest extends TestCase {
    43
    44  	private SessionFactoryService sfService = null;
    45      private ServiceLoader sl = ServiceLoader.getInstance();
    46      private ServiceFactory sf = ServiceFactory.getInstance();
    47
    48      /***
    49       * @see TestCase#setUp()
    50       */
    51      protected void setUp() throws Exception {
    52          super.setUp();
    53          if (!sl.isServiceLoaded()) {
    54              sl.initService("jfoxsoaf-config.xml");
    55          }
    56          sfService = (SessionFactoryService)sf.getService(SessionFactoryService.class);
    57      }
    58
    59  	/*
    60  	 * @see TestCase#tearDown()
    61  	 */
    62  	protected void tearDown() throws Exception {
    63  		super.tearDown();
    64  	}
    65
    66  	/***
    67       * Test for SessionFactory getSessionFactory()
    68       */
    69  	public void testGetSessionFactory() {
    70  		SessionFactory sessionFactory = sfService.getSessionFactory(null);
    71  		assertNotNull(sessionFactory);
    72  	}
    73
    74  }