001package org.kuali.ole.utility; 002 003import org.junit.Test; 004import org.kuali.ole.docstore.model.xmlpojo.ingest.RequestDocument; 005import org.kuali.ole.docstore.model.xstream.ingest.IngestDocumentHandler; 006import org.kuali.ole.docstore.utility.XMLUtility; 007import org.kuali.ole.docstore.xstream.BaseTestCase; 008import org.kuali.ole.docstore.xstream.FileUtil; 009import org.slf4j.Logger; 010import org.slf4j.LoggerFactory; 011 012import java.io.File; 013import java.net.URL; 014 015/** 016 * Created with IntelliJ IDEA. 017 * User: ? 018 * Date: ? 019 * Time: ? 020 * To change this template use File | Settings | File Templates. 021 */ 022public class XMLUtility_UT extends BaseTestCase { 023 private static final Logger LOG = LoggerFactory.getLogger(XMLUtility_UT.class); 024 025 @Test 026 public void testXMLUtility() throws Exception { 027 XMLUtility xmlUtility = new XMLUtility(); 028 URL resource = getClass().getResource("/org/kuali/ole/docstore/model/xstream/ingest/single-record-ingest.xml"); 029 File file = new File(resource.toURI()); 030 String fileContnet = new FileUtil().readFile(file); 031 IngestDocumentHandler ingestDocumentHandler = new IngestDocumentHandler(); 032 RequestDocument request = ingestDocumentHandler.toObject(fileContnet); 033 StringBuffer sb = xmlUtility.getAllContentText(request.getContent().getContent()); 034 LOG.info(sb.toString()); 035 } 036 037}