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.schema.service;
11
12 import java.io.InputStream;
13 import java.io.InputStreamReader;
14
15 import junit.framework.TestCase;
16
17 import org.exolab.castor.xml.MarshalException;
18 import org.exolab.castor.xml.ValidationException;
19
20 /***
21 * JUnit test case for the {@link org.huihoo.jfox.soaf.schema.service.Service).
22 *
23 * @author <a href="mailto:founder_chen@yahoo.com">Peter Cheng </a>
24 * @version $Revision: 1.2 $ $Date: 2004/10/17 15:20:49 $
25 * @version Revision: 1.0
26 */
27
28 public class ServiceTest extends TestCase {
29
30 private ClassLoader cl = null;
31
32 private InputStream is = null;
33
34 private InputStreamReader isr = null;
35
36 /***
37 * @see TestCase#setUp()
38 */
39 protected void setUp() throws Exception {
40 super.setUp();
41 cl = Thread.currentThread().getContextClassLoader();
42 is = cl.getResourceAsStream("system-service.xml");
43 isr = new InputStreamReader(is);
44 }
45
46 /***
47 * @see TestCase#tearDown()
48 */
49 protected void tearDown() throws Exception {
50 super.tearDown();
51 is.close();
52 isr.close();
53 }
54
55 /***
56 * Class under test for org.huihoo.jfox.soaf.schema.service.ServiceEntry[]
57 * getServiceEntry()
58 */
59 public void testGetServiceEntry() {
60 Service service = null;
61 try {
62 service = Service.unmarshal(isr);
63 } catch (MarshalException e) {
64 e.printStackTrace();
65 } catch (ValidationException e) {
66 e.printStackTrace();
67 }
68
69 ServiceEntry[] serviceEntry = service.getServiceEntry();
70
71 assertNotNull(serviceEntry[0].getImplementation());
72 }
73
74 }