View Javadoc
1   package org.kuali.ole.docstore.engine.service;
2   
3   import org.apache.commons.io.FileUtils;
4   import org.junit.Ignore;
5   import org.junit.Test;
6   import org.kuali.ole.BaseTestCase;
7   import org.kuali.ole.docstore.OleDocStoreException;
8   import org.kuali.ole.docstore.common.client.DocstoreRestClient;
9   import org.kuali.ole.docstore.common.document.Bib;
10  import org.kuali.ole.docstore.common.exception.DocstoreException;
11  import org.slf4j.Logger;
12  import org.slf4j.LoggerFactory;
13  
14  import java.io.File;
15  
16  /**
17   * Created with IntelliJ IDEA.
18   * User: Jaya Bharath reddy
19   * Date: 01/23/14
20   * Time: 11:35 AM
21   * To change this template use File | Settings | File Templates.
22   */
23  public class DocstoreException_UT extends BaseTestCase {
24      private DocstoreRestClient restClient = new DocstoreRestClient();
25  
26      private static final Logger LOG = LoggerFactory.getLogger(DocstoreException_UT.class);
27  
28      @Ignore
29      @Test
30      public void testCreateBibException() {
31          String input = "";
32          File file = null;
33          try {
34              file = new File(getClass().getResource("/documents/BibMarc1.xml").toURI());
35              input = FileUtils.readFileToString(file);
36          } catch (Exception e) {
37              LOG.info("Exception :", e);
38          }
39          Bib bibMarc = new Bib();
40          bibMarc = (Bib) bibMarc.deserialize(input);
41          bibMarc.setId(null);
42          bibMarc.setContent(null);
43          try {
44              restClient.createBib(bibMarc);
45          } catch (DocstoreException e) {
46              throw e;
47          }
48  
49      }
50  }