View Javadoc

1   package org.kuali.ole.docstore.xstream.ingest;
2   
3   import org.junit.Test;
4   import org.kuali.ole.docstore.model.xmlpojo.ingest.RequestDocument;
5   import org.kuali.ole.docstore.model.xstream.ingest.IngestDocumentHandler;
6   import org.kuali.ole.docstore.xstream.BaseTestCase;
7   import org.kuali.ole.docstore.xstream.FileUtil;
8   
9   import java.io.File;
10  import java.net.URL;
11  
12  import static junit.framework.Assert.assertNotNull;
13  
14  /**
15   * Created by IntelliJ IDEA.
16   * User: pvsubrah
17   * Date: 2/28/12
18   * Time: 8:30 PM
19   * To change this template use File | Settings | File Templates.
20   */
21  public class IngestDocumentHandler_UT extends BaseTestCase {
22      @Test
23      public void testConvertIngestXML() throws Exception {
24          URL resource = getClass().getResource("/org/kuali/ole/docstore/model/xstream/ingest/single-record-ingest.xml");
25          File file = new File(resource.toURI());
26          String fileContnet = new FileUtil().readFile(file);
27  
28          IngestDocumentHandler ingestDocumentHandler = new IngestDocumentHandler();
29          RequestDocument request = ingestDocumentHandler.toObject(fileContnet);
30          assertNotNull(request);
31          assertNotNull(request.getCategory());
32          assertNotNull(request.getType());
33          assertNotNull(request.getFormat());
34          assertNotNull(request.getContent());
35      }
36  }