1 package org.kuali.ole.docstore.common.document;
2
3 import org.apache.commons.io.FileUtils;
4 import org.apache.log4j.Logger;
5 import org.junit.Test;
6 import org.kuali.ole.docstore.common.util.ParseXml;
7
8 import java.io.File;
9
10
11
12
13
14
15
16
17 public class LicenseAttachment_UT {
18 private static final Logger LOG = Logger.getLogger(LicenseAttachment_UT.class);
19
20 @Test
21 public void deserializeAndSerialize() {
22 String input = "";
23 File file = null;
24 try {
25 file = new File(getClass().getResource("/documents/LicenseAttachment1.xml").toURI());
26 input = FileUtils.readFileToString(file);
27 } catch (Exception e) {
28 LOG.error("Exception :", e);
29 }
30 LicenseAttachment licenseAttachment = new LicenseAttachment();
31 licenseAttachment = (LicenseAttachment) licenseAttachment.deserialize(input);
32 licenseAttachment.setContent(null);
33 licenseAttachment.setFileName("123");
34 licenseAttachment.setFormat("pdf");
35 String serializeXml = licenseAttachment.serialize(licenseAttachment);
36 serializeXml = ParseXml.formatXml(serializeXml);
37 System.out.print(serializeXml);
38 }
39 }