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