001package org.kuali.ole.docstore.common.document;
002
003import org.apache.commons.io.FileUtils;
004import org.apache.log4j.Logger;
005import org.junit.Test;
006import org.kuali.ole.docstore.common.util.ParseXml;
007
008import java.io.File;
009
010/**
011 * Created with IntelliJ IDEA.
012 * User: chenchulakshmig
013 * Date: 2/25/14
014 * Time: 4:00 PM
015 * To change this template use File | Settings | File Templates.
016 */
017public class LicenseAttachment_UT {
018    private static final Logger LOG = Logger.getLogger(LicenseAttachment_UT.class);
019
020    @Test
021    public void deserializeAndSerialize() {
022        String input = "";
023        File file = null;
024        try {
025            file = new File(getClass().getResource("/documents/LicenseAttachment1.xml").toURI());
026            input = FileUtils.readFileToString(file);
027        } catch (Exception e) {
028            LOG.error("Exception :", e);
029        }
030        LicenseAttachment licenseAttachment = new LicenseAttachment();
031        licenseAttachment = (LicenseAttachment) licenseAttachment.deserialize(input);
032        licenseAttachment.setContent(null);
033        licenseAttachment.setFileName("123");
034        licenseAttachment.setFormat("pdf");
035        String serializeXml = licenseAttachment.serialize(licenseAttachment);
036        serializeXml = ParseXml.formatXml(serializeXml);
037        System.out.print(serializeXml);
038    }
039}