01: package de.schlund.pfixcore.webservice.config;
02:
03: import java.io.ByteArrayInputStream;
04: import java.io.ByteArrayOutputStream;
05: import java.io.File;
06:
07: import junit.framework.TestCase;
08: import de.schlund.pfixxml.config.GlobalConfigurator;
09: import de.schlund.pfixxml.resources.FileResource;
10: import de.schlund.pfixxml.resources.ResourceUtil;
11:
12: public class ConfigurationTest extends TestCase {
13:
14: @Override
15: protected void setUp() throws Exception {
16: GlobalConfigurator.setDocroot(new File("projects")
17: .getAbsoluteFile().getAbsolutePath());
18: }
19:
20: public void testSerialization() throws Exception {
21: FileResource file = ResourceUtil
22: .getFileResourceFromDocroot("webservice/conf" + "/"
23: + "webservice.conf.xml");
24: Configuration conf = ConfigurationReader.read(file);
25: ByteArrayOutputStream out = new ByteArrayOutputStream();
26: ConfigurationReader.serialize(conf, out);
27: ByteArrayInputStream in = new ByteArrayInputStream(out
28: .toByteArray());
29: Configuration refConf = ConfigurationReader.deserialize(in);
30: assertEquals(conf, refConf);
31: }
32:
33: }
|