View Javadoc
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   * Created with IntelliJ IDEA.
12   * User: chenchulakshmig
13   * Date: 2/25/14
14   * Time: 4:16 PM
15   * To change this template use File | Settings | File Templates.
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  }