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