    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.ejb;
    11
    12  import javax.ejb.EJBException;
    13
    14  import junit.framework.TestCase;
    15
    16  /***
    17   * JUnit test case for the
    18   * {@link org.huihoo.jfox.soaf.services.ejb.EJBProxyServiceImpl).
    19   *
    20   * @author <a href="mailto:founder_chen@yahoo.com">Peter Cheng </a>
    21   * @version $Revision: 1.1 $ $Date: 2004/11/22 15:42:37 $
    22   * @version Revision: 1.0
    23   */
    24
    25  public class EJBProxyServiceImplTest extends TestCase {
    26
    27      private ServiceLocator serviceLocator;
    28
    29      /***
    30       * @see TestCase#setUp()
    31       */
    32      protected void setUp() throws Exception {
    33          super.setUp();
    34          serviceLocator = new ServiceLocatorImpl();
    35      }
    36
    37      /***
    38       * @see TestCase#tearDown()
    39       */
    40      protected void tearDown() throws Exception {
    41          super.tearDown();
    42      }
    43
    44      /***
    45       * Test for constructor.
    46       */
    47      public void testEJBProxyServiceImpl() {
    48          EJBProxyServiceImpl ejbProxyService = new EJBProxyServiceImpl(
    49                  serviceLocator);
    50          assertNotNull(ejbProxyService);
    51      }
    52
    53      /***
    54       * Test for method: getRemoteObject(String jndiName)
    55       * Condition: null
    56       *
    57       * @see EJBProxyService#getRemoteObject(String jndiName)
    58       */
    59      public void testGetRemoteObject() {
    60          EJBProxyServiceImpl ejbProxyService = new EJBProxyServiceImpl(serviceLocator);
    61          Object remoteObJ = null;
    62          try {
    63              remoteObJ = ejbProxyService.getRemoteObject("java:comp/env/TestRemoteEJB");
    64          } catch (EJBException e) {
    65              //e.printStackTrace();
    66          }
    67          assertNull(remoteObJ);
    68      }
    69
    70      /***
    71       * Test for method: getLocalObject(String jndiName)
    72       * Condition: null
    73       *
    74       * @see EJBProxyService#getLocalObject(String jndiName)
    75       */
    76      public void testGetLocalObject() {
    77          EJBProxyServiceImpl ejbProxyService = new EJBProxyServiceImpl(serviceLocator);
    78          Object localOBJ= null;
    79          try {
    80              localOBJ = ejbProxyService.getRemoteObject("java:comp/env/TestLocalEJB");
    81          } catch (EJBException e) {
    82              //e.printStackTrace();
    83          }
    84          assertNull(localOBJ);
    85      }
    86
    87  }