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 LicenseOnixpl_UT {
18 private static final Logger LOG = Logger.getLogger(LicenseOnixpl_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/LicenseOnixpl1.xml").toURI());
26 input = FileUtils.readFileToString(file);
27 } catch (Exception e) {
28 LOG.error("Exception :", e);
29 }
30 LicenseOnixpl licenseOnixpl = new LicenseOnixpl();
31 licenseOnixpl = (LicenseOnixpl) licenseOnixpl.deserialize(input);
32 licenseOnixpl.setContent("<onix:ONIXPublicationsLicenseMessage version=\"1.0\" datestamp=\"string\" sourcetype=\"00\" sourcename=\"string\" xmlns:onix=\"http://www.editeur.org/onix-pl\"></onix:ONIXPublicationsLicenseMessage>");
33 String serializeXml = licenseOnixpl.serialize(licenseOnixpl);
34 serializeXml = ParseXml.formatXml(serializeXml);
35 System.out.print(serializeXml);
36 }
37 }