1 /***
2 * @(#)ConfigurationTest.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.schema.config;
26
27 import java.io.InputStream;
28 import java.io.InputStreamReader;
29
30 import junit.framework.TestCase;
31
32 import org.exolab.castor.xml.MarshalException;
33 import org.exolab.castor.xml.ValidationException;
34
35 /***
36 * JUnit test case for the
37 * {@link org.huihoo.jfox.soaf.schema.config.Configration).
38 *
39 * @author <a href="mailto:founder_chen@yahoo.com">Yong.Cheng </a>
40 * @version $Revision: 1.4 $ $Date: 2005/01/26 04:47:31 $
41 * @version Revision: 1.0
42 */
43
44 public class ConfigurationTest extends TestCase {
45
46 private ClassLoader cl = null;
47
48 private InputStream is = null;
49
50 private InputStreamReader isr = null;
51
52 private Configuration configuration = null;
53
54 /***
55 * @see TestCase#setUp()
56 */
57 protected void setUp() throws Exception {
58 super.setUp();
59 cl = Thread.currentThread().getContextClassLoader();
60 is = cl.getResourceAsStream("jfoxsoaf-config.xml");
61 isr = new InputStreamReader(is);
62 try {
63 configuration = Configuration.unmarshal(isr);
64 } catch (MarshalException e) {
65 e.printStackTrace();
66 } catch (ValidationException e) {
67 e.printStackTrace();
68 }
69 }
70
71 /***
72 * @see TestCase#tearDown()
73 */
74 protected void tearDown() throws Exception {
75 super.tearDown();
76 is.close();
77 isr.close();
78 }
79
80 /***
81 * Test for ServiceConfiguration getServiceConfiguration()
82 */
83 public void testGetServiceConfiguration() {
84 ConfigurationEntry[] cofiguraitonEntry = configuration
85 .getServiceConfiguration().getConfigurationEntry();
86
87 assertNotNull(cofiguraitonEntry[0].getValue());
88 }
89
90 /***
91 * Test for SystemInterceptor getSystemInterceptor()
92 */
93 public void testGetSystemInterceptor() {
94
95 Interceptor[] interceptor = configuration.getSystemInterceptor()
96 .getInterceptor();
97
98 assertNotNull(interceptor[0].getValue());
99 }
100
101 }